> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://respan.ai/docs/_mcp/server.

# CrewAI (gateway)

> Set up CrewAI with the Respan gateway.

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

## Setup

#### Install packages

```bash
pip install crewai
```

#### Set environment variables

```bash
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.

#### Point CrewAI to the Respan gateway

```python
import os

from crewai import Agent, Crew, LLM, Task

respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = "https://api.respan.ai/api"

os.environ["OPENAI_API_KEY"] = respan_api_key
os.environ["OPENAI_BASE_URL"] = respan_base_url

llm = LLM(
    model="gpt-5.5",
    api_key=respan_api_key,
    base_url=respan_base_url,
)

researcher = Agent(
    role="Researcher",
    goal="Research the latest AI trends",
    backstory="Senior AI researcher.",
    llm=llm,
)

task = Task(
    description="Research the latest trends in AI agent frameworks.",
    expected_output="A summary of key trends.",
    agent=researcher,
)

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

> **Note**
>
> CrewAI and its underlying LLM adapter may read OpenAI-shaped environment variables. The example maps those values from `RESPAN_API_KEY`; it does not require an OpenAI provider key.

## Switch models

Change the `model` parameter on `LLM` to use 1000+ models from different providers through the same gateway. Keep the `openai/` prefix on non-OpenAI slugs, otherwise CrewAI switches to its native provider for that model family and ignores `base_url`.

```python
llm = LLM(
    model="openai/claude-sonnet-4-5-20250929",
    api_key=respan_api_key,
    base_url=respan_base_url,
)
```

See the [full model list](https://platform.respan.ai/platform/models).