Skip to navigation

AutoGen (gateway)

Route AutoGen model calls through the Respan gateway to use 1000+ 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

import os
from autogen_ext.models.openai import OpenAIChatCompletionClient
model_client = OpenAIChatCompletionClient(
model="gpt-5-mini",
api_key=os.environ["RESPAN_API_KEY"],
base_url="https://api.respan.ai/api",
model_info={
"vision": False,
"function_calling": True,
"json_output": True,
"structured_output": True,
"family": "unknown",
},
)

Switch models

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

model_client = OpenAIChatCompletionClient(
model="claude-sonnet-4-5-20250929",
api_key=os.environ["RESPAN_API_KEY"],
base_url="https://api.respan.ai/api",
model_info={
"vision": False,
"function_calling": True,
"json_output": True,
"structured_output": True,
"family": "unknown",
},
)

AutoGen requires model_info for any model name it does not recognize as an OpenAI model.

See the full model list.