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

# BeeAI (gateway)

> 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 required.

## Setup

#### Install packages

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

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

#### 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://api.respan.ai/api"),
)


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


asyncio.run(main())
```

## 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://api.respan.ai/api")
llm = ChatModel.from_name("openai:gpt-5-mini", api_key=..., base_url="https://api.respan.ai/api")
```

> **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.

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