LLM Token Efficiency: Practical Routing Between Flagship and Lightweight Models
Lower LLM costs depend on more than choosing a cheaper model. This article explains how to measure cost per successful task, route workloads between flagship and lightweight models, optimize input, output, and cached tokens, and apply budgets, access controls, and regression testing without sacrificing delivery quality.
1. Redefining the Goal: From Model Capability to Cost per Task
Over the past two years, teams have largely evaluated large language models by their capability ceilings: benchmark scores, context windows, and multimodal coverage. In production, however, business stakeholders care less about how powerful a model is than about how much a defined task costs, how long it takes, and how often it needs rework.
A shared emphasis across recent model releases is particularly relevant: improving task quality while substantially reducing the tokens consumed by reasoning and output. From an engineering perspective, this shifts the optimization target from raw capability to capability density—the useful work delivered per token.
A practical evaluation formula follows:
Cost per successful task =(Input tokens × Input price+ Output tokens × Output price+ Cached input tokens × Cached input price)/ Task success rate
For this calculation, input tokens and cached input tokens should be counted separately, rather than counting cached tokens twice.
The denominator—task success rate—is easy to overlook. A cheap call chain that frequently requires three attempts can cost more than three times its advertised per-call price once user waiting time and human fallback are included. Cost reduction therefore means optimizing both the numerator and the denominator, not simply switching to a cheaper model.
2. Dividing Work Between Flagship and Efficient Models
The common pairing of a flagship model with a more efficient model is not merely a marketing distinction. It reflects different workload requirements.
Flagship models for complex projects: These suit tasks with long execution chains, multiple constraints, or cross-file dependencies. Examples include refactoring large codebases, generating professional documents that must closely follow templates, and producing frontend or 3D content with demanding completeness requirements. Such tasks typically involve large contexts, multiple reasoning steps, lengthy outputs, and low tolerance for errors.
Efficient models for everyday work: These suit frequent, short-chain tasks with relatively predictable patterns, such as rewriting text, extracting structured data, creating single-file patches, and performing initial classification of logs or support tickets. These workloads are sensitive to time to first token, have high request volumes, and contribute a substantial share of total usage despite their lower individual value.
A common architectural mistake is to use the strongest model for every request. In the measurements described here, this can leave more than 60% of calls assigned to requests that do not require deep reasoning. The better approach is task classification plus model routing, concentrating spending on the smaller set of scenarios that determine business outcomes.
3. Token Pricing: Track Three Categories Separately
Mainstream APIs commonly distinguish three token categories. Understanding them is essential to cost optimization:
- Input tokens: Prompts, system instructions, retrieved passages, and conversation history all count toward input usage. In long-context applications, these are often the largest cost component.
- Output tokens: Their unit price is often several times higher than that of input tokens, making concise responses particularly valuable.
- Cached input tokens: Repeated prefixes, such as system prompts, tool definitions, and long documents, may be billed at a much lower rate when they hit the cache. This is a major cost lever for long-context applications.
These distinctions lead to three practical rules:
- Put stable prefixes first and avoid unnecessary changes. Altering them can invalidate cache reuse.
- Constrain output formats. Use JSON Schema or fixed templates to avoid lengthy explanations.
- Rerank and deduplicate retrieved passages. Place the most relevant content toward the end where appropriate to take advantage of attention behavior, while reducing irrelevant tokens.
4. Practical Cost-Reduction Techniques
- Compress prompts. Remove repeated courtesy phrases and obsolete instructions, and turn long paragraphs into concise constraints. This can often reduce input tokens by 20–40% without degrading results.
- Trim context and use layered summaries. Have a smaller model summarize long documents before sending the summaries, rather than the full documents, to the flagship model. For multi-turn conversations, combine a sliding window with retained key conclusions.
- Reuse cached prefixes. Group unchanged system prompts, tool schemas, and coding standards into a stable prefix.
- Enforce structured output. Define the output through a schema rather than allowing unrestricted prose.
- Use batching and asynchronous processing. Route non-real-time work through asynchronous queues and batch interfaces to improve throughput and reduce unit costs.
- Escalate quickly after failures. If the smaller model fails twice, switch to the flagship model instead of repeatedly retrying low-value requests.
The following pseudocode illustrates routing and token-budget controls. It is independent of any vendor SDK:
def dispatch(task):# 1. Classify the task by context size and constraint complexityif task.token_estimate > 60_000 or task.requires_multi_step:model, budget = "flagship", {"in": 120_000, "out": 8_000}else:model, budget = "efficient", {"in": 16_000, "out": 1_500}# 2. Put stable prefixes first to improve cache hit ratesmessages = [stable_system_prefix, task.tool_schema] + task.context# 3. Enforce the token budget: trim first, then decide whether to escalateif count_tokens(messages) > budget["in"]:messages = compress_and_truncate(messages, budget["in"])model = "flagship" if task.is_critical else "efficient"resp = call_model(model, messages, max_tokens=budget["out"],response_format=task.schema)metrics.record(model, resp.usage, task.is_critical)return resp
5. Availability and Access Governance
Model launches often expand access across individual subscriptions and team, enterprise, and education workspaces, with different entry points for each. High-speed modes may be restricted by subscription tier, while enterprise and education workspaces may require explicit administrator enablement. These arrangements depend on the provider and plan; they should not be treated as universal availability.
Enterprise deployments need corresponding governance:
- Least-privilege access: Grant access by project rather than automatically inheriting it through individual accounts, especially for higher-cost model tiers.
- Quotas and alerts: Set token budgets and over-budget circuit breakers for each business unit. Combine monitoring and alerts with retained invocation audit logs.
- Cost attribution: Require business identifiers in request logs so spending can be broken down by team, use case, and customer.
- Data boundaries: Define which data may enter external model workflows and mask sensitive fields at the gateway.
6. Evaluation: Quality and Cost Regression Testing
Scores alone can be misleading. Build a two-dimensional evaluation matrix with task success rate on the horizontal axis and cost per successful task on the vertical axis. Run a fixed regression suite whenever a model or prompt changes.
The evaluation should include:
- A benchmark set: Cover multi-step professional tasks such as document generation, code changes, and data analysis. Track first-pass success rate and average retry count.
- Cost and operational metrics: Measure tokens consumed per successful task, cache hit rate, and P95 latency.
- Human spot checks: Review dimensions that are difficult to quantify automatically, including template adherence, coding-style consistency, and output completeness.
In practice, optimizing prompts and routing can produce greater cost reductions than simply switching to a cheaper model, while preserving task success rates.
7. Conclusion
The important signal from new model releases is not a single benchmark score. It is the growing emphasis on token efficiency and cost per successful task.
For developers, the practical response is to build an engineering feedback loop around task classification, model routing, cache reuse, token-budget enforcement, and quality-versus-cost evaluation. Reserve flagship capability for the critical paths that determine success, and assign frequent, lower-value requests to efficient models. This approach supports lower costs, faster responses, and more consistent delivery quality.
