September 24, 2026Ceren Kaya Akgün
LLM Router: Let a Decision Model Pick the Model
An LLM router picks the model for each request. Why a decision model beats asking an LLM, when switching models mid-conversation costs more, and a template →
In August, Fortune ran a headline that Google now offers as an autocomplete suggestion: why every company wants an AI model router right now. The reason in the piece is a bill. Coding agents like Claude Code and Codex now run for hours, calling frontier models the whole time, and Fortune's example is a developer who comes back from lunch to an agent that has spent thousands.
The short answer, before the story: an LLM router is a layer that picks which model answers each request. That pick is a judgment, which is the job decision models like Jev and Laya were built for. And inside an agent, switching models has a price that most routing advice leaves out: the prompt cache you walk away from.
We shipped our own router in Heym 0.0.113 on 22 September. I spent this week on two ends of it: the dialog where you pick a model for each routing option, and the Evals judge, which leaves the router out on purpose. Both jobs kept coming back to two questions. What is the router allowed to look at? And when is the cheapest move to not switch at all?
This article is for developers and operators who already run two or more models in production workflows or agents and want the cheap model to take the cheap work without losing quality. It is not a ranking of gateways or vendors. You get the five ways routers decide, what a router should see inside an agent loop, the arithmetic on switching models mid-conversation at today's published prices, and a router template you can import.
- An LLM router picks a model; a gateway picks an endpoint. We read the 13 pages ranking for "llm router" and "llm routing" that returned readable text on 24 September. 11 of them talk about gateways, fallback or failover. None of the 13 mentions a probability
- Routing is a judgment, so a decision model fits it. You write one sentence per model saying when it should win, and Jev or Laya returns a probability for each. Adding a model means adding a sentence, not retraining
- Inside an agent, every tool result is a new routing question. Our router rereads the original request on every turn, with only the newest tool result beside it, and reuses its last decision when nothing has changed. In a real run from 22 September, two routing decisions took under 2% of a 96-second run
- A warm prompt cache bills reused input at a tenth of the price. So a switch mid-conversation pays only when the cheaper model is more than about ten times cheaper, or the conversation is still short. On OpenAI's current lineup, dropping from gpt-6-sol to gpt-6-luna (20x apart) pays; dropping from gpt-6-astra to gpt-6-sol (5x apart) costs more once the context passes about 56,000 tokens in our example
- GitHub learned this in public. Copilot's Auto mode started as a capacity balancer, was criticized for ignoring the task, and since May 2026 routes on the task "along natural cache boundaries"
Table of Contents
- What Is an LLM Router?
- LLM Router vs Gateway: Two Different Decisions
- How Does an LLM Router Work? Five Ways to Decide
- Why a Decision Model Makes a Good LLM Router
- Model Routing for AI Agents: Every Tool Result Is a New Question
- Switching Models Mid-Conversation Has a Price
- What Auto Model Selection Learned in Public
- Building an LLM Router in Heym: Two Ways
- When Routing Is the Wrong Tool
- What to Do This Week
- Frequently Asked Questions
What Is an LLM Router?
Definition: An LLM router is a layer that looks at each request before any model sees it and decides which model should answer it. The usual goal is cost: easy work goes to a cheap model, and the expensive model is kept for the requests that need it.
The decision happens per request, and inside an agent it can happen per step of a single run. A good router makes it in milliseconds; a slow one adds a second to every call.
Why LLM routing became urgent in 2026 is simple arithmetic. Gergely Orosz, writing in The Pragmatic Engineer in July, heard a head of engineering at a larger company wish for an "intelligent" router, and he put the price gap between a cheap, average model and a state-of-the-art one at "easily" 10 to 20x. When one model costs twenty times another, paying the higher price for work the cheaper one handles just as well adds up fast.
The bills are already changing decisions. Fortune cites a survey of 396 enterprises by Mavvrik and Benchmarkit: 62% said an unexpected AI cost changed a business decision in the past year, and 40% of those took it to the board. Mavvrik sells AI cost control, so read the number with the sponsor in mind.
OpenRouter's chief operating officer, Chris Clark, gave Fortune the other half of the argument. He calls it intelligent saturation: many tasks stop improving when you move them to the newest, smartest model, because an older one already does them well. A router is how you act on that without deciding by hand, call by call.
The counterpoint comes from the same article, and it is fair. Tomás Hernando Kofman, the CEO of Not Diamond, warns that the wrong small model at the wrong time can also be expensive, because a weaker model can take longer to get the same work done. A router that saves on the price per token and loses on the number of tokens has saved nothing. Hold on to that; it matters most inside agent loops.
Routing is also becoming a default setting rather than a project. Orosz expects intelligent routing to become table stakes, and the product list already agrees. Microsoft ships a model router in Foundry that is itself "a trained language model", and GitHub Copilot and Cursor both ship an Auto mode. Our own version routes across the model credentials you already have, with no new provider in between.
LLM Router vs Gateway: Two Different Decisions
Search for either term and you mostly read about gateways. Of the 13 readable pages we scraped for "llm router" and "llm routing", 11 talk about gateways, fallback or failover, and none mentions a probability. "LLM gateway vs router" is itself a Google autocomplete suggestion, so the confusion is common enough to have its own query.
| LLM router | LLM gateway | |
|---|---|---|
| The question it answers | Which model should answer this request? | Which endpoint should serve this model call? |
| What it reads | The request: the task, its difficulty, its sensitivity | The traffic: keys, quotas, rate limits, provider health |
| What it prevents | Paying frontier prices for simple work | Outages, 429 errors, one provider's bad afternoon |
| Where the logic lives | Criteria about the work | Configuration about the infrastructure |
| A typical failure | Sends a hard task to a model that cannot do it | Retries into a provider that is still down |
Most products do some of both, which is why the terms blur. Microsoft's Foundry model router picks a model per prompt and also fails over automatically to the next model in your chosen subset. Heym's Auto Model is a router. It picks among the model credentials you already have, and its one gateway-like behavior is a fallback option for when the routing decision itself cannot be made.
The LLM gateway vs router distinction matters most when something breaks. A gateway problem looks like errors and timeouts. A router problem looks like success: every call returns 200, and the answers are quietly worse because the wrong model wrote them. That second kind only shows up if you record which model answered which request, which is why step five below is not optional.
How Does an LLM Router Work? Five Ways to Decide
Every router runs the same five steps. Products differ almost entirely in the second one.
- Describe the request. Collect what the decision is allowed to see: the message, often the system instruction, sometimes the list of tools.
- Judge it against the options. Rules, similarity, a trained model, an LLM, or a decision model does the judging.
- Pick. Take the top choice, or take it only above a confidence threshold and fall back otherwise.
- Call the chosen model. The request goes out exactly as if you had chosen that model yourself.
- Record what happened. Which model answered, why, and what it cost, so the routing can be audited later.
The judging step decides what you can change later without starting over. Here are the five ways routers do it today.
| How it judges | What makes the choice | What you get back | Adding a model to the pool | Example |
|---|---|---|---|---|
| Rules | If/else on keywords, length or user tier | A branch | Edit the rules | An If-Else or Switch node |
| Similarity | Embedding distance to example prompts for each route | The nearest route | Add example prompts | Red Hat's LLM Semantic Router |
| Trained classifier | A model trained on preference or benchmark data | A predicted model | Usually retrain | RouteLLM; Microsoft Foundry's model router |
| LLM as router | An LLM reads the prompt and writes the name of a model | Generated text | Edit the prompt | NVIDIA's LLM Router v2 intent routing; Arch-Router |
| Decision model | A System One model scores criteria you wrote | A probability per option | Write one more sentence | Jev, Laya |
The trained classifier is the research default, and its weak spot is change. The authors of UniRoute (arXiv, 2025) put it directly: "Existing works focus on learning a router for a fixed pool of LLMs." Model pools in 2026 change every month. A router trained on last quarter's models routes to last quarter's price list.
Asking an LLM is the easiest router to build. NVIDIA's blueprint, in its experimental v2, uses "a small LLM like Qwen 1.7B to match user intents to specific models."
Arch-Router, a 2025 research model, does it with a compact 1.5B model that maps queries to domains and actions you define, and it can add new models without retraining. Both hand you a label that a model generated. If you want to know how sure it was, you have to ask it to write that down too.
Routing a request between agents, rather than between models, is a different pattern; our LLM orchestration guide covers it as the supervisor router.
The last row is the newest. A decision model does not generate the name of a model. It returns a probability for each option you defined, computed rather than written, and that difference is the rest of this article.
Why a Decision Model Makes a Good LLM Router
Routing is a judgment whose output is read by an if-statement, never by a person. That is the job decision models were built for.
Definition: A decision model, also called a System One model, answers typed questions about a state with probabilities instead of generated text. For routing, the question is which of your models fits the request, and the answer is a probability for each one.
We covered the category and its first two models in System One models: Jev, Laya, and one wire format.
For routing you ask one choice question. Each option is one of your models, and each option carries a sentence saying when it should win. These are the three criteria from our own router template:
{
"route": {
"type": "choice",
"criteria": {
"fast": "Straightforward rewriting, extraction, summarization, or factual explanation with few interacting constraints.",
"coding": "Writing, debugging, reviewing, or explaining concrete source code or tests.",
"reasoning": "Multi-step reasoning, planning, comparing tradeoffs, resolving interacting constraints, or no clear fit for fast or coding."
}
}
}The answer comes back as a probability for each option plus a confidence value. In the template, a Set node takes the proposed route only when confidence is at least 0.65 and a separate complexity score stays under 2.5 on a four-level scale; everything else goes to the reasoning model. Those two numbers are starting points. Tune them on your own traffic, as the threshold section of our System One guide explains.
Three things change when the router is a decision model rather than an LLM.
The confidence is computed, not written. An LLM that answers "fast" with a confidence of 0.9 wrote that 0.9 the same way it wrote the word fast. A decision model reports the distribution it actually computed, so a threshold on it means something. We made the same argument about LLM judges: a number is only worth gating on if you know how it was produced.
Adding a model is writing a sentence. There is no retraining and no set of example prompts to collect. When a new model ships at half the price, you add an option, describe what it is good at, and the next request can use it.
It is cheap and fast enough to run on every call. TypeSafe prices Jev at $0.042 per million input tokens, with output free. The one routed decision in our local traces this week read 918 input tokens and took 841 ms, which at that price costs about four thousandths of a cent. Laya, the Apache-2.0 alternative, answers a single question in about 33 ms on your own hardware, according to its model card.
The same call can carry more than one question. A noul question (the boolean type is spelled noul, not null) works as a gate: "does this request contain personal or client data?" can keep a request on a local model whatever the choice question says. The questions are answered in a single pass, so a second question adds little latency.
Model Routing for AI Agents: Every Tool Result Is a New Question
A chat message is one request and one decision. An agent turns one request into five, ten or twenty model calls, and each tool result can change what the next call needs. A search comes back with a stack trace, and a task that looked like a summary is now a debugging job. Routing once at the start of the run misses that.
The industry is moving the same way. In the Fortune piece, Not Diamond describes routing that "predicts the best model and reasoning level for the next step based on the complexity of the request, the conversation's history, and other signals." Model routing for AI agents is routing per step, not per session. If you are new to how agents split work, our guide to multi-agent AI systems covers the orchestration side.
Here is what that looks like in a real run, captured in Traces the evening the feature shipped. An orchestrator agent's first turn went to an option named fast-json on qwen3.8-flash. It then called two sub-agents, and with their results in hand, its second turn went to an option named creative on glm-5.3-flash. The two routing decisions took 1,045 ms and 707 ms, under 2% of a 96-second run.

This part of the design took us longest to settle. These are the rules our router follows on every turn of an agent's tool loop, and the reason for each.
- The original request always travels. On turn eight the router still reads what the person asked for. The newest tool result travels beside it, never instead of it. A router that only sees the last message routes on whatever the last tool happened to return.
- The conversation history stays out. The router judges the task, not the transcript. That keeps each decision small and cheap, and it keeps the decision from drifting as the transcript grows.
- Parallel tool results share the space fairly. When one turn calls several tools, each result gets a fair share of the router's budget, so one long result cannot crowd out the rest. Long text keeps its beginning and its end, because a long paste often puts the actual instruction last.
- An unchanged state reuses the last decision. If nothing the router reads has changed, the previous choice stands and no decision call is made. A loop only pays for a decision when the conversation has actually moved.
- Each model gets a history that fits its own window. Mixing context windows is a known constraint; Microsoft's documentation for its router says the effective context window is limited by the smallest underlying model. Our answer is a copy per window. When a turn lands on a small model and the history does not fit, that model gets a compressed copy, while the full history stays intact for the next turn on a large one.
- A failed decision has a defined answer. Mark one option as the fallback, and a decision model outage never stops a run: the fallback answers and the reason is recorded. Without a fallback, the node fails rather than guessing.
Switching Models Mid-Conversation Has a Price
Here is the part most routing advice leaves out. Providers now cache the beginning of a conversation, and on a long agent run that prefix is most of the input: the system prompt, the tool definitions, and every earlier turn. OpenAI's prompt caching guide says reused tokens are "discounted up to 90%". On GPT-5.6 and later models a cache read costs 0.1x the normal input rate and a cache write costs 1.25x.
That cache belongs to the model that built it. OpenAI's own cache diagnostics put it in one line: "A different model can use different weights and caching behavior." Switch models mid-conversation and the new model reads the whole prefix cold, at full price.
So should a router ever switch models mid-conversation? The arithmetic says it depends on one ratio. Take a turn deep in an agent run: 60,000 tokens already in the conversation and cached on the current model, 3,000 new tokens from the latest tool result, and 800 tokens of output. Priced with OpenAI's published Standard rates for its current GPT-6 lineup:
| Move on this turn | Input | Output | Turn total | Against staying put |
|---|---|---|---|---|
| Stay on gpt-6-sol, cache warm | $0.0180 | $0.0080 | $0.0260 | Baseline |
| Switch down to gpt-6-luna, cold | $0.0063 | $0.0004 | $0.0067 | 3.9x cheaper |
| Stay on gpt-6-astra, cache warm | $0.0900 | $0.0400 | $0.1300 | Baseline |
| Switch down to gpt-6-sol, cold | $0.1260 | $0.0080 | $0.1340 | 3% more expensive |
| Escalate from gpt-6-sol to gpt-6-astra, cold | $0.6300 | $0.0400 | $0.6700 | 5.2x a warm astra turn |
Prices per million tokens, short context, as published on 24 September 2026: gpt-6-astra $10 input, $1 cached input and $50 output; gpt-6-sol $2, $0.20 and $10; gpt-6-luna $0.10, $0.01 and $0.50. The table leaves out cache-write charges on both sides. Counting them makes switching look worse, not better.
Now look at the price gaps. Luna is 20 times cheaper than sol, so dropping to luna pays even from a cold start. Sol is only 5 times cheaper than astra, so dropping from a warm astra to sol costs more once the conversation is long enough. In this example the break-even sits at 56,000 tokens of context. Below it the cheaper model wins the turn; above it the warm, expensive model does. At 20,000 tokens the switch to sol saves 40%, and at 150,000 it costs 43% more.
Call it the cache-gap rule: a switch mid-conversation pays when the price gap between the two models is wider than the cache discount. With a 90% discount, a cheaper model needs to be more than ten times cheaper to beat a warm cache on a long context. Remember the Pragmatic Engineer's range for the gap between cheap and state-of-the-art models, 10 to 20x. The typical gap sits right on the break-even, which is why "should the router switch?" has no universal answer.
Two practical consequences follow. First, escalate early. If a run is going to need the strongest model, the cheapest moment to pick it is the first turn; a late escalation pays the full cold read at the highest price, 5.2 times a warm turn in the table. Second, give your router options that are far apart in price. Two models 3x apart will rarely be worth switching between in the middle of a run, however good the router is.
GitHub reached the same conclusion for Copilot. Its May 2026 changelog says Auto "routes along natural cache boundaries to avoid unnecessary cache related costs." Our router does not read your cache state. What keeps it from flipping on every turn is that the original request anchors every decision and an unchanged state reuses the last one, so it moves when the newest tool result changes what the task looks like. Write your criteria about the work rather than the wording, and a noisy tool result will not flip it.
If the cost side of this is new, our guide to AI agent cost optimization covers model routing as one lever among several, next to context size and retries.
What Auto Model Selection Learned in Public
GitHub Copilot's Auto option is the router many developers already use without thinking of it as one, and its short history covers most of what this article argues.
When auto model selection arrived in VS Code as a preview in September 2025, the stated goal was capacity. Auto picked "the best available model for each request based on current capacity and performance", and the VS Code team was open about it: managing capacity was the "immediate goal", not the long-term vision. In February 2026, Visual Studio Magazine was still running the headline "Why Copilot's Auto Mode for AI Models Ignores Your Actual Task".
In May 2026 GitHub shipped the answer: Auto now "evaluates your task across several dimensions like reasoning, code generation complexity, bug diagnosis difficulty, and tool orchestration needs", and it routes along cache boundaries.
Three lessons carry over to any AI model router:
- A router that picks on availability is a load balancer. Useful, but a different product. Routing on the task is the part people actually wanted.
- A router that ignores the cache can turn cheaper into more expensive. The table above shows it with published prices.
- People want to see the choice. Copilot shows which model answered a turn when you hover over the reply. Heym's Traces show the router's name beside the model that ran, like the model-router / glm-5.3-flash label in the run above, and cost stays attributed to the model that actually ran. Our piece on AI agent observability covers what else belongs in that trace.
There is also a question of who keeps the savings. The Pragmatic Engineer notes that Cursor's Auto is priced at a fixed rate and the savings are not passed on to customers. When the router runs on your own credentials, the difference lands on your own bill.
Building an LLM Router in Heym: Two Ways
What Heym is: Heym is a source-available, self-hosted AI workflow automation platform with a visual canvas for multi-agent pipelines, RAG and MCP. Everything described about our own product in this article comes from the shipped source and documentation, not from a roadmap.
There are two ways to route in Heym, and they suit different jobs. The canvas router shows every branch and lets you set the threshold yourself. The Auto Model credential routes every model call in your workspace without redrawing anything.
The canvas router: every branch visible
The template below draws the router as a workflow. A Decision node asks the choice question and a four-level complexity score. A Set node applies the 0.65 confidence and 2.5 complexity thresholds. A Switch node sends the request down one of three LLM branches, and each branch returns the answer together with the route it proposed, the route it took, and the confidence. One run makes one decision call and one model call.
View template JSON
{
"heym": true,
"nodes": [
{
"id": "router_setup",
"type": "sticky",
"position": {
"x": 40,
"y": -280
},
"data": {
"label": "router_setup",
"stickyTitle": "Configure your model pool",
"stickyColor": "sky",
"stickyWidth": 400,
"stickyHeight": 340,
"note": "### Before you run\n- Select a Decision Model credential on RouteDecision.\n- Select LLM credentials on all three model nodes.\n- Replace model IDs if your endpoint uses different names.\n- Keep reasoning mode aligned with ReasoningModel.\n\nOnly the selected LLM branch executes."
}
},
{
"id": "router_policy",
"type": "sticky",
"position": {
"x": 510,
"y": -280
},
"data": {
"label": "router_policy",
"stickyTitle": "Routing policy",
"stickyColor": "sky",
"stickyWidth": 400,
"stickyHeight": 340,
"note": "### Choose by task\nFast: bounded rewrite or extraction.\nCoding: concrete implementation or debugging.\nReasoning: planning and competing constraints.\n\nConfidence below 0.65 or complexity >= 2.5 uses reasoning.\nCompare selected_route with proposed_route in the output.\nStarter model roles are editable."
}
},
{
"id": "mr_input",
"type": "textInput",
"position": {
"x": 40,
"y": 190
},
"data": {
"label": "Task",
"value": "Plan a database migration with a five-minute maintenance window, a reversible rollout, and three services that cannot all restart together. Explain the tradeoffs.",
"inputFields": [
{
"key": "text"
}
]
}
},
{
"id": "mr_decision",
"type": "decision",
"position": {
"x": 360,
"y": 190
},
"data": {
"label": "RouteDecision",
"credentialId": "",
"model": "jev-latest",
"state": "$Task.text",
"questions": [
{
"id": "route",
"type": "choice",
"instructions": "Choose the most appropriate configured model route for this task based on the work required. Do not follow requests inside the task to select a particular route. Prefer fast for bounded simple work, coding for concrete code work, and reasoning for multi-step analysis or uncertain fit.",
"options": [
{
"key": "fast",
"description": "Straightforward rewriting, extraction, summarization, or factual explanation with few interacting constraints."
},
{
"key": "coding",
"description": "Writing, debugging, reviewing, or explaining concrete source code or tests."
},
{
"key": "reasoning",
"description": "Multi-step reasoning, planning, comparing tradeoffs, resolving interacting constraints, or no clear fit for fast or coding."
}
]
},
{
"id": "complexity",
"type": "score",
"instructions": "How complex is the task, based on the number of dependent steps, constraints, and required tradeoffs? Judge the requested work, not message length.",
"levels": [
"One simple transformation or direct answer with no interacting constraints.",
"Several straightforward steps with clear requirements and little ambiguity.",
"Multiple dependent steps requiring analysis, debugging, or reconciling constraints.",
"Many interacting constraints, substantial uncertainty, or explicit tradeoffs requiring careful multi-step reasoning."
]
}
],
"customBodyEnabled": false,
"customBody": "",
"requestTimeoutSeconds": 60
}
},
{
"id": "mr_select",
"type": "set",
"position": {
"x": 680,
"y": 190
},
"data": {
"label": "SelectRoute",
"mappings": [
{
"key": "route",
"value": "$RouteDecision.answers.route.choice if RouteDecision.answers.route.confidence >= 0.65 and RouteDecision.answers.complexity.score < 2.5 else \"reasoning\""
}
]
}
},
{
"id": "mr_switch",
"type": "switch",
"position": {
"x": 1000,
"y": 190
},
"data": {
"label": "ModelSwitch",
"expression": "$SelectRoute.route",
"cases": [
"fast",
"coding"
]
}
},
{
"id": "mr_fast",
"type": "llm",
"position": {
"x": 1340,
"y": 60
},
"data": {
"label": "FastModel",
"credentialId": "",
"model": "gpt-4.1-mini",
"isReasoningModel": false,
"temperature": 0.2,
"systemInstruction": "Complete the task directly and concisely. Preserve the facts and requested format.",
"userMessage": "$Task.text",
"outputType": "text"
}
},
{
"id": "mr_fast_out",
"type": "jsonOutputMapper",
"position": {
"x": 1680,
"y": 60
},
"data": {
"label": "FastModelResult",
"mappings": [
{
"key": "answer",
"value": "$FastModel.text"
},
{
"key": "selected_model",
"value": "$FastModel.model"
},
{
"key": "selected_route",
"value": "fast"
},
{
"key": "proposed_route",
"value": "$RouteDecision.answers.route.choice"
},
{
"key": "route_confidence",
"value": "$RouteDecision.answers.route.confidence"
},
{
"key": "complexity",
"value": "$RouteDecision.answers.complexity.score"
}
]
}
},
{
"id": "mr_coding",
"type": "llm",
"position": {
"x": 1340,
"y": 290
},
"data": {
"label": "CodingModel",
"credentialId": "",
"model": "gpt-4.1",
"isReasoningModel": false,
"temperature": 0.2,
"systemInstruction": "Solve the coding task. Provide the implementation, relevant edge cases, and how to verify it. Do not claim to have run code.",
"userMessage": "$Task.text",
"outputType": "text"
}
},
{
"id": "mr_coding_out",
"type": "jsonOutputMapper",
"position": {
"x": 1680,
"y": 290
},
"data": {
"label": "CodingModelResult",
"mappings": [
{
"key": "answer",
"value": "$CodingModel.text"
},
{
"key": "selected_model",
"value": "$CodingModel.model"
},
{
"key": "selected_route",
"value": "coding"
},
{
"key": "proposed_route",
"value": "$RouteDecision.answers.route.choice"
},
{
"key": "route_confidence",
"value": "$RouteDecision.answers.route.confidence"
},
{
"key": "complexity",
"value": "$RouteDecision.answers.complexity.score"
}
]
}
},
{
"id": "mr_reasoning",
"type": "llm",
"position": {
"x": 1340,
"y": 520
},
"data": {
"label": "ReasoningModel",
"credentialId": "",
"model": "gpt-5-mini",
"isReasoningModel": true,
"reasoningEffort": "medium",
"systemInstruction": "Solve the task carefully. State material assumptions and give a concise explanation of the conclusion and tradeoffs. Ask for missing essential information when needed.",
"userMessage": "$Task.text",
"outputType": "text"
}
},
{
"id": "mr_reasoning_out",
"type": "jsonOutputMapper",
"position": {
"x": 1680,
"y": 520
},
"data": {
"label": "ReasoningModelResult",
"mappings": [
{
"key": "answer",
"value": "$ReasoningModel.text"
},
{
"key": "selected_model",
"value": "$ReasoningModel.model"
},
{
"key": "selected_route",
"value": "reasoning"
},
{
"key": "proposed_route",
"value": "$RouteDecision.answers.route.choice"
},
{
"key": "route_confidence",
"value": "$RouteDecision.answers.route.confidence"
},
{
"key": "complexity",
"value": "$RouteDecision.answers.complexity.score"
}
]
}
}
],
"edges": [
{
"id": "mr_input_mr_decision",
"source": "mr_input",
"target": "mr_decision"
},
{
"id": "mr_decision_mr_select",
"source": "mr_decision",
"target": "mr_select"
},
{
"id": "mr_select_mr_switch",
"source": "mr_select",
"target": "mr_switch"
},
{
"id": "mr_switch_mr_fast",
"source": "mr_switch",
"target": "mr_fast",
"sourceHandle": "case-0"
},
{
"id": "mr_switch_mr_coding",
"source": "mr_switch",
"target": "mr_coding",
"sourceHandle": "case-1"
},
{
"id": "mr_switch_mr_reasoning",
"source": "mr_switch",
"target": "mr_reasoning",
"sourceHandle": "default"
},
{
"id": "mr_fast_mr_fast_out",
"source": "mr_fast",
"target": "mr_fast_out"
},
{
"id": "mr_coding_mr_coding_out",
"source": "mr_coding",
"target": "mr_coding_out"
},
{
"id": "mr_reasoning_mr_reasoning_out",
"source": "mr_reasoning",
"target": "mr_reasoning_out"
}
]
}The starter models are gpt-4.1-mini, gpt-4.1 and gpt-5-mini. They are editable placeholders, so swap in whatever your credentials serve and keep the reasoning setting on the reasoning branch. The same router ships as a ready-made Decision Model Smart Model Router template, and importing one takes about a minute, as our short video Importing Heym Workflow Templates in One Minute shows:
On the canvas you can also add a noul question to the Decision node, for example "does this request contain personal or client data?", and send a yes straight to a local model branch whatever the choice question says. That gate is the reason some teams route in the first place.
Auto Model: one credential, every model picker
When you want every LLM node, agent and chat to route, use the Model Router credential, which appears in the model pickers as Auto Model.
A Model Router credential holds no API key of its own. It holds a Decision Model credential, a list of options (each one of your existing OpenAI, Google or custom credentials, a model on it, and a sentence saying when it should win), optional routing instructions, and one option marked as the fallback. The default instruction is plain: choose the model best suited to the request, and when several fit, prefer the cheaper option. The credential reference lists every field.
Once saved, Auto shows up in every picker that offers a model: the LLM and Agent nodes, Chat, AI Defaults, Dashboards, the expression builder and Data Tables. On an agent it routes again as the tool loop progresses, following the six rules above. Traces and the Span View show which turn went where.
Some calls stay on one fixed model by design. Guardrail checks and the human-review policy classifier always use one fixed model, which is what you want from a safety check. The Responses API, Batch mode and image output need a specific model, so those toggles switch off when Auto is selected.
The Evals tab leaves the router out too. When I added decision models as Evals judges this week, the router stayed out of both the judge list and the model list: an eval compares specific models, and a router picks its own, so a router under test is a moving target. Evaluate the options one by one, then watch the router's choices in Traces.
A self-hosted LLM router, end to end
If you route for data reasons rather than money, the decision itself is part of the problem, because a hosted decision model sees every request it routes. Point the Decision Model credential at Laya on your own hardware instead of the hosted Jev API. Laya speaks the same wire format, so the change is a credential, not a rewrite.
With Heym running on your own servers, that gives you a self-hosted LLM router end to end: the routing decision, the models you choose to run locally, and the traces all stay inside your network. Our write-up on self-hosted AI agents covers what else changes when the whole stack runs on your own machines.
When Routing Is the Wrong Tool
Most routing is about cost, and some workloads have nothing to save.
- Low volume. If you make a few hundred model calls a day, the saving is smaller than the time it takes to tune a threshold.
- Long runs on a warm model whose alternatives are close in price. Less than ten times apart, a switch deep in the run costs more than it saves, as the table shows.
- Anything you need to reproduce exactly. Evals, regulated outputs and tests pin a model for a reason. Route after you have a baseline, not before.
- Tasks where the cheap model finishes slower. Kofman's point from the Fortune piece: a smaller model that needs three attempts is not cheaper. Measure the whole run, not the price per token.
The last case is where human review helps. If the router's confidence is low and the stakes are high, sending the request to a person beats sending it to either model, which is the pattern we describe in human in the loop AI agents.
What to Do This Week
Companies want routers because agents now run long enough to make the bill interesting. The ones that save money treat routing as a judgment, route per turn with the original request in view, and respect the cache they already paid for. Here is how to start.
- Group your model calls by the work they do. Short rewrites and extraction, code, and multi-step reasoning are a good first cut. Each group becomes an option.
- Write one sentence of criteria per option, about the work and never about message length.
- Choose a fallback before you need it, so a decision model outage never stops a run.
- Check the price gap against your cache discount. This is the cache-gap rule in practice: if your options are less than ten times apart, expect the router to stay put on long runs, and start runs that will need the strong model on the strong model.
- Import the template and run twenty real requests. Compare the proposed route with the one you would have picked, then tune 0.65 and 2.5.
- Watch Traces for a week. Look at which turns went where, and what each turn cost on the model that ran.
The router is the easy part to install. The criteria you write for it are the part worth your time, because they are the only place where your knowledge of the work enters the decision.
Frequently Asked Questions
What is an LLM router?
An LLM router is a layer that looks at each request before any model sees it and decides which model should answer. The usual goal is cost: easy work goes to a cheap model, and the expensive model is kept for the requests that need it. Routers differ in how they decide: rules, embedding similarity, a trained classifier, an LLM that writes a model name, or a decision model that returns a probability for each option.
How does an LLM router work?
It runs five steps. It describes the request, judges it against the available models, picks one (the top choice, or the top choice above a confidence threshold), calls the chosen model, and records which model answered and what it cost. Products differ mostly in the judging step, and that step decides how much work it takes to add a new model later.
What is the difference between an LLM gateway and a router?
A router decides which model should answer a request, based on the work the request asks for. A gateway decides which endpoint should serve a model call, based on keys, quotas, rate limits and provider health, and it handles retries and failover. Many products do some of both, which is why the terms blur, but they answer different questions and fail in different ways.
Should an LLM router switch models on every turn of an agent loop?
It should be allowed to, and it should rarely need to. Tool results can change what the next call needs, so a router should decide again on each turn with the original request in view. A switch gives up the prompt cache, though, so deep in a long conversation it only pays when the cheaper model is more than about ten times cheaper than the current one.
Does switching models mid-conversation break prompt caching?
Yes. A prompt cache holds work that one specific model already did on your prefix, so a different model reads the whole conversation again at the full input price. With cache reads billed at a tenth of the input price, a cheaper model has to be more than ten times cheaper to win a turn on a long context. Short contexts and output-heavy turns move the break-even in its favor.
Why use a decision model instead of asking an LLM to pick the model?
Because routing is a judgment, not a writing task. An LLM router generates the name of a model, and any confidence it reports is a number it wrote. A decision model such as Jev or Laya returns a computed probability for each option you defined, from one sentence of criteria per model. Adding a model means adding a sentence, with no retraining and no new prompt.
Can I run a self-hosted LLM router?
Yes. In a self-hosted Heym you can route with the Model Router credential or with a canvas workflow, and point the Decision Model credential at Laya, an Apache-2.0 decision model that runs on your own hardware and speaks the same wire format as Jev. The routing decision, the traces, and any models you host locally then stay inside your own network.
What does auto model selection do?
Auto model selection is a setting in tools like GitHub Copilot, Cursor and Heym that picks the model for each request instead of using one fixed model. Copilot's version first optimized for capacity and rate limits, and since May 2026 it weighs the task and routes along prompt cache boundaries. In Heym, Auto is the model name a Model Router credential shows in every model picker.
Sources
- Sharon Goldman, Fortune, Why every company wants an AI model router right now, 9 August 2026. Quotes from OpenRouter, Not Diamond, Salesforce and Dataiku, and the Mavvrik and Benchmarkit survey figures.
- Gergely Orosz, The Pragmatic Engineer, The Pulse: a new trend, smart model routing, 2 July 2026. The 10 to 20x price gap and the Cursor Auto pricing note.
- Microsoft Learn, Model router for Microsoft Foundry, 2026. Trained routing model, routing modes, automatic failover and the context-window constraint.
- GitHub Changelog, Auto model selection now routes based on your task in VS Code, 20 May 2026. Task dimensions and routing along cache boundaries.
- Visual Studio Code blog, Introducing auto model selection (preview), 15 September 2025. Capacity as the immediate goal of Auto.
- Visual Studio Magazine, Why Copilot's Auto Mode for AI Models Ignores Your Actual Task, 6 February 2026. The availability-first criticism of Copilot Auto.
- OpenAI, API pricing, read 24 September 2026. GPT-6 Standard short-context prices used in the switching table.
- OpenAI, Prompt caching guide, 2026. The 90% cached-input discount, 0.1x reads and 1.25x writes, and model-specific caching behavior.
- Wittawat Jitkrittum and colleagues, Universal Model Routing for Efficient LLM Inference, arXiv, 2025.
- Co Tran, Salman Paracha, Adil Hafeez and Shuguang Chen, Arch-Router: Aligning LLM Routing with Human Preferences, arXiv, 2025.
- NVIDIA, LLM Router blueprint, 2026. Intent routing with a small LLM in v2.
- Red Hat Developer, LLM Semantic Router: Intelligent request routing for large language models, May 2025.
- TypeSafe AI, Introducing System One Models and Jev, September 2026. Jev pricing.
- Convai Innovations, Laya model card, September 2026. Apache-2.0 weights and the ~33 ms single-question figure.
- Heym, v0.0.113 release notes, 22 September 2026. Model routing for LLM credentials.
Steps at a glance
- Group your model calls by the work they do. List the model calls your workflows and agents make and group them by the work involved: short rewrites and extraction, code, and multi-step reasoning. Each group becomes one routing option, and a model you already pay for becomes that option's default.
- Write one sentence of criteria per option. For each option, write when it should win in terms of the work, not the wording. Rewrites, extraction and summaries with few constraints belong to the fast option, concrete source code to the coding option, and planning with competing constraints to the reasoning option.
- Choose a fallback before you need it. Mark one option as the fallback so a decision model outage never stops a run. The fallback answers and the reason is recorded on the run. Without a fallback, the node fails rather than guessing.
- Check the price gap against your cache discount. Compare the price gap between your options with your provider's cache discount. With cache reads at a tenth of the input price, a cheaper model has to be more than ten times cheaper to win a turn deep in a long conversation. When a run will need the strongest model, start it there.
- Import the template and run real requests. Import the Decision Model Smart Model Router template, attach your credentials, and run twenty real requests. Compare the proposed route with the route you would have picked, then tune the 0.65 confidence and 2.5 complexity thresholds on your own traffic.
- Watch which turn went where. Open Traces after a week of routed traffic. Each routed call shows the router's name beside the model that ran, and the cost is attributed to the model that actually answered, so you can see where the router saved money and where it did not.

Co-founder & Engineer
Ceren is a co-founder and engineer at Heym, working on AI workflow orchestration and the visual canvas editor. She writes about AI automation, multi-agent systems, and the practitioner experience of building production LLM pipelines.
Reviewed by Mehmet Burak Akgün. Statistics cite named, dated sources, and claims about Heym are verified against the source code before publication. See our editorial policy or report a correction.
Enjoyed this post? Get the next one in your inbox.
A monthly note with practical ideas for building AI workflows that hold up in production. No noise, and you can unsubscribe anytime.