Set up routing: Direct models and nrouter/auto
Set up routing in five minutes. Name a model and add your own fallbacks, or send nrouter/auto and let nRouter choose, then read which model answered.
Last updated
There are two ways to ask for a model. Name one in model and nRouter calls that model, or send nrouter/auto and nRouter chooses an eligible model for each request.
This page is the five-minute setup. Every setting is explained in Router Settings.
1. Call a model directly
curl -i https://api.nrouter.ai/v1/chat/completions \
-H "Authorization: Bearer $NROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"messages": [{ "role": "user", "content": "Summarize this incident report." }]
}'Read x-nr-model on the response. nRouter never swaps a model you name for another.
2. Give it a fallback
A fallback answers only when the provider cannot take the request. Set one of two ways:
- Saved: in Router Settings → Direct tab, add up to 4 fallback models for the model you name, in order.
- Per request: put
nrouter_fallbacksin the body. For that call it replaces the saved list.
{
"model": "gpt-5.4-mini",
"messages": [{ "role": "user", "content": "Summarize this incident report." }],
"nrouter_fallbacks": ["claude-sonnet-4-5", "gemini-2.5-pro"]
}3. Let nRouter choose
Send nrouter/auto as the model:
{
"model": "nrouter/auto",
"messages": [{ "role": "user", "content": "Summarize this incident report." }]
}In Router Settings → nrouter/auto tab, an Owner or Organization Admin picks the preference for the whole organization:
- Best for the task (default) uses smart model selection when it is available.
- Lowest cost orders the models fit for the task by the lowest list rate: input plus output price per million tokens, weighted equally, read live from the catalogue.
Your code does not change when the preference changes. Smart model selection can be turned off under Settings → Privacy; with it off, Lowest cost keeps working and Best for the task may refuse with a 400 that names the setting.
4. Check what answered
x-nr-modelnames the model that served the request.x-nr-routingisdirectwhen the first model answered, orfallback:<n>when the entry at 0-based chain indexndid.
You pay the served model's list price, reported on x-nr-request-cost. Teams that need dedicated tenancy or private deployment can see nRouter Enterprise.
Frequently asked questions
Can I combine nrouter/auto with nrouter_fallbacks?
No. nrouter/auto builds its own fallbacks, so a request that sends both is refused with 400 fallback_not_allowed.
What happened to the withdrawn Smart Routers?
Smart Routers were withdrawn on 2026-10-15. A request that names a former alias returns the unknown-model error. Send a catalogue model name or nrouter/auto instead. Saved fallback lists keep working.
Does Lowest cost mean the lowest bill?
No. It orders models by list rate, with input and output price weighted equally, so it does not know how many tokens your request will read or write. You are billed at the served model's list price.