Build with 1Router
A single, OpenAI-compatible API for every model. Drop-in replacement — just change the base URL.
Quickstart
Make your first API call in under 5 minutes.
API Reference
Full OpenAI-compatible API documentation.
Self-Hosting
Deploy 1Router on your own infrastructure.
Providers
Configure and manage model providers.
Quickstart
The managed site proxy accepts Better Auth user API keys at /api/v1. Direct gateway deployments use the server-level ROUTER_API_KEY at their own /v1 endpoint.
curl https://your-site.example/api/v1/chat/completions \
-H "Authorization: Bearer $ROUTER_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'from openai import OpenAI
client = OpenAI(
base_url="https://your-site.example/api",
api_key=os.environ["ROUTER_USER_API_KEY"]
)
response = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://your-site.example/api",
apiKey: process.env.ROUTER_USER_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
AvailableThe gateway resolves an explicit provider/model-name from the shared catalog, then applies weighted deployments, passive health, cooldowns, and bounded retries. Automatic cost/latency optimization is planned.
Fallbacks
RoadmapConfigured deployment pools support weighted selection, passive health tracking, exponential cooldowns, and bounded retries. When a deployment fails with a retryable error, the gateway can select another healthy deployment in the same logical model pool.
Rate Limiting & Usage
AvailableThe control plane records authenticated requests through the Next.js proxy in PostgreSQL, including model, status, duration, and token counts when providers return them. Verified rankings aggregate successful records from this ledger, while direct gateway clients and anonymous traffic remain excluded. Downstream applications can register an explicit slug and opt into the public showcase through the account page. Per-key and organization policies, token budgets, spend controls, concurrency caps, and distributed PostgreSQL rate limiting are enforced before provider calls.
Ready to start building?
Configure the self-hosted alpha and make your first call in minutes.