Migration Guide
Move to nRouter from OpenRouter or a direct provider integration — change the base URL and the API key; keep your code, and map your model names.
Migrating to nRouter from OpenRouter or direct provider integrations requires updating only your base URL and API key — your application logic, prompts, and tool definitions remain unchanged.
- Minimal disruption: Switch endpoints to
https://api.nrouter.ai/v1with ansk-nrouter-*key without rewriting client integrations. - Pay as you go with 0% platform fee: Consolidate multiple provider accounts into a single credit pool settled at exact upstream list prices.
- Request-level fallbacks: Configure dynamic upstream redundancy directly in payload bodies using
nrouter_fallbacks. - Deep observability: Track serving models, retry attempts, and granular billing via standard
x-nr-*response headers.
What changes
Update connection parameters in existing OpenAI clients:
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.nrouter.ai/v1", api_key=os.environ["NROUTER_API_KEY"])- OpenRouter migration: Map model slugs to nRouter catalog names (or
nrouter/auto). Refer to OpenRouter's documentation. Usenrouter_fallbacksfor ordered model fallbacks. - Direct provider migration: Replace vendor keys with one
sk-nrouter-*key. Prompts, schemas, tools, and streaming SSE transfer unchanged (see Chat Completions). - Post-migration: Track traffic in request logs, configure budget limits, set fallbacks, and inspect
x-nr-model,x-nr-routing, andx-nr-request-costheaders (see Per-Request Options).
Frequently asked questions
Do I have to change my SDK to migrate?
No. Point any OpenAI-compatible client to https://api.nrouter.ai/v1.
Can I migrate one service at a time?
Yes. Virtual keys are independent per service for gradual rollout.
What happens to my fallbacks?
Specify fallback models in the nrouter_fallbacks payload array.
Will the same model answer after I switch?
Yes. Named catalog models are routed directly; confirm via x-nr-model.
Next Steps
- Quick Start — Make your first API call
- Authentication — How API keys and auth work
- Chat Completions — Explore the Chat Completions API
- Per-Request Options — Fallbacks and per-request settings
Was this page helpful?