CrewAI talks to LLMs through LiteLLM. Point its LLM at the Orbitrage gateway
and every agent’s call is routed and traced.
Install
pip install -U orbitrage crewai
Setup
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-4o-mini", # 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())
Model names: CrewAI/LiteLLM validate the model id client-side against their
registry, so recognized OpenAI names work out of the box — openai/gpt-4o-mini,
openai/gpt-4o, openai/gpt-4.1. The gateway serves them and traces everything.Non-OpenAI ids like openai/grok-4-fast, openai/claude-sonnet-4-6, or
openai/auto are rejected by LiteLLM before the call is made. To use them,
register the model with LiteLLM first:import litellm
litellm.register_model({
"grok-4-fast": {"litellm_provider": "openai", "mode": "chat",
"supports_function_calling": True},
})
llm = LLM(model="openai/grok-4-fast", base_url="https://api.orbitrage.ai/v1",
api_key=os.environ["ORBITRAGE_API_KEY"])
CrewAI agents use CrewAI-native tools, but you can call managed
tools directly through the LLM with llm.call(...) —
Orbitrage runs them server-side and returns the final answer.
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
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.