For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
    • Overview
  • Tracing
  • Gateway
      • OpenAI Agents
      • Claude Agent SDK
      • Vercel AI SDK
      • Pydantic AI
      • CrewAI
      • Haystack
      • LangChain
      • LangGraph
      • Langflow
      • LlamaIndex
      • AutoGen
      • DSPy
      • Google ADK
      • Smolagents
      • Strands Agents
      • AgentSpec
      • Guardrails
      • Agno
      • MCP
      • BeeAI
      • Pipecat
      • Superagent
  • Others
  • Migrating
    • Braintrust
    • Portkey
    • Langfuse
LogoLogo
DiscordPlatform
On this page
  • Setup
  • Switch models
GatewayAgent Frameworks

CrewAI (gateway)

Was this page helpful?
Previous

Haystack (gateway)

Next
Built with

Route CrewAI’s underlying LLM calls through the Respan gateway to use 250+ models from different providers. Only your RESPAN_API_KEY is needed - no separate provider keys required.

Setup

1

Install packages

$pip install respan-ai respan-instrumentation-crewai crewai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

No separate OpenAI provider key is needed. The code below points CrewAI’s OpenAI-compatible traffic to the Respan gateway.

3

Point CrewAI to the Respan gateway

1import os
2
3from respan import Respan
4from respan_instrumentation_crewai import CrewAIInstrumentor
5
6respan_api_key = os.environ["RESPAN_API_KEY"]
7respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")
8
9os.environ["OPENAI_API_KEY"] = respan_api_key
10os.environ["OPENAI_BASE_URL"] = respan_base_url
11
12respan = Respan(
13 api_key=respan_api_key,
14 base_url=respan_base_url,
15 instrumentations=[CrewAIInstrumentor()],
16)
17
18from crewai import Agent, Crew, LLM, Task
19
20llm = LLM(
21 model="gpt-4.1-nano",
22 api_key=respan_api_key,
23 base_url=respan_base_url,
24)
25
26researcher = Agent(
27 role="Researcher",
28 goal="Research the latest AI trends",
29 backstory="Senior AI researcher.",
30 llm=llm,
31)
32
33task = Task(
34 description="Research the latest trends in AI agent frameworks.",
35 expected_output="A summary of key trends.",
36 agent=researcher,
37)
38
39crew = Crew(agents=[researcher], tasks=[task])
40print(crew.kickoff())
41respan.flush()

Switch models

Change the model parameter on LLM to use 250+ models from different providers through the same gateway.

1llm = LLM(
2 model="claude-sonnet-4-5-20250929",
3 api_key=respan_api_key,
4 base_url=respan_base_url,
5)

See the full model list.