An LLM router picks which model answers each request. Rule-based gateways vs learned routers like RouteLLM, published savings, and the local-first pattern.
An LLM router is a layer between your app and several models that decides which model handles each request. Gateways such as LiteLLM route by config (cost, latency, fallbacks). Learned routers such as RouteLLM score each prompt and send easy ones to a cheap or local model. RouteLLM cut cost by over 85% on MT Bench at 95% of GPT-4 quality, but savings fall on code and reasoning, and misroutes are the price.
- >85% vs GPT-4-only at 95% quality
- 405k+ inference outcomes, 8 datasets
- Complexity router, beta since v1.94.0
- None; you pay the chosen model's rate
Key takeaways
- "LLM router" means two things: a gateway that picks a deployment from rules (weights, latency, cost, fallbacks) and a learned router that reads the prompt and predicts whether a cheap model is good enough.
- RouteLLM's best routers cut cost versus GPT-4-only by over 85% on MT Bench, 45% on MMLU and 35% on GSM8K while keeping 95% of GPT-4's score. The savings depend on the workload.
- RouterBench found predictive routers match the best single model at similar or lower cost, but none significantly beat its convex-hull baseline, and they underperformed on MBPP coding.
- Local-first routing works: RouteLLM accepts an Ollama model as the weak model, and LiteLLM's complexity router maps SIMPLE to REASONING tiers to any model, local or hosted.
- Practitioners report the costs that benchmarks skip: misroutes on hard multi-file code, broken prompt caches when the model switches mid-session, and harder evals.
An LLM router is the piece of software that decides which model answers a request. Sometimes that decision comes from config: send traffic to the cheapest healthy deployment, fall back to another provider on a 429. Sometimes it comes from the prompt itself: a small classifier guesses whether a cheap model will do as well as a frontier one. The second kind is what people mean when they ask whether a router can send easy prompts to a local model and save money. It can, with published savings of 35% to over 85% depending on the workload, and with failure modes that show up mostly on hard code.
What does an LLM router do?
An LLM router exposes one endpoint to your app and forwards each request to one of several models behind it.
From the app’s side nothing changes: it still calls an OpenAI-style /v1/chat/completions. Behind that endpoint the router makes a per-request choice. The figure shows both kinds of choice in one box, because most production setups end up combining them.
What a router usually handles:
- Model choice per request, by rule or by prediction.
- Fallbacks and retries when a provider errors, rate-limits or times out.
- Cost and spend tracking, since every call passes through one place.
- Protocol translation, so a local model and three vendors look like one API.
Rule-based gateway vs learned router: what’s the difference?
A gateway routes on facts about deployments; a learned router routes on a prediction about the prompt.
LiteLLM’s Router is the standard example of the first kind. Its routing_strategy options are simple-shuffle (the default, weighted), least-busy, usage-based-routing-v2, latency-based-routing and cost-based-routing, plus fallbacks, cooldowns and retries (LiteLLM routing docs). None of these read the prompt. They pick among deployments of the same model group.
RouteLLM is the reference for the second kind. It trains a router on preference data (mostly Chatbot Arena votes) to predict whether a strong model would beat a weak one on a given prompt, then compares that score to a threshold you calibrate. Its routers are mf (matrix factorization, the recommended one), sw_ranking (similarity-weighted Elo), bert and causal_llm classifiers, plus a random baseline (RouteLLM repo).
The line has blurred since. Hosted and gateway products now ship prompt-aware routing too:
| Router | Type | Decides on | Local models? |
|---|---|---|---|
| LiteLLM Router strategies | Rule-based gateway | Weights, in-flight calls, TPM/RPM, latency, cost | Yes, any deployment |
LiteLLM complexity router (auto_router/complexity_router) | Prompt-aware, heuristic by default | Keyword rules, then a 7-dimension heuristic score or an LLM classifier, into SIMPLE / MEDIUM / COMPLEX / REASONING | Yes, any tier can be a local model |
OpenRouter Auto Router (openrouter/auto) | Prompt-aware, hosted | Classifies the prompt into about 30 task types, ranks models by OpenRouter users’ spend share for that task | No, hosted models only |
| RouteLLM | Learned, strong/weak pair | Predicted win rate vs a calibrated threshold | Yes, weak model can be ollama_chat/... |
| Arch-Router-1.5B | Learned, preference policies | Maps the query to a domain and action you define, each tied to a model | Yes, via the Arch proxy |
Sources: LiteLLM auto routing, OpenRouter Auto Router, Arch-Router model card. OpenRouter charges no extra fee for the Auto Router; you pay the selected model’s rate, and allowed_models, excluded_models and cost_tier narrow the pool.
How much do learned routers save?
Published results put savings between roughly a third and six-sevenths of the bill, and the spread is the point: it depends on how many of your prompts are actually easy.
RouteLLM routed between GPT-4 Turbo (strong) and Mixtral 8x7B (weak). At 95% of GPT-4’s benchmark score, its best routers cut cost versus sending everything to GPT-4 by over 85% on MT Bench, 45% on MMLU and 35% on GSM8K (LMSYS blog). On MT Bench, the matrix-factorization router needed only 26% of calls to go to GPT-4, or 14% once the training data was augmented with LLM-judge labels. The paper’s own abstract is more conservative: costs drop “by over 2 times in certain cases” (arXiv 2406.18665).
RouterBench is the sober counterweight. It collected over 405,000 inference outcomes across eight datasets (MMLU, MT-Bench, GSM8K, MBPP, ARC, Hellaswag, Winogrande and a RAG set) and compared routers to a “Zero router”, the convex hull of simply picking one model at each budget. Its finding: KNN and MLP routers “achieve the level of performance to the best individual LLMs with lower or similar costs”, yet “none of the routing algorithms significantly outperform the baseline Zero router”, and they underperformed it on ARC-Challenge and MBPP, the coding set (arXiv 2403.12031). Cascades, where a cheap model answers first and a judge escalates, did beat the baseline, but only while the judge’s error rate stayed at or below 0.1; past 0.2 they degraded quickly.
Read together: routing pays when your traffic has a fat tail of easy prompts, like chat, Q&A or classification. It pays less on uniformly hard work, and code is where predictive routers are weakest.
We build CandorNo GPU? Use a hosted model
Uncensored AI, right in your browser.
Candor runs open models with refusals removed, so it answers the questions other assistants deflect. New accounts get free credits, no card needed.
Try Candor freeHow do you route between a local model and an API?
Put the local model in the “weak” or “simple” slot and a frontier API in the “strong” slot, then calibrate the split on your own prompts.
The local-first version is the same pattern with a different price curve: the weak model costs electricity instead of tokens. Two open-source ways to do it:
RouteLLM with Ollama as the weak model. The project ships an example for exactly this (routing to local models):
pip install "routellm[serve,eval]"
ollama pull llama3
export OPENAI_API_KEY=sk-...
python -m routellm.openai_server --routers mf --weak-model ollama_chat/llama3The server listens on port 6060. Clients pick the router and threshold in the model name, for example router-mf-0.11593, which the README calibrates to send about 50% of Chatbot Arena-style queries to the strong model. Recalibrate on a sample of your own traffic: the threshold that gives 50% on Arena chat will not give 50% on your IDE completions.
LiteLLM’s complexity router. Define tiers and point SIMPLE at your local model, COMPLEX and REASONING at hosted ones. The default classifier is a heuristic scorer with no extra API calls; you can swap in a small LLM classifier. Setting up the proxy itself, the ollama_chat/ prefix and keys is covered in LiteLLM with Ollama.
Practical rules that hold across both:
- Measure before routing. Log a week of prompts, replay a sample through the local model, and grade the answers. Your savings ceiling is the share that passes.
- Turn on session affinity for agents. LiteLLM’s
session_affinitypins a session to its first-turn model to keep prompt caches warm. - Track misroutes, not just spend. Count escalations and user retries on the local tier.
- Keep a hard floor for code. Multi-file edits and tool-heavy agent turns go straight to the strong model.
Whether the local tier is cheaper depends on hardware and volume; see self-hosting vs API cost. For which coding tasks a local model handles well, see local LLM vs Claude for coding.
Which open-source routers exist?
Several, and they split cleanly into gateways, learned routers and research libraries.
| Project | What it is | License | Notes |
|---|---|---|---|
| RouteLLM | Learned strong/weak router + eval framework | Apache-2.0 | OpenAI-compatible server; README still defaults to GPT-4 and Mixtral |
| LiteLLM | Gateway with rule strategies and a beta complexity router | MIT (OSS core) | Pin versions after the 2026 PyPI backdoor incidents |
| LLMRouter | Research library | MIT | 19 router entries across single-round, multi-round, multimodal, agentic and personalized routing |
| Arch-Router-1.5B | Small routing model for the Arch proxy | Katanemo license | Routes by domain/action policies you write, not benchmark scores |
| Wayfinder Router | Local OpenAI- and Anthropic-compatible endpoint | Apache-2.0 | Deterministic, keyless scoring; writes a receipt for each routing decision |
If you only need “one key for many hosted models”, that is an aggregator, not a router in the learned sense; OpenRouter’s free models page covers that side.
What do developers report in practice?
Builders report that routing works on easy traffic and fails quietly on hard code, and that the hidden costs sit outside the token bill.
- Misroutes concentrate on hard code. One r/LLMDevs builder scored 805 responses across nine models to build a router’s quality map. Their self-reported quality retention versus always using the frontier model was 98% on MMLU and at or above 100% on GSM8K and HumanEval+, but 78% on BigCodeBench Hard, where the router judged multi-file tasks easy and picked a cheaper model. They also dropped prompt length as a difficulty signal (thread).
- Category is not difficulty. In a related post, the same kind of pipeline labeled 75% of GSM8K math problems “simple_chat”; the author’s conclusion was that difficulty belongs to the prompt and model pair, not the prompt alone (thread).
- A team shut its router down. Manifest ran a four-tier complexity router in its gateway for about four months and roughly 7,000 cloud users, then deprecated it. Their reasons: the prompt doesn’t contain the whole task in agent workflows, switching models breaks prompt caching, mid-session switches hurt consistency, and routing makes evals and observability harder. “The amount saved is paid somewhere else” (Manifest). The Hacker News discussion mostly agreed, with several commenters preferring an orchestrator model that hands subtasks to smaller models over a per-prompt router.
- The open question is “good enough”. On a Show HN for a tool that routes Claude Code subagents to on-device models, the top question was how to know the cheap model is good enough without already knowing the answer (HN).
- Benchmark-trained routers may not fit your domain. In the Arch-Router Show HN thread, one commenter argued that RouteLLM’s routers are optimized for public benchmarks such as MMLU and MT-Bench, which may not reflect domain-specific preferences (HN).
The pattern across these reports: route at the session or task-type level, not per message, and keep a fixed frontier path for code that spans files.
FAQ
Is OpenRouter an LLM router?
Mostly it is an aggregator: one API and key for many hosted models. Its openrouter/auto model is a prompt-aware router that classifies each prompt and picks from hosted models, at no extra fee. It cannot route to a model on your machine.
What is RouteLLM?
An Apache-2.0 framework from LMSYS for training, serving and evaluating routers that choose between a strong and a weak model per prompt. It exposes an OpenAI-compatible server, and the weak model can be a local Ollama model.
Can an LLM router be self-hosted and run locally?
Yes. RouteLLM, LiteLLM and Wayfinder Router all run on your own machine or server and expose an OpenAI-compatible endpoint. Only the strong-model calls leave the box, if you configure a hosted model at all.
Does an LLM router break prompt caching?
It can. Cache hits are per model, so a router that switches models mid-conversation forfeits cheap cached input. Pin each session to one model (LiteLLM’s session_affinity) or route once per task.
Is there a standard LLM router benchmark?
RouterBench (405k+ outcomes, eight datasets) is the most cited, and RouteLLM ships its own eval harness with MT Bench, MMLU and GSM8K. Both use public benchmarks, so calibrate on a sample of your own prompts before trusting the numbers.
We build CandorSkip the setup
Want an uncensored model without hosting one?
Candor (candorai.dev) is an uncensored AI chat app that runs in your browser: it answers the questions mainstream assistants dodge, on health, money, law and work, without the lecture. New accounts get free credits, no card needed.
Facts from candorai.dev, checked Nov 10, 2026. Candor never changes how we rank or review models. Disclosure.
Sources (10)
- RouteLLM: Learning to Route LLMs with Preference Data (arXiv 2406.18665)
- LMSYS blog: RouteLLM, an open-source framework for cost-effective LLM routing
- RouteLLM on GitHub (routers, threshold calibration, OpenAI-compatible server)
- RouteLLM example: routing to local models with Ollama
- RouterBench: A Benchmark for Multi-LLM Routing System (arXiv 2403.12031)
- LiteLLM docs: Router, load balancing and routing strategies
- LiteLLM docs: Auto Routing (complexity router)
- OpenRouter docs: Auto Router
- Katanemo Arch-Router-1.5B model card
- Manifest: Everyone is building LLM routers, we deprecated ours (Jul 2026)
Written by Refusal Rate editors from papers, model cards, official docs and pricing pages. Anything we ran ourselves is labeled as our own test, with the hardware and settings. Our method.