Getting started
Router4AI is an OpenAI-compatible LLM router. You swap one URL and get automatic failover across providers, tier-based routing, and per-token billing.
1. Create an API key
Sign in at app.router4ai.app. Go to API Keys → Create key. You'll see the full key once — copy it immediately.
ram_live_yourkeyhere...Keys start with ram_live_ and are hashed (Argon2) on our side. Lost keys can be rotated from the dashboard.
2. Swap the OpenAI baseURL
Works with any OpenAI-compatible SDK or HTTP client. Only the baseURL changes:
Node / TypeScript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.RAM_API_KEY, // ram_live_xxx
baseURL: 'https://api.router4ai.app/v1',
});
const response = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(response.choices[0].message.content);Python
from openai import OpenAI
client = OpenAI(
api_key="ram_live_xxx",
base_url="https://api.router4ai.app/v1",
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)curl
curl https://api.router4ai.app/v1/chat/completions \
-H "Authorization: Bearer ram_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hello"}]
}'3. Supported models
Models are auto-routed to one of three tiers. You can pass any of these model IDs and the router picks the best provider:
- gpt-4o-mini
- claude-haiku-4-5
- gemini-1.5-flash
- deepseek-chat
- gpt-4o
- claude-sonnet-4-6
- gemini-1.5-pro
- claude-opus-4-7
- gpt-4-turbo
You can also pin a specific provider by prefixing the model:openai:gpt-4o-mini, anthropic:claude-sonnet-4-6, etc.
4. Response metadata
Every response includes a _ram field so you can audit routing decisions:
{
"id": "chatcmpl-...",
"choices": [...],
"usage": { "prompt_tokens": 14, "completion_tokens": 18 },
"_ram": {
"tier": "fast",
"provider_used": "openai",
"failover_count": 0,
"latency_ms": 527,
"cost_billed_cents_usd": 0.0028,
"cache_hit": false,
"request_id": "84f9a90c-..."
}
}5. Errors
401Invalid or missing API key402Trial exhausted — upgrade at /billing429Rate limit exceeded (burst)503All providers failed — try again or file a ticket6. Billing
You start on a free trial: 1,000,000 tokens valid for 14 days. After the trial (or whenever you want), upgrade via Billing to Pro ($49/mo) or Business ($499/mo). Stripe charges your card once per billing period with a single invoice covering base fee + usage overage.
- • Cancel anytime — your keys keep working until the period ends.
- • Usage is reported to Stripe Meter Events per request.
- • Invoices, receipts, and card updates live in Stripe Customer Portal.
7. Rate limits
Default: 60 requests/second per tenant. Need more? Contact support. Limits are enforced via Upstash Redis, so bursts over short windows are tolerated.
Need help?
Email support@router4ai.app. For security issues, use the subject “SECURITY”.