Browse documentation

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.

There are two ways to ask for a model: name a specific model 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_fallbacks in 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 sets the preference:

  • Best for the task (default) uses smart model selection when available.
  • Lowest cost picks by the lowest estimated request cost within the active cost band (low under $1, mid $1 to under $7 by default, or high $7+ per million tokens on the (3 * input + 1 * output) / 4 blended list rate read live from the catalogue). Pass nrouter_cost_band ("low", "mid", "high") per call; an empty band returns 400 cost_band_unsatisfiable.

Your code stays the same. Turn off Smart model selection under Settings → Privacy to keep prompts off the decision model: Lowest cost serves the Default Pick, while Best for the task may return 400.

4. Check what answered

  • x-nr-model names the catalogue model that served the request.
  • x-nr-routing is direct or fallback:<n> (0-based chain index).

You pay the served model's list price (x-nr-request-cost). For dedicated tenancy, see nRouter Enterprise.

Frequently asked questions

Can I combine nrouter/auto with nrouter_fallbacks?

Yes. On nrouter/auto, nrouter_fallbacks replaces the fallbacks nrouter/auto would choose: its pick runs first, then yours ([] means none). Unroutable targets return 400 fallback_not_allowed.

What happened to the withdrawn Smart Routers?

Withdrawn on 2026-10-15; former aliases return unknown-model. Use a catalogue model or nrouter/auto. Saved fallbacks still work.

Does Lowest cost mean the lowest bill?

No. It estimates spend within nrouter_cost_band before output tokens are generated; billing uses actual usage at the served model's list price.

Was this page helpful?