Model routing per task complexity beats prompt trimming because it changes the per token price tier rather than nibbling at token count.
Imagine you have a team of engineers and you send every task to the most senior one. Of course your wage bill is high. The fix is not to ask the senior to type fewer words. The fix is to send the simple tickets to a junior who costs a fraction as much and only escalate the hard ones. LLM apps work the same way. Send simple tasks like classification or extraction to a cheap, fast model, and keep the flagship for tasks that need it. That cuts the bill by half or more, long before you start arguing over which word in the system prompt to delete.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Cost on a production LLM app is one of those problems where the first instinct is usually wrong. The instinct is to look at the prompt, count tokens, and start trimming. That work is real, but it comes last. Most of the savings live in which model the request hits and how much of the prompt is reused across requests.
The logic applies to an app spending around ten thousand dollars a month, and it scales up and down. The structure of LLM pricing is multiplicative: cost is the product of token count and per token price, summed across traffic. Token count moves by maybe a third under aggressive trimming. Per token price moves by a factor of five to fifteen across model tiers. The math forces a clear order of operations.
The math behind the order of operations
Total cost can be written as sum over traffic of (tokens_in * price_in + tokens_out * price_out). Each of the four factors is a lever. Most teams instinctively pull tokens_in first by editing the system prompt, because that is the lever they own most directly.
The problem is that the range of tokens_in is bounded. A well-written system prompt is already a few hundred tokens. You might cut it in half with effort. That is a fifty percent cut on those tokens, and a smaller cut on total input once you count user messages and retrieved context. The range of price_in is much larger: flagships price at roughly five to fifteen times their smaller siblings, sometimes more for the deepest tiers. Moving a workload one tier down is a five to fifteen times reduction on those tokens.
This math is why the order of operations is price, repetition, count. Pull the lever with the largest range first.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- Anthropic's prompt caching bills cache reads at a tenth of the base input price on most Claude models (less on some newer ones), which changes the economics of agent loops with long stable prefixes.
- OpenAI applies prompt caching automatically on supported models and discounts cached input tokens by up to 95 percent, so a stable system prompt and tool list get cheaper with no routing change.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you build a request-complexity router?
Start with cheap heuristics (length, code presence, format); add a small classifier or LLM judge on hard slices; instrument escalation rates and quality deltas.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Starting cost work by trimming the system prompt token by token, when the dominant multiplier is the per token price of the flagship model you are still sending every request to.
60 second bullets to scan on the way to the call.
Why model price is multiplicative vs token count
How to design a request-complexity classifier
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.