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

Point AutoGen to the Respan gateway

1import os
2
3from autogen_ext.models.openai import OpenAIChatCompletionClient
4
5model_client = OpenAIChatCompletionClient(
6 model="gpt-5-mini",
7 api_key=os.environ["RESPAN_API_KEY"],
8 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 the model value to use a different model through the same gateway.

1model_client = OpenAIChatCompletionClient(
2 model="claude-sonnet-4-5-20250929",
3 api_key=os.environ["RESPAN_API_KEY"],
4 base_url="https://api.respan.ai/api",
5)

See the full model list.