OpenRouter (gateway)

Point OpenAI-compatible calls at the Respan gateway and use OpenRouter model names (openrouter/openai/gpt-5.5, openrouter/anthropic/claude-sonnet-4-5, etc.).

Setup

1

Install packages

$pip install openai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

No OPENROUTER_API_KEY is needed when billing/routing through Respan Gateway credits. For BYOK, configure credentials in the Respan provider settings.

3

Point client to gateway

1from openai import OpenAI
2import os
3
4client = OpenAI(
5 api_key=os.environ["RESPAN_API_KEY"],
6 base_url="https://api.respan.ai/api",
7)
8
9response = client.chat.completions.create(
10 model="openrouter/openai/gpt-5.5",
11 messages=[{"role": "user", "content": "Hello via Respan Gateway OpenRouter."}],
12)
13print(response.choices[0].message.content)
4

Switch models

1client.chat.completions.create(model="openrouter/meta-llama/llama-3.3-70b-instruct", messages=[{"role":"user","content":"Compare routing options."}])
2client.chat.completions.create(model="openrouter/anthropic/claude-sonnet-4-5", messages=[{"role":"user","content":"Summarize routing."}])

See OpenRouter model docs for full provider/key options and routing behavior.