Documentation

Build with 1Router

A single, OpenAI-compatible API for every model. Drop-in replacement — just change the base URL.

Quickstart

1Router is fully OpenAI-compatible. Point your existing SDK at our API and it just works.

cURL
curl https://api.1router.com/v1/chat/completions \
  -H "Authorization: Bearer $ROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Python (openai SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.1router.com/v1",
    api_key=os.environ["ROUTER_API_KEY"]
)

response = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
JavaScript / TypeScript
import OpenAI from "openai"

const client = new OpenAI({
  baseURL: "https://api.1router.com/v1",
  apiKey: process.env.ROUTER_API_KEY,
})

const response = await client.chat.completions.create({
  model: "openai/gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
})
console.log(response.choices[0].message.content)

Key Concepts

Model Routing

1Router automatically routes requests to the best provider based on latency, price, and availability. Specify a model by provider/model-name or use smart routing with 1router/auto to let us pick.

Fallbacks

Configure fallback models so if a provider is down, requests automatically retry on the next best option. No code changes needed — set it once in your dashboard.

Rate Limiting

Set per-key rate limits, per-model quotas, and spending caps. Protect your budget and prevent runaway costs.

Ready to start building?

Get your API key and make your first call in minutes.