Token Cost Optimization for Tiered Multi-Model Routing

    This article presents a practical method for estimating the relative token costs of models at different capability tiers from measured usage data, and for designing a tiered routing strategy in which high-capability models handle planning and review while lower-cost models handle execution and batch workloads. It covers cost decomposition across input, output, and cached tokens; capacity estimation under token quotas or usage-based billing; routing rules and pseudocode; caching and context governance; implementation steps; and key risks. Readers can use the approach to build a cost model that is explainable, monitorable, and iteratively improvable without sacrificing quality on critical paths.

    Token Cost Optimization for Tiered Multi-Model Routing

    In large language model applications, cost is often not determined by the price of a single call alone. It is also shaped by input length, output length, cache hit rate, task complexity, retry count, and routing strategy. Many teams initially send every request to the most capable model to keep results consistent. As call volume grows, the bill quickly exposes the problem: high-value tasks such as planning, review, and summarization need strong models, but classification, extraction, formatting, and batch summarization do not require the same level of capability. Without tiered scheduling, token costs are amplified by a large number of low-complexity requests.

    This article addresses a general technical problem: in a token quota or usage-based billing environment, how to infer the relative costs of models at different capability tiers from measured data, and how to design a tiered calling approach in which high-capability models handle planning and review while low-cost models handle execution and batch processing. The parameters below are method examples only and do not represent any vendor’s official price list. Actual rules should follow the platform in use.

    1. The Nature of Cost Differences: Input, Output, and Cache

    Token cost can usually be broken into three parts: the input unit price, the output unit price, and the input unit price after a cache hit. Let a model’s normal input unit price be p_in, its output unit price be p_out, and its cache-hit input unit price be p_cache. The cost of one request can then be approximated as:

    1. cost = input_tokens × p_in × (1 - h) + input_tokens × p_cache × h + output_tokens × p_out

    Here, h is the cache hit rate. If cache is not considered for now, the formula simplifies to:

    1. cost = input_tokens × p_in + output_tokens × p_out

    The unit prices of models at different capability tiers may differ by one or two orders of magnitude. For example, in measured samples, the output cost of a high-capability tier model may reach the hundredfold level of a lightweight tier model. After a cache hit, input cost may fall to a very small proportion of the normal input cost. Cost optimization cannot focus only on input unit price, because output unit price is usually higher, and long-output tasks significantly amplify the difference.

    2. Inferring Relative Unit Prices from Measured Data

    If a platform does not directly expose a complete price list, or if quotas are measured in a unified unit such as credits, actual call records can be used for linear fitting. Collect the input tokens, output tokens, cache-hit tokens, and actual quota consumed for each request, then establish the equation:

    1. q_i = a × in_i + b × out_i + c × cache_i + ε_i

    Here, q_i is the consumption of the i-th request; a, b, and c are the unit consumption coefficients for input, output, and cache hits, respectively; and ε_i is the residual. Solve the equation using least squares, and check the goodness of fit and residual distribution. If the samples cover different lengths and task types and the residuals are close to zero, the metering model is basically valid. Out-of-sample validation is still needed to avoid overfitting.

    The inferred results can answer three questions: first, the relative cost multiples of models at different tiers; second, the impact of cache hits on actual cost; and third, the token capacity each model can support under a given quota.

    3. Capacity Estimation: From Quota to Processable Token Volume

    Let the quota for a given period be Q, and let the workload structure have an input share r_in and an output share r_out, where r_in + r_out = 1. The average cost per token is:

    1. avg_cost = r_in × p_in + r_out × p_out
    2. capacity ≈ Q / avg_cost

    If the cache hit rate h is considered, the effective input unit price is:

    1. p_in_eff = (1 - h) × p_in + h × p_cache

    Take an example of 80% input and 20% output, without counting cache for now. Capacity is mainly affected by the output unit price. A high-capability model has a high output unit price and is suitable for a small number of critical tasks. A lightweight model has a low unit price and is suitable for large-volume, low-risk tasks. After tiering, total cost is not a simple average; requests are allocated to tiers with lower marginal cost.

    4. Tiered Routing Strategy: Match Capability to the Task

    In practice, a four-layer structure can be used:

    1. High-capability model: planning and final review
      Used for task decomposition, solution design, complex constraint reasoning, and final quality review. The number of calls should be small, input should be concise, and output should follow a clear format to avoid lengthy free-form text.

    2. Mid-tier model: complex reasoning and multi-step processing
      Used for tasks that require some reasoning capability but do not need the highest tier, such as multi-condition judgment, validation after structured extraction, and complex question answering.

    3. General execution model: primary execution
      Used for most routine generation, rewriting, summarization, code snippet generation, and tool-call parameter construction. These tasks are high in volume, so cost-controllable models should be preferred.

    4. Lightweight model: batch simple tasks
      Used for classification, labeling, formatting, short summaries, deduplication, simple intent recognition, and similar tasks. Batch processing and caching can further reduce cost.

    Routing decisions should not be overly complex. Rule-based routing can use task type, input length, output length limit, error cost, SLA, and cache likelihood. Keep canary rollout and fallback for boundary samples. Pseudocode:

    1. function choose_model(task):
    2. if task.requires_planning or task.requires_final_review:
    3. return high_capability_model
    4. if task.complexity > threshold_high:
    5. return mid_reasoning_model
    6. if task.is_batch_simple and task.max_output_tokens < small_limit:
    7. return light_model
    8. return general_execution_model
    9. function estimate_cost(model, input_tokens, output_tokens, cache_hit_rate):
    10. p_in = model.input_price
    11. p_out = model.output_price
    12. p_cache = model.cache_price
    13. effective_input = input_tokens * ((1 - cache_hit_rate) * p_in + cache_hit_rate * p_cache)
    14. return effective_input + output_tokens * p_out

    5. Caching and Context Governance

    Caching is a high-leverage way to reduce cost. Common practices include stable prefix reuse, fixed system prompts, cached summaries of long documents, cached results for repeated questions, and merged requests for batch processing. Cache invalidation strategy needs attention: when context changes frequently or results are time-sensitive, the cache hit rate will decline, and the cost model must be recalibrated. For long-context tasks, summarize and compress first and process in segments to avoid repeatedly sending irrelevant content to high-cost models.

    6. Implementation Steps and Governance

    A five-step implementation is recommended. First, establish a call-log baseline that records input, output, cache, and task type. Second, use regression methods to infer relative unit prices and validate them. Third, design tiered routing rules and start with a small canary traffic share. Fourth, monitor cost per task, failure rate, retry rate, and quality metrics. Fifth, set budget alerts and automatic degradation strategies. In governance, avoid looking only at unit price without considering quality, and avoid batch calls to high-cost models caused by routing misclassification.

    7. Risks and Conclusion

    The boundaries of this method are that price rules may change, cache hit rates may fluctuate, task complexity is difficult to fully rule-ize, and out-of-sample fitting may be distorted. Therefore, the cost model should be recalibrated regularly, and human review and fallback mechanisms should be retained. The overall idea can be summarized as follows: high-capability models think, low-cost models execute; critical paths ensure quality, and batch paths control cost. Through measured inference, capacity estimation, tiered routing, and cache governance, teams can establish an explainable, monitorable, and iteratively improvable balance between quality and cost.