Smart Routing: Route every request to the right model.

Choose your model and fallbacks. Or use nrouter/auto to select by task fit or list price.

Watch a request find its model.

How routing works. Your model and fallbacks, or nrouter/auto.

Name a model. Only your fallbacks stand in.

Your request goes to the model you chose. Unknown model IDs return 404, never a substitute.

  • Fallbacks come from Router Settings, or nrouter_fallbacks on one call
  • A fallback answers only when the provider cannot take the request
  • You pay the list price of the model that answered
modelclaude-sonnet-4-51stclaude-sonnet-4-5your model2ndgpt-5.4-miniyour fallbackany other modelnever used503

Or let nrouter/auto pick for you.

Best for the task by default, or Lowest cost by live list rate. Set it for your org or for one call.

  • Picks only from the models your org, team and key allow
  • Lowest cost orders fit models by input plus output list rate
  • x-nr-model names the model it chose
Best for the taskLowest costthe same request: "Prove this theorem, step by step."claude-opus-4-5$$$list rateclaude-sonnet-4-5$$list rategpt-5.4-mini$list ratex-nr-model: claude-opus-4-5Best for the task matches the model to the prompt

If a provider fails early, the next answers.

Rate limits, overloads and stalls before the first byte move to your next fallback, within 3 calls.

  • Up to 4 fallbacks, per organization or per request
  • No failover once streaming starts, or on 500, 502 or 504
  • One hold, one charge: tries we fail over from cost you $0
first bytebefore: next fallbackafter: no retriesattempt 1 claude-sonnet-4-5429attempt 2 gpt-5.4-miniattempt 2 of up to 3

Every answer tells you how it got there.

x-nr-model names the model that answered, x-nr-routing the path and x-nr-attempts the tries.

  • x-nr-request-cost and x-nr-cost-status show what it cost
  • x-nr-request-id finds the same request in your dashboard Logs
  • The same headers on direct calls and nrouter/auto
HTTP/1.1 200 OKx-nr-model: gpt-5.4-miniwhich model answeredx-nr-routing: fallback:1how it got therex-nr-attempts: 2how many triesOn every response, so your logs always know.

Your list sets the limits.

Exclude models and new ones join on their own, or pin a list so they wait for you. Choosing with nrouter/auto costs $0.

Fails over before the first byte. Stops once work begins.

Selected errors before the first byte move to your next fallback, and the failed try costs you nothing. Once streaming starts, or on HTTP 500, 502 or 504, routing stops.

$0

added to your bill for attempts we fail over from.

Take a closer look. Every option, in code.

List up to 4 fallbacks in nrouter_fallbacks. Errors such as 429, 503 and first-byte stalls move down the list before streaming starts, within 3 provider calls by default.

curl -X POST https://api.nrouter.ai/v1/chat/completions \
-H "Authorization: Bearer $NROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4-mini",
"nrouter_fallbacks": ["claude-sonnet-4-5", "gemini-2.5-pro"],
"messages": [{ "role": "user", "content": "Summarize this incident report." }]
}'
# Example response headers when the first fallback answers
x-nr-request-id: 7a82c442-99a3-4927-b7e1-c85cb9bb8593
x-nr-model: claude-sonnet-4-5
x-nr-routing: fallback:1
x-nr-attempts: 2
x-nr-request-cost: 0.00342
x-nr-cost-status: exact
x-nr-funding-source: credits
x-nr-latency-ms: 412

Read the docs

Questions? Answers.

How does failover work?

Direct mode uses the customer’s own fallbacks: a stalled call fails over inside the same credit hold before the first byte arrives. Only the answering candidate is billed at published list price, while previous failed attempts cost $0.

What happens when a model provider goes down?

When a model provider experiences an outage, rate limit (429), or overload (503), nRouter routes the request to your next configured fallback model within the same credit hold and bills only the model that answers. Failover happens before the first byte; once a stream has started, a provider failure ends that response rather than switching models mid-stream.

What are the two ways to ask for a model?

Direct: you choose the model. nRouter never swaps it for another; a different model answers only through a fallback you configured yourself (a fallback list for that model in Router Settings, or nrouter_fallbacks on the request), and only when the provider cannot take the request. nrouter/auto: nRouter chooses an eligible model for you. Best for the task (the default) uses smart model selection when it is available; Lowest cost orders the models fit for the task by their list rate. Either way you pay the served model’s list price, and x-nr-model names it.

Which model answered my nrouter/auto request?

The response names it. The x-nr-model response header, the model field in the response body and every streamed frame carry the model that served the request; nrouter/auto appears there only when no provider answered. The response also carries the cost, the token counts and the routing outcome: x-nr-request-cost, x-nr-cost-status, the token headers, x-nr-routing and x-nr-attempts.

When does a fallback happen and when does it not?

The gateway moves to the next model in the chain when the provider is rate limited (429) or overloaded (503 or 529), when it rejects with a 401 or 404, when the connection fails, or when an attempt sends nothing before its first-byte time limit and another model is left to try. It does not fail over on a 500, 502 or 504, or once the response has started, because the provider may already have done the work. A fallback list you save for rate limits only, or for errors only, is used only for that kind of failure.

Am I billed twice when a fallback happens?

No. One request holds credit once and settles once, at the price of the model that answered. You are not billed for attempts that failed over.

Who can change routing settings?

The Owner and Organization Admins. Fallback lists and the nrouter/auto preference are edited in Router Settings and apply to the whole organization, not to a single key or team. Members and viewers can read them but cannot change them.

How do I trace a request?

Start with the x-nr-request-id response header. The same response carries x-nr-model, x-nr-routing (direct, or fallback:<n>), x-nr-attempts, the cost headers and the token counts. In the dashboard Logs, the row for that request id shows the model that served it, the cost, and a routing record with attempts, served_rank, fallback_used and source.

How do I choose between Best for the task and Lowest cost?

Set the nrouter/auto preference for your organization in Router Settings, or send nrouter_optimize: "quality" or "cost" on a single request. Best for the task is the default. Lowest cost orders the models fit for the task by list rate: input price plus output price per million tokens, weighted equally. Either way the request is billed at the served model’s list price.

Can I set fallbacks for a single request?

Yes. Add the body field nrouter_fallbacks: an array of up to 4 distinct model ids that does not repeat the requested model. It replaces your organization’s fallback list for that one call. On nrouter/auto it replaces the fallbacks nrouter/auto would choose: its chosen model is tried first, then yours. A request makes at most 3 provider calls by default, so later entries may not be reached. A target you cannot use returns a 400 with the code fallback_not_allowed. On nrouter/auto, a model your organization, team or key denies returns a 403.

Does every model work on every endpoint?

No. A model is served on the endpoint its provider supports. For example, Claude models are served on the Messages endpoint. The model list shows which endpoints each model serves, and a fallback must serve the endpoint you call.

What happens if the model I name is not served?

A name the catalogue does not publish is refused as an unknown model. A direct request is never silently sent to a model you did not choose: only a fallback you configured can answer instead, and only when the provider cannot take the request.

How is nrouter/auto billed?

At the exact list price of the model that served the request, paid from your credits with zero token markup. For existing subscribers, requests draw from their plan allowance first. The x-nr-funding-source response header indicates the source: allowance or credits.

Do safety checks and guardrails still apply to nrouter/auto?

Yes, with one difference. nrouter/auto always runs the built-in checks on prompts and outputs, and every guardrail your organization configured still applies. The platform’s model-scored moderation and prompt-injection checks run when you name a model directly; they are not added to nrouter/auto requests. To have them on nrouter/auto, add them as your own guardrails.

  1. For attempts we fail over from before the first byte, nRouter absorbs any abandoned upstream attempt charge and settles your request once at the answered model list rate. Upfront credit holds are sized to the highest-rate candidate in the chain and refund the difference at settlement.
  2. The 2,000 ms decision deadline on nrouter/auto is the default selection bound (configurable up to 5,000 ms), not a total completion latency guarantee. If the decision step times out or is unavailable, nRouter selects a model tier using local request signals without failing the call. If your organization turns Smart model selection off in Privacy settings, Lowest cost keeps working, and a Best for the task request may be refused with an error that names the setting, before any credit is held.
  3. Callers can list up to 4 fallback models in Router Settings or per request in nrouter_fallbacks; execution walks up to the default 3-call provider attempt budget. Lowest cost mode orders eligible models by live input plus output list price per million tokens weighted equally, which does not predict total output token count.