Three lines to switch providers. Zero to switch back.
NovaRouter accepts the core OpenAI chat, responses and embeddings shapes. Provider routing and failover happen on the server, while your client keeps one base URL.
Ordered routing
Each model alias declares an ordered chain of upstreams. The first that answers serves the request; a rate limit or 5xx moves to the next.
Failover without a retry
Transient upstream failures move to the next candidate in the chain automatically — no retry logic in your code.
Drop-in compatible
Point the OpenAI SDK at our base URL. No new client, no rewritten call sites.
Request metering
Every request records tokens, latency, status and the public model alias for your usage dashboard.
Scoped API keys
Restrict each key to specific endpoints and model aliases, then pause or revoke it immediately.
Auditable failover
Each upstream attempt is recorded privately so operators can diagnose retries without exposing routing details.
One gateway. Two protocol contracts.
Claude Code speaks Anthropic Messages. Codex speaks OpenAI Responses. Pick the lane you use and copy the configuration exactly — especially the base URL.
Claude Code appends the Messages path. Stop the configured URL at /api.
Codex uses the Responses wire API. Its configured base ends at /api/v1.
- 01
Create a NovaRouter API key
In the dashboard, open API Keys, issue a key with the
chat.completionsscope, and copy it once. Claude Code reaches/api/v1/messages, but NovaRouter intentionally authorizes that surface with the same chat scope. - 02
Choose where the configuration lives
All projectsmacOS: ~/.claude/settings.json
Windows: %USERPROFILE%\.claude\settings.jsonOne project.claude/settings.local.jsonKeep it gitignored. Never put a key in the committed
.claude/settings.json.settings.json{ "env": { "ANTHROPIC_BASE_URL": "https://nova-router-main.vercel.app/api", "ANTHROPIC_AUTH_TOKEN": "nr_sk_your_key", "ANTHROPIC_MODEL": "claude-sonnet-5", "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5", "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "fable-5" } }Why AUTH_TOKEN? NovaRouter acceptsAuthorization: Bearer nr_sk_…. Claude Code sendsANTHROPIC_AUTH_TOKENin exactly that header.ANTHROPIC_API_KEYusesx-api-key; NovaRouter accepts it too, but bearer avoids Claude Code's one-time custom-key approval prompt. - 03
Try it on macOS before saving it
Open Terminal. These exports last only for this window, which makes them the safest first test.
macOS · zshexport ANTHROPIC_BASE_URL="https://nova-router-main.vercel.app/api" export ANTHROPIC_AUTH_TOKEN="nr_sk_your_key" export ANTHROPIC_MODEL="claude-sonnet-5" claudeAfter it works, use the settings file above rather than putting the key in
~/.zshrc. Settings also reach Claude Code background agents reliably. - 04
Try it on Windows before saving it
Open PowerShell. The variables last for this PowerShell window and every process started from it.
Windows · PowerShell$env:ANTHROPIC_BASE_URL = "https://nova-router-main.vercel.app/api" $env:ANTHROPIC_AUTH_TOKEN = "nr_sk_your_key" $env:ANTHROPIC_MODEL = "claude-sonnet-5" claudeFor persistence, use
%USERPROFILE%\.claude\settings.json. It works for PowerShell, Command Prompt, VS Code terminals, and background agents without maintaining four separate environment setups. - 05
Verify the route, then verify Claude Code
Test NovaRouter directly first. A JSON response beginning with
msg_proves the URL and token are correct.Direct Messages testcurl -X POST "https://nova-router-main.vercel.app/api/v1/messages" \ -H "Authorization: Bearer $NOVAROUTER_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-5","max_tokens":8,"messages":[{"role":"user","content":"Say OK"}]}'Start
claude, send a message, then run/status. The Status tab must show:- Anthropic base URL: https://nova-router-main.vercel.app/api
- Auth token: ANTHROPIC_AUTH_TOKEN
Do not configure /api/v1 here. Claude Code appends/v1/messages. If you setANTHROPIC_BASE_URLtohttps://nova-router-main.vercel.app/api/v1, it requests/api/v1/v1/messagesand gets 404.
Fix the symptom, not the config twice
The error tells you which layer failed.
Docs written by the people who run the gateway
Copy-pasteable examples and honest caveats. Every endpoint listed below has a route handler behind it.
Quickstart
Point the OpenAI SDK at the NovaRouter base URL, set your key, and send a request. Nothing else changes.
Claude Code and Codex
Configuration files, exact base URLs and macOS and Windows setup for both agent CLIs — written out above on this page.
Scoped keys
Issue `nr_sk_…` keys per environment and restrict any of them to specific models. Up to 25 live keys per account.
Streaming
Server-sent events on every model, with failover before the first byte so a dead upstream costs latency rather than the request.
Ordered fallback
Each alias declares its own chain across five providers. A rate limit or 5xx moves to the next candidate with no retry in your code.
Usage and rollups
Every request is logged with tokens, latency and status — queryable per key or per model. Metering, not billing.
API reference
v1- POST/api/v1/chat/completionsOpenAI-compatible chat
- POST/api/v1/messagesAnthropic Messages — Claude Code
- POST/api/v1/responsesOpenAI Responses — Codex
- POST/api/v1/embeddingsNo capacity — answers 503
- GET/api/v1/modelsLive catalogue and capabilities
- GET/api/v1/providersPublishers behind the catalogue
- POST/api/v1/keysIssue an nr_sk_ key
- GET/api/v1/usagePer-request history
- GET/api/v1/logsEvents recorded against your account
- GET/api/v1/statisticsDaily and monthly rollups
Setting up a CLI?
Claude Code and Codex each need a different base URL. Both are written out, with macOS and Windows steps.
Configure a CLI