LLM Routing for Enterprise AI Agents: When a Cheaper Model Call Is a Cheaper Task
Routing 60% of agent tasks to a model at a fifth of the price looks like a 48% saving. Counted per finished task, it saves 30.5% when 95% of the cheap model's failures are caught and costs 12.7% more when half are. A cost model, Python code and an enterprise checklist.

Why the price list overstates routing savings
Enterprises stopped buying one model some time ago. In Andreessen Horowitz's survey of 100 CIOs across 15 industries, 37% were using five or more models by May 2025, up from 29% a year earlier. Once several models sit behind the same agent, teams start asking why every request goes to the most expensive one.
LLM routing is the most common answer. A router looks at each request and sends it to a cheaper model or a stronger one. The research case is strong. FrugalGPT, from Stanford in 2023, chained models in a cascade and matched GPT-4 with up to 98% lower cost on the authors' benchmarks. RouteLLM, from UC Berkeley, Anyscale and Canva, trained routers on human preference data and cut costs by more than half without a drop in response quality. The Hybrid LLM paper, presented at ICLR 2024, made up to 40% fewer calls to the large model with no loss in quality. The tooling has caught up too: NVIDIA open-sourced its NeMo Switchyard routing library on August 11, 2026, and OpenRouter now offers it as a hosted router next to its own Auto Router.
The arithmetic most teams do first is a price-list calculation. Send 60% of requests to a model that costs a fifth as much, and the bill drops 48%. That number counts calls. A business pays for finished tasks: the ticket resolved, the reconciliation closed, the pull request merged. Switchyard's own documentation makes the same warning in plain terms: a cheaper model call does not guarantee a cheaper completed task.
This piece gives a proposed model of cost per finished task under routing, the Python to run it, and the results. With illustrative but realistic settings, the same 60% routing share saves 30.5% when 95% of the cheap model's failures are caught, and costs 12.7% more than not routing at all when only half are caught. Whether the saving appears depends most on how many of the cheap model's failures your checks catch. After the model comes what it means for agentic data science, ML and analytics, with code for measuring how good your checks are, and then three things that rarely appear in routing discussions: what model switches do to prompt caches, why a router tuned on someone else's work can misroute yours, and what an enterprise has to govern once requests can land on several providers.
The cost of a finished task
Measure everything in one unit: the cost of a task done start to finish by the strong model. That makes the model independent of any price list. Six lines define the seven quantities that describe a routed workload:
- r: the cheap model's cost per task as a share of the strong model's (0.20 here)
- e_c and e_s: the share of tasks each model gets wrong (e_s = 5% here; e_c is varied below)
- d: the share of wrong answers your checks catch before they ship
- L: the cost of a wrong answer that ships, in strong-task units (20 here: rework, review, an incident)
- k: the router's own cost per task, such as a classifier call (0.02 here)
- f: the share of tasks the router sends to the cheap model (60% here)
Without routing, every task goes to the strong model. A caught failure is redone once, and a missed one ships:
A routed task starts on the cheap model. A caught failure escalates to the strong model, which then costs what any baseline task costs. A missed failure ships:
Routing a task pays only when R < B, which gives the highest failure rate at which a routed task costs less than a strong-only task:
Take a cheap model that fails 15% of the tasks sent to it, with 95% of failures caught. The baseline task costs B = 1.0975. A routed task costs 0.22 for the cheap attempt and the router, 0.156 for escalations and 0.15 for the failures that slip through, R = 0.526 in total. Each routed task is 52.0% cheaper, and with 60% of tasks routed the whole bill falls 30.5%.
Now catch only half the failures. The failures that ship alone cost 0.15 × 0.5 × 20 = 1.5 per routed task, more than the strong model's own price per task (1.0). R rises to 1.834 against a baseline of 1.525, so each routed task costs 20.3% more than it would have on the strong model, and the bill rises 12.7%.
Run it: the model in Python
The code below computes the formulas and checks them with a task-by-task simulation of the same process. It needs only NumPy.
import numpy as np
R, E_S, L, K, F = 0.20, 0.05, 20.0, 0.02, 0.60 # cheap price, strong fail rate, shipped-error cost, router cost, share routed
def baseline_cost(e_s, d, L):
# strong model on every task; a caught failure is redone once, a missed one ships
return 1.0 + e_s * d + e_s * (1 - d) * L
def routed_cost(r, e_c, e_s, d, L, k):
# cheap model first; a caught failure escalates and then costs what a baseline task costs
return r + k + e_c * d * baseline_cost(e_s, d, L) + e_c * (1 - d) * L
def savings_share(f, r, e_c, e_s, d, L, k):
b = baseline_cost(e_s, d, L)
return 1 - (f * routed_cost(r, e_c, e_s, d, L, k) + (1 - f) * (b + k)) / b
def breakeven_failure_rate(r, e_s, d, L, k):
b = baseline_cost(e_s, d, L)
return (b - r - k) / (d * b + (1 - d) * L)
def simulate(n, f, r, e_c, e_s, d, L, k, seed=7):
# task-by-task Monte Carlo of the same process, as a check on the algebra
rng = np.random.default_rng(seed)
def strong_path(m):
fail, caught = rng.random(m) < e_s, rng.random(m) < d
return 1.0 + (fail & caught) * 1.0 + (fail & ~caught) * L
routed = rng.random(n) < f
cost = np.full(n, k)
cost[~routed] += strong_path((~routed).sum())
m = routed.sum()
fail, caught = rng.random(m) < e_c, rng.random(m) < d
routed_cost_each = r + (fail & ~caught) * L
escalated = fail & caught
routed_cost_each[escalated] += strong_path(escalated.sum())
cost[routed] += routed_cost_each
base = strong_path(n)
return 1 - cost.mean() / base.mean()
if __name__ == "__main__":
for d in (0.50, 0.80, 0.95, 0.99):
print(f"caught {d:.0%}: break-even cheap failure rate {breakeven_failure_rate(R, E_S, d, L, K):.1%}")
for e_c in (0.05, 0.10, 0.15, 0.20, 0.30):
row = [savings_share(F, R, e_c, E_S, d, L, K) for d in (0.50, 0.80, 0.95, 0.99)]
print(f"cheap fails {e_c:.0%}: " + " ".join(f"{v:6.1%}" for v in row))
print(f"simulated, 400,000 tasks: {simulate(400_000, F, R, 0.15, E_S, 0.95, L, K):.1%} "
f"vs formula {savings_share(F, R, 0.15, E_S, 0.95, L, K):.1%}")
The simulation of 400,000 tasks lands at 30.2% against the formula's 30.5%, which is sampling noise. The router cost k is charged on every task, routed or not, because the router has to look at every request to decide. Escalated tasks go through the full strong-model path, including its own chance of failing, which is why B appears inside R.
Detection decides the result
Here is the share of the strong-only bill saved, with 60% of tasks routed, across cheap-model failure rates and catch rates:
| Cheap model fails | 50% caught | 80% caught | 95% caught | 99% caught |
|---|---|---|---|---|
| 5% | 29.6% | 36.6% | 41.7% | 43.2% |
| 10% | 8.5% | 24.6% | 36.1% | 39.7% |
| 15% | −12.7% | 12.5% | 30.5% | 36.2% |
| 20% | −33.9% | 0.4% | 24.9% | 32.6% |
| 30% | −76.2% | −23.8% | 13.7% | 25.6% |
At a 15% cheap-model failure rate, raising the catch rate from 50% to 95% moves the result by 43 points of the bill. The cheap model's failure rate matters about as much: at 80% caught, a cheap model that fails 5% of routed tasks saves 36.6% and one that fails 20% saves 0.4%. Choosing which tasks to route, so that the failure rate stays low, is the router's job. Catching what it still gets wrong is yours, and it counts as much. The break-even failure rates say the same thing: a cheap model can fail up to 12.1% of routed tasks when half its failures are caught, 20.4% at 80%, 43.0% at 95% and 67.2% at 99%. Good detection more than triples how wrong the cheap model is allowed to be.
The cost of a shipped error matters nearly as much. With the cheap model failing 15% and 80% caught, the saving is 39.3% when a shipped error costs nothing extra (L = 0), 24.7% at L = 10, 12.5% at L = 20 and −14.7% at L = 50. Work where a mistake is caught downstream for free tolerates aggressive routing. Work where a mistake reaches a customer or a ledger needs a high catch rate before routing.
That points to where routing earns its keep: tasks whose output can be checked by something other than the model that produced it. Code with a test suite, extraction with a schema and totals that must reconcile, classification with a labeled spot-check sample, SQL that must return the expected row count. It points away from open-ended drafting or advice that nobody reviews. A model grading its own answer is a weak check; the same compounding logic is worked through for multi-step agents in Why a 95%-Accurate AI Agent Fails Most 20-Step Tasks, along with what a step verifier buys.
What this means for agentic data science, ML and analytics
Data work is the best case for routing, because so much of it can be checked by something other than the model that produced it. SQL has to return the expected rows, with totals that reconcile to the source. Feature code has to pass data-validation tests. A model has to beat a holdout set or a backtest. An estimator has to recover a known answer on simulated data. Each of those is a check with a high catch rate, the right-hand side of the table above.
Other steps in the same workflow have no such check: choosing the method, deciding what a result means, and writing the recommendation a stakeholder will act on. Those belong on the left-hand side of the table, where a missed error is expensive and hard to see. The practical rule is to route the steps a test can grade, and to keep the steps only a person can grade on the strong model, with a person reviewing them.
The catch rate is something you can measure before you route anything. Plant known faults in a correct output, run your checks and count how many they flag. Here is a vendor-neutral example for a common task, an agent-written revenue rollup by region, checked against the order detail it came from. It needs pandas and NumPy.
import numpy as np
import pandas as pd
def check_rollup(detail, rollup, tol=0.005):
"""Checks an agent-written revenue rollup by region before anyone sees it.
Returns the list of problems found; an empty list means it passed."""
problems = []
if set(rollup["region"]) != set(detail["region"]):
problems.append("regions differ from the source")
if rollup["region"].duplicated().any():
problems.append("a region appears twice")
if rollup["revenue"].isna().any() or (rollup["revenue"] < 0).any():
problems.append("missing or negative revenue")
total, expected = rollup["revenue"].sum(), detail["revenue"].sum()
if abs(total - expected) > tol * expected:
problems.append("total does not reconcile to the source")
return problems
# Seeded faults: mistakes a cheap model plausibly makes when writing this query.
def drop_region(r, rng):
return r.drop(index=rng.integers(len(r))).reset_index(drop=True)
def join_fanout(r, rng): # a bad join duplicates part of the revenue
r = r.copy(); i = rng.integers(len(r)); r.loc[i, "revenue"] *= 2; return r
def wrong_date_filter(r, rng): # a filter drops about a tenth of the rows
return r.assign(revenue=r["revenue"] * 0.9)
def sign_error(r, rng):
r = r.copy(); i = rng.integers(len(r)); r.loc[i, "revenue"] *= -1; return r
def unit_error(r, rng): # one region reported in thousands
r = r.copy(); i = rng.integers(len(r)); r.loc[i, "revenue"] /= 1000; return r
def swapped_regions(r, rng): # revenue attributed to the wrong regions
r = r.copy(); i, j = rng.choice(len(r), 2, replace=False)
r.loc[[i, j], "revenue"] = r.loc[[j, i], "revenue"].to_numpy(); return r
FAULTS = [drop_region, join_fanout, wrong_date_filter, sign_error, unit_error, swapped_regions]
if __name__ == "__main__":
rng = np.random.default_rng(11)
regions = ["Central", "East", "North", "South", "West"]
detail = pd.DataFrame({"region": rng.choice(regions, 5_000),
"revenue": rng.gamma(2.0, 150.0, 5_000).round(2)})
good = detail.groupby("region", as_index=False)["revenue"].sum()
assert check_rollup(detail, good) == [] # the correct answer passes
caught = {f.__name__: 0 for f in FAULTS}
trials = 2_000
for f in FAULTS:
for _ in range(trials):
caught[f.__name__] += bool(check_rollup(detail, f(good, rng)))
for name, n in caught.items():
print(f"{name:18s} caught {n / trials:.0%}")
rate = sum(caught.values()) / (trials * len(FAULTS))
print(f"catch rate with each fault equally likely: {rate:.1%}")
The four checks catch every dropped region, double-counted join, bad date filter, sign error and unit error. They catch none of the swapped regions, because a swap leaves every region present and every total intact. With the six faults equally likely, the suite catches 83.3% of them. In the cost model that puts the break-even failure rate at 22.8%: a cheap model that gets 15% of these rollups wrong still saves 16.1% of the bill, and one that gets 10% wrong saves 26.9%.
The fault that slips through is also the one a stakeholder would act on, because it moves revenue, and then budget, from one region to another. Closing that gap takes a different kind of check, such as a second, independently written query for a sample of regions, or an alert when a region's share moves more than usual from the last period. Seeding faults tells you which mistakes your checks cannot see, and that is the information you need before deciding what to route.
Machine learning has its own version of the blind spot. A holdout or backtest gate catches a model that got worse, but a model with target leakage passes it with a better score than an honest one. Leakage needs its own test, such as confirming that every feature was available at prediction time. For causal estimates the strongest gate is a simulation where the true effect is known, the approach used to grade mix models in Marketing Mix Modeling You Can Check.
Prompt caches do not follow the request
Long-running agents carry long contexts, and providers cache them. When the next turn starts with the same tokens as the last one, the provider reuses the work it already did on that prefix and charges a fraction of the input price. Anthropic, and OpenAI for GPT-5.6 and later, price a cache write at 1.25 times the base input price for the default cache lifetime and a cache read at 0.1 times, with some newer models discounting reads further.
A cache holds one model's computed state for that exact prefix. OpenAI's documentation says a cache hit needs the entire rendered prefix to match and notes that a different model can use different weights and caching behavior. Move a conversation to another model and the first turn there starts cold: the whole context is written to a new cache at the write price.
Take an agent 120,000 tokens into a task, where each turn adds 2,000 input tokens and produces 1,000 output tokens. Count costs in units of the strong model's input price per token, with output at five times the input price (the ratio on Anthropic's current list) and new tokens written to the cache at 1.25 times. A warm turn on the strong model costs 19,500 units. Switch to a model at half the price and the first turn there costs 78,750 units, 4.04 times the warm strong turn. Each later turn costs 9,750, so the switch is repaid only after 6.1 more turns. Switch instead to a model at a fifth of the price and the first turn costs 31,500 units (1.62 times), repaid in 0.8 turns. At a fortieth of the price, roughly the gap between one provider's current frontier and smallest models, the cheap model is cheaper from the first turn, cold cache included.
Three rules follow. Route at the start of a task, when the context is short. When you do switch mid-run, switch to a much cheaper model, not a slightly cheaper one. And keep a session on one model once its context is long, unless there is a reason to move. The tools already lean this way: OpenRouter keeps follow-up requests on the same provider while its prompt cache is warm, and Switchyard's classifier router keeps a session on one model across turns, though its default stage router decides afresh on every request. One more trap sits in the cache lifetime. The default is five minutes on Anthropic and 30 minutes on OpenAI's newer models, so an agent that waits on a long test run or a human approval can lose its cache without any switch at all.
A router tuned on someone else's work
Every router encodes a view of what makes a request hard, and that view comes from somebody's workload. Switchyard's stage router reads the agent's recent tool results: errors, file reads, edits, test outcomes. Its documentation says the built-in vocabulary is calibrated for coding agents, and its Auto preset sends a turn with no tool activity to the efficient model. For a coding agent that is a sensible default. For a drafting or analysis agent, whose hardest turns may involve no tool calls at all, it sends the hard work to the cheap model.
OpenRouter's Auto Router takes a different view. It classifies each prompt into roughly 30 task types and ranks models by what the market has spent on that type over the trailing seven days. That is a reasonable signal of what people find useful. It does not measure your quality bar.
Neither is a flaw. They are defaults built for a particular workload, and the vendors say so. The practical consequence is that a router's published results describe the workload it was measured on. NVIDIA reports, for example, that LangChain's evaluation of Switchyard's escalation router on 145 multi-turn agentic tasks cut cost 74% while sending 7% of calls to the frontier model, at a cost of about six points of accuracy. Whether six points is acceptable is a business decision about your tasks. The only result that answers it is a run on your own task set, routed against a single-model baseline, scored as cost per completed task.
What enterprises have to govern
Routing turns one model decision into thousands of small ones a day, made by software. Four controls keep that auditable.
An approved-model list, enforced in configuration. Every model a router can choose is a model the organization has reviewed for quality, licensing and data handling. Routers that map a semantic name ("capable", "efficient") to a provider and model ID make this easy to pin and to change in one place.
Explicit data controls, because defaults favor availability. On OpenRouter, provider routing allows providers that may store and train on request data unless you set data collection to deny, can restrict routing to zero-data-retention endpoints only when asked, and permits fallback to backup providers by default. Each of those is a sensible default for a developer and a question for a privacy review. Every provider a request can land on is another processor of your data, so the router's settings belong in the same review as the vendor contracts.
A per-request log of which model answered and why. Switchyard's server logs the selected model, the routing rationale, token usage, latency and outcome. Whatever router you use, that record is what lets you answer "which model wrote this?" after an incident, and it is the data you need to measure the catch rate and the failure rate the model above depends on.
Full cost attribution. Router overhead is real money: OpenRouter bills Switchyard's judge calls as separate generations on the judge model. Report cost per completed task, including the router, the escalations and the rework, next to the single-model baseline. Rerun that comparison every time a model in the pool changes version, because a new release moves e_c, and the break-even moves with it.
Where it breaks
This is a proposed model with illustrative parameters, not a measurement of any product. Four simplifications matter.
The cheap model's failure rate is not a constant. A good router sends the cheap model the tasks it is likely to get right, so e_c on routed tasks is lower than on random tasks, and that selection is most of what a router is for. The model takes e_c as given; measuring it on routed traffic is the job.
Detection is not free. Deterministic checks such as tests and schema validation cost little, but an LLM judge costs a call per check and belongs in k. Checks also flag good answers; each false alarm is an escalation the model does not count. The model allows one retry, while real escalations sometimes take more, and it charges a redone baseline task at 1.0 but an escalation at the full B, a difference of about 0.002 here.
L is the hardest number to know and the one the result is most sensitive to. Incident and rework history is the best source. Without it, run the table at several values, as above, and route only where the answer holds across them.
The cache figures use list multipliers. Models with deeper read discounts (0.05 or 0.025 times input) make a warm cache more valuable and a switch costlier than shown. The vendor results quoted here are vendors' own evaluations.
What to measure before you route
Before routing a task type, measure four things on a few hundred of your own tasks: the cheap model's failure rate on them, the share of seeded bad outputs your checks catch, the rework cost of a shipped error, and the router's overhead. Put them into the break-even formula. Route the task types that clear it with margin, and leave the rest on the strong model.
Then run the routed setup against a single-model baseline and report cost per completed task, not cost per call. Keep long sessions on one model, set data controls explicitly, log the model behind every response, and repeat the comparison whenever a model in the pool changes. For the per-call side of the economics, the LLM inference cost calculator compares self-hosted GPUs with API pricing, and the agent reliability calculator shows what a verifier does to cost per correct task. Related work is collected in the Agentic AI research area.
Sources
- Andreessen Horowitz, How 100 Enterprise CIOs Are Building and Buying Gen AI in 2025, June 2025
- Chen, Zaharia and Zou, FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance, 2023
- Ong, Almahairi, Wu, Chiang, Wu, Gonzalez, Kadous and Stoica, RouteLLM: Learning to Route LLMs with Preference Data, 2024
- Ding, Mallick, Wang, Sim, Mukherjee, Ruhle, Lakshmanan and Awadallah, Hybrid LLM: Cost-Efficient and Quality-Aware Query Routing, ICLR 2024
- NVIDIA, Route AI Agent Workloads Across Models with NVIDIA NeMo Switchyard, August 2026
- NVIDIA, NeMo Switchyard repository and documentation, including the stage router and routing overview pages
- OpenRouter, Switchyard router, Auto Router and provider routing documentation
- OpenAI, Prompt caching documentation
- Anthropic, Prompt caching and pricing documentation


