---
title: "BeeAI (gateway)"
description: "Set up BeeAI with the Respan gateway."
---

Route BeeAI'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 are required.

Paste this into your coding agent:

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

## Setup

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

```bash
pip install beeai-framework
```

</Step>

<Step title="Set environment variables">

```bash
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
```

The code below passes `RESPAN_API_KEY` and the Respan base URL to BeeAI's OpenAI-compatible LLM wrapper. No real OpenAI key is needed.

</Step>

<Step title="Initialize and run">

```python
import asyncio
import os

from beeai_framework.backend import ChatModel, UserMessage

llm = ChatModel.from_name(
    "openai:gpt-5.5",
    api_key=os.environ["RESPAN_API_KEY"],
    base_url=os.getenv("RESPAN_BASE_URL", "https://gateway.respan.ai"),
)


async def main() -> None:
    response = await llm.run([UserMessage("Tell me about recursion.")], max_tokens=256)
    print(response.get_text_content())


asyncio.run(main())
```

</Step>
</Steps>

## Switch models

Use another OpenAI model ID through the same gateway-backed chat model. BeeAI separates the provider and model with a colon.

```python
llm = ChatModel.from_name("openai:gpt-5.5", api_key=..., base_url="https://gateway.respan.ai")
llm = ChatModel.from_name("openai:gpt-5-mini", api_key=..., base_url="https://gateway.respan.ai")
```

<Note>
BeeAI uses LiteLLM under the hood. Avoid documenting Claude or Gemini behind an `openai/` model prefix because that makes the transport provider look like the model provider. Use the Respan API or OpenAI SDK gateway pages for provider-neutral Claude and Gemini examples.
</Note>

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