---
title: "CrewAI (gateway)"
description: "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.

Paste this into your coding agent:

```text
Help me set up the Respan gateway with the CrewAI integration.
Follow https://www.respan.ai/docs/integrations/gateway/crew-ai.md
```

## Setup

<Steps>
<Step title="Install packages">

```bash
pip install crewai
```

</Step>

<Step title="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.

</Step>

<Step title="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://gateway.respan.ai"

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.
</Note>

</Step>
</Steps>

## 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).
