LLM Routing Explained: How AI Model Routing Cuts Costs

Sending every request to the most capable model is the most expensive way to run an LLM product, and it is what almost everyone does by default. LLM routing is the layer that reads each request and picks the cheapest model that can still answer it well. This is the complete guide to how AI model routing works, the five architectures teams actually deploy, the one mistake that quietly makes routing worse than no routing at all, and how to add it in two lines of code.

Published 2026-07-14 by Dor Amir on the Nadir blog.

Filed under Routing & Cascades.

The most expensive default in AI

The default behavior of every LLM SDK is to send every request to one model, the one you hard-coded, and for most teams that is the best and most expensive model available. It is the single most expensive way to run an LLM product, and it is what almost everyone does, because doing anything else requires a decision layer that the SDK does not ship.

That layer is LLM routing. This guide covers what it is, the architectures teams actually deploy, the one mistake that makes routing worse than not routing, and how to add it without rewriting your app.

What is LLM routing?

LLM routing is a decision layer that sits in front of multiple language models and, for each request, sends it to the cheapest model that can handle it well. AI model routing and LLM routing are the same idea under two names: instead of one model answering everything, an easy request goes to a small fast model and a hard request goes to a frontier model. You pay frontier prices only when the task actually needs them.

The economic case is simple and well measured. Meta's RouteLLM research found 74% of GPT-4-class calls did not need a GPT-4-class model to reach the same answer. If three of every four hard-model calls could have gone to a cheaper model at equal quality, then routing that traffic correctly is not a marginal optimization, it is most of the bill.

Why one model for everything is expensive

A production LLM workload is a mix. Some requests are classification, formatting, extraction, or short factual answers that a small model handles perfectly. Some are genuinely hard reasoning that needs the frontier. Sending the whole mix to the frontier model means the easy majority subsidizes nothing and simply costs more. Sending the whole mix to a cheap model saves money right up until the hard tail returns wrong answers and the quality complaints start.

The blanket swap is the trap. We tried replacing a frontier model with one a tenth the price across all traffic: it matched on 70% of prompts and broke badly on the hardest 30%, which is precisely the traffic a router is supposed to protect. Routing exists because neither extreme is right. The correct model is a per-request decision, not a per-app setting.

The five routing architectures

Teams deploy five patterns, often in combination:

Most mature systems combine predictive classification with a cascade verifier: predict the tier, but confirm the cheap answer before trusting it.

How a verified router actually decides

The strongest routers add one component that separates them from the rest: a verifier. The flow is:

  1. The router classifies the request and sends it to the cheapest model in the eligible tier.
  2. That model returns an answer.
  3. A calibrated verifier scores the answer against the request.
  4. If the score clears a threshold, the answer ships. If not, the request escalates to a stronger model and the process repeats.

The reason this matters is that the router is now judged on the answer it actually produced, not on a guess it made before seeing one. That is the whole game. A router without step three is dead reckoning: it commits to a model based on a prediction, and when the prediction is wrong it has no way to know, so it ships the bad answer. Verification is what lets a router cut cost aggressively without cutting quality, because the only requests that get downgraded are the ones whose downgraded answer was checked and accepted.

A reference-assisted RouterBench research experiment on 11,420 triples projected 60% lower cost at about 98% retained quality. Because the verifier had the expensive reference answer unavailable in production, this is a research ceiling, not a deployed guarantee. Live quality requires outcome-labelled workload evidence.

Routing versus the alternatives

Routing is not the only way to cut LLM cost, but it is the one with the best ratio of savings to maintenance:

If you want the full stack that routing sits inside, see the companion guide on how to reduce LLM API costs.

The other axis: what you send, not just who answers

Routing decides which model answers. Context selection decides what reaches it. They are separate levers on the same request, they multiply rather than overlap, and a router is the natural place to run both, because both are decisions made before a single output token exists.

Selection is query-conditioned pruning of retrieved context and tool output:

  1. The latest user message is the query. It is never pruned, and neither is the system prompt.
  2. Only large blocks are eligible. Retrieved context and tool output above roughly 800 characters. Parseable JSON is skipped so tool results stay loadable.
  3. Each block splits into chunks at natural boundaries. Kept chunks survive byte for byte, nothing is rewritten or summarized.
  4. Chunks are embedded and scored against the query. The encoder decides everything here: a lexical word-overlap scorer failed our quality gate at a 12.1% regression rate, and a semantic embedding model dropped that to 1.4%.
  5. The top fraction survives, then the guards run. Lead and tail chunks always stay, safety and policy language is never dropped, and any chunk carrying a rare term from the question is pinned. That guard is why the answer paragraph survives even at tight budgets.
  6. Dropped runs collapse into one marker line, so the model can see that something was omitted rather than silently missing it.

Measured on HotpotQA at a keep ratio of 0.6, every answer graded blind by an independent judge against the known-correct answer:

HotpotQA gate, keep 0.6~4K context~12K context
Input tokens removed31.8%34.1%
Answer paragraphs kept100%100%
Accuracy, full context97.2%94.8%
Accuracy, selected96.0%95.9%

The routing-specific detail worth knowing: each block is scored against the question that follows it, not the newest one, so the decision is a pure function of the block and its own query and reproduces byte for byte as a conversation grows. That is what keeps a provider prompt cache hitting turn after turn, which matters more in a routed setup than an unrouted one, since a router that reshuffles the prefix on every turn quietly cancels the caching lever it is supposed to compose with.

The interactive walkthrough is on the context optimization page, the full method and its failure cases are in the benchmark writeup, and the algorithm is open source as barber-llm.

The one mistake: routing without verification

The failure mode worth naming twice is routing that never checks its own work. It is seductive because it is simple to build and it looks like it works: on easy traffic the cheap model is fine, the numbers drop, everyone is happy. Then a hard request gets misclassified as easy, the cheap model returns a confident wrong answer, and it ships, because there was no verifier to catch it. Unverified routing does not fail loudly. It fails as a slow quality regression that is hard to attribute back to the router. If you build or buy routing, the verifier is not optional.

How to add routing without a rewrite

The lowest-friction way to deploy routing is a gateway that speaks the OpenAI API format. You change the base URL, set the model to auto, and route per request without touching your call sites:

import openai

client = openai.OpenAI(
    base_url="https://api.getnadir.com/v1",
    api_key="ndr_...",
)

response = client.chat.completions.create(
    model="auto",  # router picks the cheapest capable model per request
    messages=[{"role": "user", "content": prompt}],
)

The request and response shapes are unchanged, so there is no SDK migration. Nadir reads the prompt, routes to the cheapest capable model, verifies the answer before returning it, and reports the measured savings against always-Opus per request. Bring your own provider keys and the router sits in front of them.

If you already run a gateway you like (LiteLLM, Kong, Envoy, Portkey), or your agent framework owns the provider call, you do not have to move the traffic at all. Nadir's decision API returns the routing decision on its own: POST /v1/bucket classifies the prompt, POST /v1/recommend returns the model pick against your own model list, in about 100 ms, and no prompt ever transits a model provider through Nadir. Your gateway keeps carrying the traffic. Nadir only answers which model the task deserves.

Conclusion

LLM routing is the layer the SDKs left out. It turns model choice from a per-app default into a per-request decision. A complete-response verifier can add evidence after generation, but it is not a universal quality guarantee: streaming bypasses that step, and customer quality still requires outcome-labelled traffic. The older 60% cost / 98% quality RouterBench result is a reference-assisted research ceiling, not deployed performance.

Related reading


The 60% / ~98% figure is a reference-assisted research ceiling on 11,420 RouterBench triples against an always-top-model baseline. It is not deployed performance or a customer forecast.


More on routing & cascades

What Nadir is

Nadir is an LLM router. Nadir sizes every prompt and routes it to the cheapest model that still clears your quality bar. A small decision model reads each prompt against your model menu and picks the lowest-cost model it expects to handle it. When the decision model is uncertain or unavailable, the request goes to the strongest model on the menu. The routing step makes no call to your model provider.

Nadir runs two ways. The decision API returns a model, reasoning-effort, cache, context, and policy recommendation without calling a model provider, beside the gateway you already run. That is how a shadow-mode evaluation works, and its projected savings stay advisory. The OpenAI compatible managed proxy executes the route, and migration is a two-line change: point the base URL at api.getnadir.com and set model to auto. On that path an optional verifier can score a complete non-streaming answer and escalate to a stronger model when it misses the configured bar. Streaming bypasses post-generation verification. BYOK is supported on every tier.

For coding agents, Nadir Auto is a terminal launcher for Claude Code or Codex that asks Nadir for the main-session model before each turn, with your configured model as the fallback and cost ceiling. Delegation integrations for Claude Code, Codex, or Cursor instead recommend a model tier for subagent work, and the agent decides. Either way inference runs on your own provider account, so Nadir holds no provider keys on that path.

What the numbers are, and what they are not

Nadir publishes each evaluation with its scope. On checkable code, run-check-escalate solved 392 of 395 common HumanEval and MBPP problems (99.2%), graded by running the canonical tests; that applies only to tasks with runnable deterministic tests. Nadir-Tumbler posts an arena_score of 72.3 on RouterArena's public scorer, 5th of 23 routers, which measures the routing decision on RouterArena's own model pool. A reference-assisted RouterBench evaluation over 11,420 held-out triples produced a 60% lower projected cost than always-Opus with about 98% retained quality and a 1.7% catastrophic-route rate. That experiment gave the verifier the expensive-model reference answer, which production does not have, so it is a research ceiling and not the deployed path.

None of these is a production guarantee, a universal savings rate, or a forecast for any particular workload. Customer savings are reported from measured execution against a declared baseline, and customer quality only from outcome-labelled traffic. Projected savings and realized savings are separate artifacts and are never blended.

Design-partner program

Three rungs, picked by risk appetite. Rung 0 Shadow runs advisory decision calls alongside live traffic and returns a projected receipt, with nothing in the request path changed. Rung 1 Hosted is the two-line swap on a production slice and returns a realized receipt. Rung 2 On-prem is a supervised six-week proof of concept inside the partner's VPC, where no prompt, response, or usage reaches Nadir. The commitments are the same at every rung. Apply for a rung directly: Rung 0 Shadow, Rung 1 Hosted, or Rung 2 On-prem. Not sure which fits? Start at getnadir.com/contact/?reason=design-partner.

Licensing

NadirClaw is the self-hosted core, source-available under the PolyForm Noncommercial License. Source-available is the correct label; NadirClaw is not open source. Nadir Route's hosted plan has no base fee and charges a variable fee only on measured savings from requests Nadir executed.

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.