Multi-Tier LLM Routing: Token Cost Accounting and Budget Management in Practice
When a single large language model cannot simultaneously meet quality, latency, and cost requirements, teams often turn to multi-model collaboration: stronger models handle planning and review, while cheaper models handle execution and batch tasks. This article presents a practical, quantifiable approach to governing that setup—building a mixed cost model that accounts separately for input, output, and cached tokens, back-fitting per-tier consumption rates from billing data, and implementing tiered routing, budget guardrails, and observability. It also covers the boundaries and risks of the method, including why back-fitted parameters should never be treated as a permanent price list.
Multi-Tier LLM Routing: Token Cost Accounting and Budget Management in Practice
1. Background: Multi-Model Collaboration Is Not Just Throwing More Models at the Problem
In scenarios such as AI agents, AI-assisted coding, and batch document processing, a single model often struggles to satisfy quality, latency, and cost requirements at the same time. A common approach is multi-model collaboration: let a more capable model handle planning, review, and complex reasoning, while cheaper models handle execution, extraction, classification, summarization, and other simple batch tasks. The idea itself is sound, but once it lands in production, a core question quickly emerges: where is the token budget actually being spent, how large are the cost differences between model tiers, and how should a limited budget be allocated to the most appropriate tasks?
Choosing models based on intuition alone typically produces two kinds of waste. First, high-value tasks get processed by cheap models, leading to rework and repeat calls that inflate total cost. Second, simple tasks get processed by expensive models—the per-call cost looks acceptable, but batch runs burn through the budget rapidly. Multi-model collaboration must therefore be built on a quantifiable cost model, not on the simplistic rule of “expensive model thinks, cheap model works.”
This article discusses a general method: use billing credits or quota consumption as the observable metric, back-fit the consumption rates for input, output, and cached tokens across model tiers, and then combine task tiering, routing strategies, budget guardrails, and observability metrics into a reusable cost governance framework. Note that this article does not target any specific vendor’s pricing; all numbers are for demonstration only, and actual rules should be based on your platform’s billing system and official documentation.
2. The Cost Model: Input, Output, and Cache Must Be Accounted Separately
LLM call costs cannot be judged by the “price per million tokens” alone. At minimum, three categories should be tracked separately: input token consumption, output token consumption, and the input token consumption after cache hits. Across different model tiers, output cost is often significantly higher than input cost, and a cache hit can reduce the input cost of a stable prefix dramatically. Estimating with a single blended price easily underestimates the real differences between long-output tasks and high-cache-hit tasks.
A general mixed cost model can be written as:
Credits per million blended tokens =normal input ratio × input unit cost+ cached input ratio × cache unit cost+ output ratio × output unit cost
Here, “unit cost” refers not to currency but to platform credits, quota, or allowance units. In real engineering, you should also account for amplification factors such as retries, failed calls, tool-call round trips, and repeatedly carried context. The following is an illustrative estimation function; the numbers only demonstrate the method and do not represent any real product pricing:
from dataclasses import dataclass@dataclassclass ModelCost:input_credits_per_m: float # credits per million input tokens, example valueoutput_credits_per_m: float # credits per million output tokens, example valuecache_credits_per_m: float # credits per million cache-hit input tokens, example valuedef mixed_credits_per_million(cost: ModelCost,input_ratio: float = 0.8,output_ratio: float = 0.2,cache_hit_ratio: float = 0.0,) -> float:"""cache_hit_ratio is the fraction of input tokens that hit the cache.This function is for budget estimation only and does not replace platform billing."""normal_input_ratio = input_ratio * (1.0 - cache_hit_ratio)cached_input_ratio = input_ratio * cache_hit_ratioreturn (normal_input_ratio * cost.input_credits_per_m+ cached_input_ratio * cost.cache_credits_per_m+ output_ratio * cost.output_credits_per_m)def token_capacity(budget_credits: float,cost: ModelCost,input_ratio: float = 0.8,output_ratio: float = 0.2,cache_hit_ratio: float = 0.0,) -> float:per_m = mixed_credits_per_million(cost, input_ratio, output_ratio, cache_hit_ratio)return budget_credits / per_m * 1_000_000
The value of this code lies not in the specific parameters, but in turning “how many tokens can this budget buy” into a computable, comparable, and auditable process. Teams can maintain different input/output ratios and cache hit rates for different task types to obtain capacity estimates that better reflect reality.
3. Measurement Method: Back-Fitting Consumption Rates from Billing Credits
If the platform does not expose fine-grained pricing per model, or if pricing rules change, you can back-fit from historical billing data. The basic approach: collect call records over a period, capturing input tokens, output tokens, cache-hit tokens, the model tier, and the final credit consumption per call; then fit the per-component consumption rates with linear regression. If the sample coverage is sufficient and the call structure is stable, the in-sample fit can be very good—for example, an R² close to 1 with small residuals.
However, three caveats deserve clear-headed attention. First, back-fitted results are not an official price list—they only explain the historical sample and cannot guarantee that future rules will not change. Second, a high goodness of fit does not guarantee reliable extrapolation; changes in input/output ratios, cache hit rates, retries, and failed calls all break the original assumptions. Third, token structures vary widely across task types—long-document summarization, code generation, multi-turn conversations, and batch classification have completely different output ratios—so a single average cannot cover all scenarios.
Back-fitted results should therefore be treated as “internal budget parameters” with a safety margin built in. Recommended practices: refresh the sample monthly, keep at least 10%–20% of the budget as reserve, model critical business lines separately, and version-control the fitted parameters along with their data sources, sample windows, and applicable scope. That way, when platform rules change, budget deviations can be quickly traced.
4. Tiered Routing Strategy: Route by Task Value, Not Just Price
The essence of multi-tier model routing is not “queue models from cheapest to most expensive,” but routing by task value, quality thresholds, latency requirements, and cost sensitivity. A common four-tier strategy is as follows:
- High-value planning and final review tier: responsible for requirement decomposition, solution planning, risk review, and final quality gatekeeping. Calls are infrequent but each carries high value, so quality comes first and more expensive models are acceptable here. The key is “thinking it through” and “reviewing properly,” not mass production.
- Complex reasoning tier: responsible for multi-step reasoning, complex code modifications, and difficult problem analysis. This tier needs strong capability, but costs can be controlled by limiting context, reducing unnecessary round trips, and requiring structured output.
- Main execution tier: responsible for routine code generation, document processing, information extraction, and tool-call orchestration. Call volume is high, so choose a model with a good cost-quality balance, and lower unit costs through caching, batching, and retry policies for failures.
- Batch simple-task tier: responsible for classification, tagging, format conversion, short summaries, and simple Q&A. This tier is most cost-sensitive; lightweight models work, with quality assured through concurrency control, result validation, and sampled review.
For routing, a “static rules + dynamic feedback” approach is recommended. Static rules determine the initial model based on task type, risk level, input length, output length limits, and cache hits; dynamic feedback adjusts routing thresholds based on success rate, rework rate, manual review results, and budget burn rate. The following is illustrative pseudocode:
def route_task(task, budget_guard, metrics):if budget_guard.should_block():raise RuntimeError("Budget hard limit triggered; degrade or enter a waiting window")if task.risk_level == "high" or task.need_final_review:return "premium_review_model"if task.complexity == "high" or task.requires_multi_step_reasoning:return "reasoning_model"if task.is_batch_simple and metrics.quality_ok("light_model", task.type):return "light_model"return "executor_model"
This pseudocode reflects two principles: budget guardrails take priority over any individual task, and quality feedback participates in routing decisions. Cheap models are not used unconditionally—they must prove acceptable quality on specific tasks through sampled evaluation.
5. Engineering Implementation: Caching, Batching, Budget Guardrails, and Observability
Cost optimization cannot rely on model selection alone; engineering measures must support it.
Caching strategy: cache stable system prompts, fixed tool descriptions, repeated document prefixes, and common knowledge snippets. Cache hits presuppose that content is stable and reusable, so prompts should be split into a “stable prefix + dynamic variables” structure rather than changing the entire context on every call. Caching also requires attention to invalidation and consistency: caches should be invalidated promptly when documents are updated, and sensitive information should never enter shared caches.
Batching and asynchrony: batch simple tasks should be made asynchronous and batched as much as possible to reduce the fragmented overhead of real-time calls. For latency-tolerant tasks, merge requests, limit concurrency, spread execution across off-peak windows, and smooth consumption within the budget window.
Budget guardrails: set soft limits and hard limits by hour, day, and week. Soft limits trigger alerts and downgrade recommendations; hard limits trigger circuit breaking, queuing, or switching to a cheaper tier. Guardrails should be tied to task priority, reserving a separate quota for critical tasks so batch jobs cannot crowd out core business budgets.
Observability and cost attribution: at minimum, log task type, model tier, input tokens, output tokens, cache-hit tokens, credit consumption, latency, success rate, and rework rate. Perform cost attribution by business line, task type, and model tier, and regularly report “cost per successful task” rather than “cost per call.” The latter ignores rework; the former is closer to true economics.
At the infrastructure level, these capabilities can be implemented with common cloud services such as logging, monitoring and alerting, object storage, message queues, and container platforms. Whether self-hosted or using off-the-shelf cloud offerings, the key is putting cost metrics and quality metrics into the same observability system.
6. Risks and Boundaries: Don’t Treat Back-Fitted Parameters as a Permanent Price List
This method has clear boundaries. First, back-fitted parameters depend on historical samples; recalibration is required after platform rules, model versions, or rate-limiting policies change. Second, the input/output ratio is a critical variable in the estimate—cost differences between long-output tasks and high-cache-hit tasks are significant, so modeling must be done per scenario. Third, a higher cache hit rate is not always better; inconsistent or stale cached content can introduce quality risks. Fourth, the quality of cheap models on batch tasks needs sampled validation—rework costs can erase any unit-price advantage. Fifth, budget guardrails must do more than “block”; they need degradation paths, queuing, retry limits, and manual fallback to avoid disrupting business continuity.
7. Conclusion
The right way to do multi-tier model routing is to upgrade “expensive models think, cheap models work” into a quantifiable cost governance system: build a component-level cost model by back-fitting from billing data, match quality and cost through task tiering and routing strategies, and control actual consumption with caching, batching, budget guardrails, and observability metrics. Back-fitted results should be treated as internal budget parameters rather than official prices, and must be continuously recalibrated with a safety margin. Only then can teams ensure the quality of critical tasks while spending a limited token budget where it truly generates value.
