SDK integration
Point an existing chat-completions client at CyberRouter.
Configure your existing client
CyberRouter accepts OpenAI-compatible chat-completions requests. In a compatible client, change its base URL, use a CyberRouter API key, and select a model ID from CyberRouter.
import os
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:3002/v1",
api_key=os.environ["CYBERROUTER_API_KEY"],
)
response = client.chat.completions.create(
model="deepseek/deepseek-flash:cyberrouter",
messages=[{"role": "user", "content": "Summarize this maintenance note: the backup completed."}],
max_completion_tokens=256,
)
print(response.choices[0].message.content)
print(response.id)Examples use DeepSeek Flash. Connect a DeepSeek provider key first, or replace the model ID with a supported model from your catalog. Set CYBERROUTER_API_KEY in your application environment to the key you created in CyberRouter.
Compatibility applies to the documented chat surface. Other SDK services and provider-specific features are available only when listed in our endpoint directory.
Pass CyberRouter options
In the Python client, use extra_body for CyberRouter-specific fields such as provider and models. Response extensions are exposed through model_extra.
response = client.chat.completions.create(
model="deepseek/deepseek-flash:cyberrouter",
messages=[{"role": "user", "content": "Summarize this maintenance note: the backup completed."}],
max_completion_tokens=256,
extra_body={"provider": {"only": ["deepseek"]}},
)
print(response.model_extra.get("cyberrouter", {}))See supported parameters before carrying over options from another gateway. Unknown fields produce a validation error.