Quickstart
Make your first request with the OpenAI SDK or cURL.
https://onerouter.com/v1/chat/completionsBase URLs
Use the shortest protocol-specific base URL that matches your client. OpenAI-compatible SDKs use https://onerouter.com/v1. Claude native requests use https://onerouter.com with /v1/messages. Gemini native requests use https://onerouter.com/v1beta or the /gemini/* compatibility prefix.
| Parameter | Type | Required | Description |
|---|---|---|---|
| OpenAI-compatible | base URL | required | https://onerouter.com/v1 |
| Claude native | base URL | required | https://onerouter.com |
| Gemini native | base URL | required | https://onerouter.com/v1beta |
Authentication
Send your OneRouter API key with every request. OpenAI-compatible clients should use Authorization: Bearer YOUR_API_KEY. Gemini-native clients may also use x-goog-api-key. Keys are issued from the console and use the OneRouter key format.
Authorization: Bearer YOUR_API_KEYInstall an SDK
OpenAI-compatible SDKs work by setting the base_url or baseURL to OneRouter. Native Anthropic and Gemini SDKs can also be used when they allow a custom base URL.
pip install openaiSend a chat request
from openai import OpenAI
client = OpenAI(
base_url="https://onerouter.com/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="openai/gpt-5.2",
messages=[{"role": "user", "content": "Hello from OneRouter."}],
)
print(response.choices[0].message.content)Streaming
For OpenAI-compatible and Claude-compatible requests, set stream: true in the JSON body. Gemini streaming can use :streamGenerateContent, alt=sse, or model/client-specific streaming helpers. Streaming responses are delivered as SSE chunks; handle network disconnects and mid-stream errors explicitly.
curl https://onerouter.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.2",
"messages": [{"role": "user", "content": "Write a short launch note."}],
"stream": true
}'Next steps
Use /v1/models to discover available models, read the protocol pages for Claude and Gemini native clients, then review billing units before using media models in production.