Skip to navigation

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

1

Install packages

pip install beeai-framework
2

Set environment variables

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.

3

Initialize and run

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.

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")

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.