Back to the blog

Model routing for coding agents: how it works, what it costs, when it pays off

Model routing picks a model for each agent task. A new model starts without the conversation's prompt cache, so a switch can cost more than it saves.

Model routing means choosing, for every task or message, which model should handle it, so that a typo fix goes to a cheap, fast model and a hard bug goes to the strongest one. It can cut a coding agent’s bill. It can also raise it, because a new model cannot read the prompt cache that makes long sessions affordable.

Cursor has an Auto mode that picks the model for you. GitHub Copilot has two routers: auto model selection, and Copilot Fusion in VS Code, JetBrains IDEs, Copilot CLI and the Copilot app. Claude Code’s opusplan setting switches from Opus to Sonnet when you leave plan mode, and gateways like OpenRouter and claude-code-router sit in front of any agent that lets you set its API endpoint. All of them bet that many messages in a working session are easy, and that paying frontier prices for them is waste.

The bet holds for many turns, but every switch has a cost of its own, and that cost decides whether routing saves money. Cost is also what users of coding agents complain about more and more. In our count of 66,320 Reddit complaint posts about AI coding agents, the cost of a run rose from ninth place to third between August 2025 and September 2026.

Where we stand. We build OpenChamber, which has its own per-message router, Auto mode. It is described and checked on the same terms as every other tool. Tables list tools in alphabetical order, nothing is ranked, and the numbers from our own experiment are marked as ours. We checked every claim about another product against that product’s own documentation on 11 November 2026, and every price comes from the provider’s own pricing or documentation pages on the same day.


The short version

What model routing isPicking the model for each task or message, so one session can run on several models
What it is notProvider routing (which servers serve one model) or a gateway (one endpoint in front of many providers)
Why it saves moneyMany turns in a session are easy; a small model costs a fraction of a large one
Why it can cost moneyPrompt caches are tied to one model. After a switch the next model reads the whole conversation uncached, and on Anthropic’s API with the default five-minute cache, or on OpenAI’s GPT-5.6 and later with the default 30-minute cache, it pays 1.25 times the input price to write it to its own cache
The size of that costIn our worked example, a turn on a model with a cold cache costs 6 to 11 times a turn on the same model with a warm cache
Where routing is free of that costSubagents and new sessions: they start with an empty context anyway
Who does it todayAmazon Bedrock (intelligent prompt routing), Claude Code (opusplan, per-subagent models), claude-code-router (your rules), Codex (per-role models), Copilot (Auto, Fusion), Cursor (Auto), LiteLLM (Auto Router), OpenChamber (Auto mode), OpenRouter (Auto Router, Auto Code, Jev Router), Weave Router (per request)
The cheaper leverOn current Claude models an effort change can keep the cache, and Claude Code keeps it by default with an API key or a subscription; a model switch never carries it over to the new model

Model routing, provider routing and gateways are three different things

The phrase “model router” is used for at least three different jobs.

What it decidesWhere it sitsExamples
Model routingWhich model handles this taskInside the agent, or in a gateway that reads the promptClaude Code opusplan, Copilot auto model selection and Copilot Fusion, Cursor Auto, LiteLLM Auto Router, OpenChamber Auto mode, OpenRouter Auto Router
Provider routingWhich provider or deployment serves the model you already choseIn a gatewayLiteLLM load balancing across deployments, OpenRouter provider selection
GatewayNothing by itself: one endpoint in front of many providers, with retries, fallbacks, keys and logsBetween the agent and the providersclaude-code-router, LiteLLM, OpenRouter

A gateway can do model routing, and claude-code-router, LiteLLM and OpenRouter all add fallbacks, but the core of a gateway is plumbing. LiteLLM’s load-balancing router, for example, balances requests across deployments of the same model group by weight, latency, load or cost, and moves to the next model group in its fallback list once the group’s own deployments have failed. That keeps an agent running. Deciding that a message is easy is the job of LiteLLM’s separate Auto Router add-on. It sorts each request into a tier with a heuristic scorer, an LLM, keyword rules or a decision model such as Jev, then sends it to a model from that tier.

Four ways to route

1. Static, by role. Each kind of work gets a fixed model: a strong model plans, a cheaper one implements, the cheapest one searches files. This is the easiest kind to reason about, and Claude Code and Codex both let you configure it. Claude Code’s opusplan alias uses Opus in plan mode and Sonnet for execution. Codex lets you set a separate review_model for /review and an agents.default_subagent_model for spawned agents in its config file.

2. Per message, with a classifier. Something reads each message before it is sent and picks the model. Copilot’s auto model selection in Copilot Chat on GitHub.com, Copilot Fusion, Cursor’s Auto in its Balance and Intelligence modes, OpenChamber’s Auto mode and OpenRouter’s Auto Router all work this way, with different classifiers and different goals. Amazon Bedrock’s intelligent prompt routing does the same between two models of one family. It predicts each model’s response quality for the request, and on a router you configure it leaves the fallback model only when the other is predicted to be better by a margin you set. The upside is that the model can change as the work changes. The downside is the cache.

3. Cascade and fallback. Start with the cheaper option and move up only when needed, or move to a backup when the primary fails. At the High and Max effort levels, Copilot Fusion’s cascade has an efficient model draft the answer and a judge decide whether to keep it or escalate to a stronger model. LiteLLM’s Auto Router can move a request up one tier when an agent keeps repeating tool calls or errors, once you turn stall escalation on. Claude Code switches to a fallback model when the primary is overloaded or unavailable, if you set a fallback chain with --fallback-model or fallbackModel.

4. By health, limits and quota. The model changes because something outside the task changed: a provider is degraded, a rate limit was hit, a plan ran out. In Copilot Chat on GitHub.com, Copilot’s auto model selection combines a system that tracks real-time health and availability with one that evaluates task complexity, and Copilot Fusion also weighs health and availability when it picks models. Gateways handle the same problem with retries, credential pools and ordered fallbacks. Weave says its router checks which subscription still has quota and drains the flat-rate seats you already own first. Claude Code’s fallback chain does not switch on rate-limit or billing errors, and Cursor does not downgrade a request when the weekly pool runs out.

Real setups often mix these. A session might run on a fixed model, send its subagents to a cheaper one, and fall back to a third when the first is down.

What routing breaks

The prompt cache. Agent sessions are affordable because providers cache the conversation so far. On the next turn, the part you already sent is read from cache at a fraction of the input price. On Anthropic’s API a cache read costs 5 percent of the input price on Claude Opus 5.5 and Sonnet 5.5, and 10 percent on most other models. OpenAI’s cached input is discounted by up to 95 percent.

That cache belongs to one model. It holds the model’s own computation over the conversation, which a model with different weights cannot reuse. OpenAI’s documentation notes that a different model “can use different weights and caching behavior”, and Claude Code’s documentation puts it plainly: “each model has its own cache.” Switch models mid-session and the next model reads the whole conversation as new input. In a long session that turn is the most expensive one in the bill. At 150,000 tokens a cold Opus 5.5 turn costs more than ten warm ones.

Price tiers by context length. Some cheap models are only cheap for short prompts. Claude Haiku 5.5 costs $0.10 per million input tokens for prompts up to 100,000 tokens and $0.50 above that, with output going from $0.50 to $2.50. Long agent sessions pass 100,000 tokens of context, and the cheap model is suddenly five times dearer than the price you planned with.

Context windows. A router can pick a model whose window is smaller than the conversation. Copilot Fusion shows the smallest window among the models it uses, and Claude Code leaves out fallback models with a smaller window than the primary’s when it compacts the conversation.

Behaviour between turns. Models differ in how they call tools, how much they write, and how they read instructions written for another model. History one model produced can fail on another, for example an Anthropic thinking block replayed to a non-Anthropic model or tool calls in another provider’s format, as LiteLLM’s documentation notes. A model that takes over in the middle of a task inherits a conversation it did not write. Usually this is fine. When it is not, it can show up as a turn that ignores a convention the previous model had been following.

Reproducibility. When the model changes per message, the same session replayed tomorrow may take a different path. That matters for debugging and for anyone trying to measure whether a change to their prompts helped.

Judgement about difficulty. A router has to decide how hard a task is from a message that is often two words long. “Do it” can be a typo fix or a migration. We hit exactly this in our own Auto mode.

When a router pays off: the math

The worked example uses Anthropic’s list prices on 11 November 2026. The session already has 80,000 or 150,000 tokens of context. Each turn sends 3,000 new input tokens with your message and tool results and gets 1,500 output tokens back. A warm turn reads the context from cache and writes the 3,000 new tokens to it at 1.25 times the input price. A cold turn is the first turn on a model whose cache for this conversation is empty or expired, so it writes the whole context to cache at 1.25 times the input price.

A warm turn here counts the previous answer as already cached. In practice the API writes that answer to the cache on the next request, so a real warm turn costs up to 12 percent more than the table shows. That narrows the cold-to-warm gap a little, brings the break-even counts for a long stretch on Haiku down by one or two turns and changes none of the conclusions. The router’s own price is left out too. OpenRouter adds no routing fee, Jev costs $0.042 per million input tokens with output free, and Bedrock charges $0.001 per routed request, half the cost of a warm Haiku 5.5 turn at 80,000 tokens, though its supported-models list names only Amazon Nova and Meta Llama models.

ModelPrice per MTok: input / cache read / outputWarm turn, 80K contextCold turn, 80K contextWarm turn, 150K contextCold turn, 150K context
Claude Opus 5.5$4 / $0.20 / $20$0.061$0.445$0.075$0.795
Claude Sonnet 5.5$2 / $0.10 / $10$0.031$0.223$0.038$0.398
Claude Haiku 5.5$0.10 / $0.01 / $0.50 up to 100K; $0.50 / $0.05 / $2.50 above$0.002$0.011$0.013$0.099

A cold turn costs 6 to 11 times a warm one on the same model, and the gap grows with the length of the session.

A short trip down can pay, or not, depending on context length. Take a session on Opus 5.5 and send one trivial turn to Haiku 5.5, then come back to Opus within five minutes of Opus’s last request, while its cache is still alive. At 80,000 tokens of context, those two turns cost $0.095 against $0.123 for staying on Opus, a saving of 23 percent. At 150,000 tokens the same trip costs $0.197 against $0.151, 30 percent more than not routing at all, because Haiku crosses its 100,000-token price tier and has to write the whole conversation to cache first.

The same trip to Sonnet 5.5 costs $0.306 at 80,000 tokens, against $0.123 for staying on Opus. A cold turn pays off only on a model that is many times cheaper, and below its tier Haiku 5.5 costs a fortieth of Opus 5.5 per input and output token.

A long stretch down has to earn back the trip up. If the session stays on Haiku long enough for Opus’s cache to expire, the next hard turn pays Opus’s cold price. From 80,000 tokens of context it takes about 11 cheap turns to recover that; from 150,000 tokens, about 18. Each turn adds 4,500 tokens to the context. The cold return to Opus gets dearer the longer the stretch lasts, and a session that starts at 80,000 tokens takes Haiku over its 100,000-token price tier on the fifth cheap turn.

A router that sends three easy messages down, lets Opus’s cache expire and then sends one hard message up has lost money. At 80,000 tokens it paid $0.53, against $0.25 for staying on Opus.

The same arithmetic explains why routing a subagent is nearly always a win. A subagent starts with a fresh context, so there is no warm cache to lose.

The arithmetic also explains why the cheapest lever is often to keep one model and change its reasoning effort instead. Lower effort cuts output tokens on routine work, and on current Claude models it can keep the cache. On Anthropic’s API, changing the top-level effort setting still invalidates cached messages, but on models that support per-message effort, which is in beta, the change can be sent as a system message inside the conversation and the cached prefix stays intact.

Claude Code keeps the cache on an effort change by default on Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 and later when you use an API key or a Claude subscription, unless CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS is set or the organization has a HIPAA configuration. On other models and providers it still asks before an effort change breaks a warm cache.

Supported GPT-6 and later models from OpenAI take a configuration_update item for the same purpose. OpenRouter’s coding router, Auto Code, favours a change in reasoning effort over a model switch for exactly this reason.

The worked example uses list prices and one set of assumptions. Plug in your own session length and prices, because the answer can flip, as it does for a short trip to Haiku between 80,000 and 150,000 tokens.

Routing in the agents you already use

AgentWhat it routesHow you control it
Claude Codeopusplan uses Opus in plan mode, Sonnet for execution, so each plan-mode toggle starts a fresh cache. Subagents can run on their own model. A fallback chain, if you set one, moves a turn to another model when the primary is overloaded or unavailable. At the terminal, asks you to confirm a /model switch while the cache is still warm, unless you switch to the model that wrote the last response/model and aliases (opus, sonnet, haiku, fable, opusplan, best); model in a subagent’s definition; CLAUDE_CODE_SUBAGENT_MODEL as the default for subagents, and CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 to apply it to every subagent, Explore and Plan included, except forks and subagent skills set to model: inherit; --fallback-model or fallbackModel for fallback chains; switchModelsOnFlag for safety fallbacks; /advisor or advisorModel for the advisor
CodexNo per-message routing. Separate models per rolemodel and model_reasoning_effort; review_model for /review; agents.default_subagent_model for spawned agents; profiles via --profile
CursorAuto has three modes. Cost is the classic Auto. Balance and Intelligence run Cursor Router, which classifies each request and picks the model; they are available on Teams and Enterprise plans only, and Enterprise admins have to turn the router on. On individual plans Auto is Cost only, and Plus has no AutoCost bills as a Cursor-model request from the weekly pool. Balance and Intelligence bill at the list price of the routed model, plus the Cursor Token Rate of $0.25 per million tokens when the route goes to a third-party model (models whose cache-read price is below $0.10 per million in every pricing tier are exempt)
GitHub CopilotTwo routers. Auto model selection on GitHub.com, Visual Studio, Xcode, Eclipse and Mobile; in Copilot Chat on GitHub.com one system tracks real-time system health and availability, another evaluates task complexity. Copilot Fusion in VS Code, JetBrains IDEs, Copilot CLI and the Copilot app, generally available since 28 October 2026, picks the models and the reasoning effort for each prompt. Fusion Standard runs one model per task, and High and Max can also run a cascade with a judge or a draft with critics. Fusion, and Auto in Copilot Chat on GitHub.com, route “along natural cache boundaries”Auto: tiers Efficiency, Balance, Intelligence, billed by the selected model, 10% discount on paid plans in Copilot Chat and cloud agent. Fusion: Standard on every plan, High and Max on Pro+, Max, Business and Enterprise, billed for each model it uses, no separate charge, 30% discount on paid plans through 30 November 2026
OpenChamberAuto mode: Jev, a classifier model, sorts each message into one of your categories, four built in and any you add, and the category picks the model, thinking level and agentSettings → Routing: categories, their models, a fallback model; “Try to preserve cache usage”, added in 2.2.0, on by default

Claude Code also changes models in two less obvious cases. A request a safety classifier flags on Fable, Opus 5.5, Sonnet 5.5 or Opus 5 re-runs on the fallback model for its category, and the session stays there. To be asked before each such switch, choose Ask each time in /config or set switchModelsOnFlag to false. A biology flag on Sonnet 5.5 or Opus 5 ends in a refusal, because those models have no biology fallback. A skill or command that names its own model switches the model for that turn, unless the skill runs in a subagent. The experimental advisor tool, available on the Anthropic API and Claude Platform on AWS, works differently. The main model asks a second, usually stronger model for guidance at decision points, which leaves the main cache intact, but each call reads the whole transcript uncached, billed at the advisor’s rates on the API, and on a subscription against plan limits or, for a Fable advisor on some plans, usage credits.

Copilot’s documentation names the cache problem in its description of routing, and Copilot Fusion keeps the main conversation on one model whenever possible. Claude Code’s documentation lists model and effort switches among the actions that invalidate the cache, and OpenRouter’s router keeps a session on its model unless the gain is worth a cache rebuild. LiteLLM reports that its router with caching cost 37 to 69 percent less than caching alone on one model across five datasets, and that 97.4 percent of 4,684 switch-backs on live gateway traffic still found the earlier model’s cache warm at a five-minute TTL. These are the vendor’s own benchmarks.

Routers and gateways in 2026

ToolWhat it isHow it picksCost of using it
Amazon Bedrock intelligent prompt routingA managed router on Bedrock. Its supported-models list names Amazon Nova and Meta Llama modelsPredicts response quality of two models from the same family. On a router you configure, it leaves the fallback only past a quality margin you set. Optimised for English prompts$1 per 1,000 routed requests, plus the Bedrock price of the model that answers
claude-code-routerA local gateway and control plane for coding agents, MIT, 38.1k GitHub starsYour routing rules, with retries, credential pools, key rotation and ordered fallback models. Works with Claude Code, Codex, OpenCode, Kilo Code, Pi and othersFree; you pay your providers
Jev Router by TypeSafe AIA router on OpenRouter (typesafe/jev-router) built on Jev, TypeSafe AI’s decision model. It works only in the global data region and in workspaces that allow itJev assesses the task, its difficulty and the likely benefit of a stronger model; the router weighs that against estimated cost and your cost tier, and picks the model and reasoning effort. OpenChamber uses Jev on its own to sort messages into routing categories, and Jev Builds collects what others have built with it for routingJev Router: the selected model’s rate, no routing fee. Jev on its own: $0.042 per million input tokens on OpenRouter, output free; also through TypeSafe AI or your own gateway
LiteLLMA gateway for 100+ model APIs, 63.1k GitHub starsBalances across deployments of one model group by weight, latency, load or cost; falls back to another model group on failure. The Auto Router add-on picks a model for each request from tiers you set upOpen source; you pay your providers. Some Auto Router features need a LiteLLM licence
OpenRouter Auto Router and Auto CodeModel routing inside a hosted gateway; Auto Code is the variant tuned for coding agents. The Auto Router works only in the global data regionA fast decision model rates each request (task type, difficulty, whether the task just changed, whether a bigger model or more thinking would help). The policy weighs that against live prices, cache status and benchmarks within a cost tier, low, medium or high for the Auto Router and a coding tier of its own for Auto Code, and picks both the model and the reasoning effort. It keeps a session on its model unless the gain is worth a cache rebuild. With routing metadata turned on, each pick shows up in a jev-router stageNo extra fee; you pay the chosen model’s rate
Weave RouterA proxy that picks a model for each request, made for coding agents, Apache-2.0, 5.6k GitHub stars. Its installer sets up Claude Code, Codex, Copilot, OpenCode and PiSelf-hosted, an embedding and a cluster scorer pick from the models you enable. For the hosted router Weave describes a trained complexity classifier and an escalation classifier, and says it routes down only when the saving beats the cost of rebuilding the cacheFree to self-host with your own provider keys. For the hosted router the product page quotes 5% of routed spend, and the pricing page lists plans at $10 a month with open-source models only, $100 a month with OpenAI and Anthropic models, and custom on-prem Enterprise

Research to watch

Agent-as-a-Router, a preprint on routing for coding tasks from June 2026, argues that most routers treat model choice as a one-shot classification and lack information about how models actually perform on each kind of task. Its authors report a 15.3 percent relative gain from simply giving an LLM router per-task-type performance statistics. Their router, ACRouter, learns from verified results as it goes, had the lowest cumulative regret on their benchmark of about 10,000 coding tasks with verified scores for 8 frontier models, and generalized to agentic programming tasks outside that set. It has not been peer reviewed.

What we measured building Auto mode

We built OpenChamber’s Auto mode in September 2026 and wrote up the full experiment. The short version:

  • The classifier is fast enough. Jev answers in about 250 milliseconds, so routing adds no noticeable wait to a message.
  • Short follow-ups need context. Sent on its own, “do it” came back as trivial at 57 percent confidence. With the last three turns attached, each trimmed so the excerpt usually stays under a thousand characters, it came back as implement at 95 percent. A typo fix right after a hard debugging turn stayed trivial at 100 percent. The history informs the decision without dragging everything into the expensive bucket.
  • The wording of the question mattered more than the threshold. On the same classifier we also screen auto-accepted permissions. Asking “is this action destructive?” got 23 of 31 labelled cases right. Asking “should the agent stop and ask the user before doing this?” got 28 of 31. Moving the confidence threshold anywhere from 0.5 to 0.7 changed one case.
  • Uncertain messages go to a model you chose. Below 60 percent confidence, or if Jev fails or takes longer than four seconds, the message goes to the fallback model.
  • The cache was the question we had not answered. In September Auto shipped behind a flag, off by default, and the post about it said why. A switch costs a cache miss on the next turn, and we had not measured when the saving outweighs it. The same post said switching between OpenAI models did not seem to invalidate the cache. OpenAI’s documentation lists the model among the settings that affect the cached prefix, and Auto treats a switch on any provider as a cache miss.

Auto is still opt-in. Version 2.2.0, released on 8 October 2026, added “Try to preserve cache usage”, on by default. When the classifier routes a message to a lower built-in category that runs the same agent while the current model’s cache is likely still warm, the message stays on the current model. Likely warm means within five minutes of the model’s last answer, or longer while OpenChamber or OpenCode’s cache warming keeps the session warm. Moving up to a stronger model is never held back.

For the built-in categories that rule takes the safe side of the math. While the current model’s cache is likely warm, it never pays a cold turn on a cheaper model for one easy message routed to a category with the same agent, and it never holds a hard message on a cheap one. Categories you add switch as they always did, and below Haiku’s price tier the rule also gives up the saving a short trip would bring.

A routing policy that holds up

If you are setting this up today, in roughly this order:

  1. Route subagents first. They start with an empty context, so a cheaper model costs nothing in cache. Claude Code sets a subagent’s model with model in its definition or with CLAUDE_CODE_SUBAGENT_MODEL, and Codex with agents.default_subagent_model. On its own the Claude Code variable does not change the model of the built-in Explore and Plan subagents. Set CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 as well, or override Explore with your own Explore subagent that sets model: haiku. A fork of the conversation in Claude Code is different. It runs on the main session’s model with the whole history and reads the parent’s cache, so for tasks that need the same context it costs less than a fresh subagent, but it cannot be sent to a cheaper model.
  2. Then reach for reasoning effort before another model. Lower effort on the strong model cuts output tokens for routine work. On Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 and later, Claude Code with an API key or a Claude subscription changes it mid-session without losing the cache. On older models, on Amazon Bedrock, Google Cloud’s Agent Platform or a Claude apps gateway, and with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS set or a HIPAA configuration, a change still costs a cold turn, so in those cases set the effort when the session or subagent starts.
  3. Route per message only with a cache rule. While the strong model’s cache is warm, send a single easy message down only to a model many times cheaper and only under its price tier. Move down for a long stretch of easy work, and expect to pay a cold turn when you come back up.
  4. Watch the price tiers. A cheap model with a context-length tier can be the expensive choice in a long session.
  5. Measure cost per finished task. A cheap model that needs two more turns to get it right may not be cheap. At 80,000 tokens three Sonnet 5.5 turns cost $0.09, more than one Opus 5.5 turn.

FAQ

What is model routing?

Choosing which model handles each task or message, so one session can use several models. In coding agents it is used to send easy work to cheap, fast models and hard work to the strongest ones.

What is the difference between a model router and an LLM gateway?

A model router decides which model should handle a request. A gateway is one endpoint in front of many providers that handles keys, retries, fallbacks and logs. Many gateways also route, but a gateway can work without making any decision about difficulty.

Does Claude Code support model routing?

Partly. The opusplan alias uses Opus in plan mode and Sonnet for execution, and subagents can run on their own model, which Claude can also pick for each subagent it starts.

Claude Code also switches models on its own. A fallback chain, if you set one with --fallback-model or fallbackModel, moves one turn to another model when the primary is overloaded or unavailable. A skill or command whose frontmatter names another model runs that turn on that model, unless the skill runs in a subagent. A safety classifier flag on Fable, Opus 5.5, Sonnet 5.5 or Opus 5 moves the rest of the session to the fallback model for its category. To be asked before that switch, choose Ask each time in /config or set switchModelsOnFlag to false. A biology flag on Sonnet 5.5 or Opus 5 ends in a refusal instead.

It does not pick a model per message by difficulty; gateways such as claude-code-router add routing rules in front of it.

How do I use OpenRouter with Claude Code?

Point Claude Code at OpenRouter’s Anthropic-compatible endpoint. Set ANTHROPIC_BASE_URL to https://openrouter.ai/api, put your OpenRouter key in ANTHROPIC_AUTH_TOKEN, set ANTHROPIC_API_KEY to an empty string, and run /logout once if you were signed in to an Anthropic account, as OpenRouter’s guide describes. The ANTHROPIC_DEFAULT_*_MODEL variables and CLAUDE_CODE_SUBAGENT_MODEL choose a model for each role, and setting one of them to openrouter/auto-code hands that role to OpenRouter’s coding router. Claude Code applies CLAUDE_CODE_SUBAGENT_MODEL to the built-in Explore and Plan subagents only with CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1. OpenRouter only guarantees Claude Code on Anthropic’s own provider, so routes to other models may behave differently.

Does Cursor’s Auto mode cost more than picking a model?

It depends on the mode. Cost mode, the classic Auto, bills as a Cursor-model request from the weekly pool. Balance and Intelligence, available on Teams and Enterprise, bill at the list price of whichever model each request is routed to, plus the Cursor Token Rate when that model is from a third party, unless its cache-read price is below $0.10 per million tokens in every pricing tier, the same as selecting that model directly. Cursor notes that Balance and Intelligence use up usage limits faster than Cost.

Does switching models mid-session break prompt caching?

Yes. Prompt caches belong to one model, so the first turn on a new model reads the whole conversation as fresh input. In our worked example that turn costs 6 to 11 times a warm turn on the same model. Coming back to the previous model within its cache lifetime usually still hits that model’s cache. On Anthropic’s API that lifetime is five minutes by default. Claude Code on a Claude subscription, within the plan’s included usage, keeps the main conversation’s cache for an hour, and OpenAI’s GPT-5.6 and later models keep it for at least 30 minutes, so the window to come back in is wider there.

Is model routing worth it for a small team?

Routing subagents to a cheaper model almost always is, because subagents have no cache to lose. Per-message routing in the main session needs a cache rule that sends one easy message down only to a much cheaper model and only under its price tier. Above that tier, only a long stretch of easy work earns back the cold return to the strong model.

Contents 18
Back to top