Smolagents (gateway)

Route Smolagents’ underlying LLM calls through the Respan gateway to use 250+ models from different providers. Only your RESPAN_API_KEY is needed — no separate provider keys required.

Setup

1

Install packages

$pip install smolagents litellm
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

No OPENAI_API_KEY needed — the Respan gateway handles provider authentication.

3

Point Smolagents to the Respan gateway

1import os
2from smolagents import CodeAgent, LiteLLMModel
3
4model = LiteLLMModel(
5 model_id="openai/gpt-5.5",
6 api_key=os.environ["RESPAN_API_KEY"],
7 api_base="https://api.respan.ai/api",
8)
9
10agent = CodeAgent(tools=[], model=model)
11print(agent.run("What is the capital of France?"))

Switch models

Use another OpenAI model ID through the same gateway-backed LiteLLM model wrapper.

1LiteLLMModel(model_id="openai/gpt-5.5", api_key=..., api_base="https://api.respan.ai/api")
2LiteLLMModel(model_id="openai/gpt-5-mini", api_key=..., api_base="https://api.respan.ai/api")

Smolagents uses LiteLLM provider namespaces. This page avoids showing Claude or Gemini behind an openai/ prefix; use the Respan API or OpenAI SDK gateway pages for provider-neutral Claude and Gemini examples.

See the full model list.