Documentation
On this page

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.

Python · OpenAI-compatible client
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.

Python · provider preference
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.

Accessibility

Adjust how CyberRouter looks and moves. Preferences apply to this browser.

You can also use your browser’s zoom controls.

Accessibility help

Analytics preferences

Choose anonymous page counts or optional visit, scroll and reading-time analytics. Privacy details.