> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitrage.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI

> Route + trace CrewAI agents through Orbitrage.

CrewAI talks to LLMs through LiteLLM. Point its `LLM` at the Orbitrage gateway
and every agent's call is routed and traced.

## Install

```bash theme={null}
pip install -U orbitrage crewai
```

## Setup

```python theme={null}
import os, orbitrage
orbitrage.init(os.environ["ORBITRAGE_API_KEY"], user_id="customer_42")

from crewai import Agent, Task, Crew, LLM

llm = LLM(
    model="openai/gpt-oss-20b",                  # see the model-name note below
    base_url="https://api.orbitrage.ai/v1",
    api_key=os.environ["ORBITRAGE_API_KEY"],
)

researcher = Agent(role="Researcher", goal="Find the answer",
                   backstory="A sharp analyst.", llm=llm, verbose=False)
task = Task(description="Summarize what an LLM router does, in one sentence.",
            expected_output="one sentence", agent=researcher)

print(Crew(agents=[researcher], tasks=[task], verbose=False).kickoff())
```

<Warning>
  **Model names:** CrewAI/LiteLLM validate the model id client-side against their
  registry, so **recognized OpenAI names pass validation out of the box** —
  `openai/gpt-oss-20b`, `openai/gpt-4o`, `openai/gpt-4.1`. The gateway serves them
  and traces everything. Note that `gpt-4o`/`gpt-4.1` are closed frontier models
  and need your own OpenAI key ([BYOK](/concepts/byok)); `gpt-oss-20b` is
  open-weight and billed to credits.

  Ids LiteLLM doesn't recognize — `openai/minimax-m3`, `openai/glm-5.2`, or
  `openai/auto` are **rejected by LiteLLM before the call is made**. To use them,
  register the model with LiteLLM first:

  ```python theme={null}
  import litellm
  litellm.register_model({
      "minimax-m3": {"litellm_provider": "openai", "mode": "chat",
                      "supports_function_calling": True},
  })
  llm = LLM(model="openai/minimax-m3", base_url="https://api.orbitrage.ai/v1",
            api_key=os.environ["ORBITRAGE_API_KEY"])
  ```
</Warning>

## Managed tools (server-side, no keys)

CrewAI agents use CrewAI-native tools, but you can call [managed
tools](/concepts/tools-gateway) directly through the LLM with `llm.call(...)` —
Orbitrage runs them server-side and returns the final answer.

```python theme={null}
out = llm.call(
    [{"role": "user", "content": "Use the calculator to compute 1234*5678. Only the number."}],
    tools=[{
        "type": "function",
        "function": {"name": "calculator_orbitrage", "description": "Evaluate math",
                     "parameters": {"type": "object",
                                    "properties": {"expression": {"type": "string"}},
                                    "required": ["expression"]}},
    }],
)
print(out)   # 7006652
```

<Note>
  CrewAI's `LLM` doesn't forward custom headers, so per-request `user_id`
  switching isn't available through it — the `user_id` you pass to
  `orbitrage.init()` attributes the whole crew's run.
</Note>
