Overview
Quickstart
Get started with OneRouter — the unified API gateway for 200+ AI models. In 5 minutes you'll have your first API key and make a production-ready call to any frontier model.
Using the OneRouter API
OneRouter provides an OpenAI-compatible API endpoint. If you've ever used the OpenAI API, you already know how to use OneRouter — just change the base URL and start calling 200+ models from 50+ providers.
All requests use the same format: POST https://api.onerouter.app/v1/chat/completions with your API key in the Authorization header.
python
import requests
def chat(prompt: str, model: str = "gpt-4o"):
response = requests.post(
"https://api.onerouter.app/v1/chat/completions",
headers={
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
},
json={
"model": model,
"messages": [{"role": "user", "content": prompt}],
},
)
return response.json()["choices"][0]["message"]["content"]
print(chat("Hello! What models are available?"))typescript
const chat = async (prompt: string, model = 'gpt-4o') => {
const res = await fetch('https://api.onerouter.app/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-your-api-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model,
messages: [{ role: 'user', content: prompt }],
}),
});
const data = await res.json();
return data.choices[0].message.content;
};shell
curl -X POST "https://api.onerouter.app/v1/chat/completions" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'Already using the OpenAI SDK? Just change
base_url to https://api.onerouter.app/v1 and your existing code instantly gains access to 200+ models — no rewrites needed.Using the OpenAI SDK
The fastest way to get started if you're already in the OpenAI ecosystem:
python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.onerouter.app/v1", # ← The only change
)
response = client.chat.completions.create(
model="gpt-4o", # Or "claude-opus-4-8", "gemini-2.5-pro", etc.
messages=[{"role": "user", "content": "Explain quantum computing in simple terms."}],
)
print(response.choices[0].message.content)Get Your API Key
- Sign up at api.onerouter.app/register
- Navigate to API Keys in the sidebar
- Click Create Key and give it a name
- Copy your key — it starts with
sk- - Set it as an environment variable:
ONEROUTER_API_KEY=sk-your-key
Security note: Never expose your API key in client-side code. Use environment variables or a secure backend proxy. All requests to OneRouter are encrypted with TLS 1.3.
What's Next?
- Browse the full model catalog — 200+ models across 50+ providers
- Learn about automatic failover for production resilience
- Explore SDK integrations for Python, JavaScript, and more
- Read the Chat Completions API reference for all parameters