AutoGen (gateway)

Route AutoGen model calls through the Respan gateway to use 250+ models. Only your Respan API key is needed — no separate provider key is required in the example process.

Setup

1

Install packages

$pip install autogen-agentchat "autogen-ext[openai]"
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export RESPAN_BASE_URL="https://api.respan.ai/api"
$export RESPAN_MODEL="gpt-5-mini"
3

Point AutoGen to the Respan gateway

1import os
2
3from autogen_ext.models.openai import OpenAIChatCompletionClient
4
5model_client = OpenAIChatCompletionClient(
6 model=os.getenv("RESPAN_MODEL", "gpt-5-mini"),
7 api_key=os.environ["RESPAN_API_KEY"],
8 base_url=os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api"),
9 model_info={
10 "vision": False,
11 "function_calling": True,
12 "json_output": True,
13 "structured_output": True,
14 "family": "unknown",
15 },
16)

Switch models

Change RESPAN_MODEL to use a different model through the same gateway.

$export RESPAN_MODEL="claude-sonnet-4-5-20250929"

See the full model list.