Multi-Model Token Cost Tiering and Routing Optimization: A Practical Engineering Guide

    This article explains how to model token costs across multiple model capability tiers, infer per-request cost coefficients from billing data, estimate throughput under a budget, and route tasks by complexity, risk, quality, and budget. It also covers caching, context and output control, fallback, and observability for sustainable cost governance.

    1. Background: Multi-Model Cost Differences Are Not Just About Unit Price

    In systems that increasingly integrate multiple models, teams often use models at different capability tiers at the same time: high-capability tiers handle complex planning, critical review, and difficult reasoning; medium tiers handle general complex tasks; low-cost tiers handle the main execution workload and high-volume simple tasks. The problem is that many teams compare only the “price per million tokens” when evaluating cost, while ignoring three key variables in real business workloads: input-to-output ratio, cache hit ratio, and task failure and retry ratio. As a result, budget estimates often deviate significantly from actual bills.

    A more reasonable approach is to treat cost as an engineering problem that is observable, inferable, and routable. Let the input tokens for a request be Tin, output tokens be Tout, cache hit tokens be Thit, and the corresponding credit consumption rates per million tokens be Rin, Rout, and Rhit. Then the cost of a single request can be expressed as:

    1. C = (Tin * Rin + Tout * Rout + Thit * Rhit) / 1_000_000

    If the business workload is mainly 80% input and 20% output, and cache is not considered for now, the average cost per million tokens is:

    1. C_avg = 0.8 * Rin + 0.2 * Rout

    Under the same budget B, the approximate token volume that can be processed is B / C_avg. Because the output cost of models at different capability tiers may be several times the input cost, while the cache hit cost of a low-cost tier may be significantly lower than the normal input cost, final throughput can differ by orders of magnitude. Therefore, cost optimization cannot stop at “choosing a cheaper model.” It should establish a systematic solution of “cost model + task tiering + routing policy + observability loop.”

    2. Deriving Cost Coefficients from Request-Level Billing

    To understand real cost, you first need request-level or batch-level usage records. Recommended fields include: capability tier identifier, input tokens, output tokens, cache hit tokens, credit consumption, request time, task type, retry flag, quality score, and similar fields. Then build a linear fitting model for each tier:

    1. credit consumption ≈ a * input tokens + b * output tokens + c * cache hit tokens + residual

    Here, a, b, and c can be normalized into consumption rates per million tokens. After fitting, check the goodness of fit and residual distribution: if the goodness of fit is close to 1 and residuals are small, the cost basis is basically stable; if residuals are large, investigate whether there are tiered pricing rules, time-of-day differences, batch discounts, cache rule changes, or insufficient sample coverage.

    Note that these inferred results come from actual usage records, not from any platform’s official price list, and subsequent rules may change. In engineering practice, cost coefficients should therefore be treated as “versioned configuration” and refitted periodically, rather than hard-coded in the application. Below is a desensitized configuration example for illustrating the method only; it does not represent any specific platform’s pricing:

    1. {
    2. "tier_high": {"input": 1.00, "output": 5.00, "cache": 0.05},
    3. "tier_medium": {"input": 0.40, "output": 1.40, "cache": 0.04},
    4. "tier_fast": {"input": 0.05, "output": 0.10, "cache": 0.001},
    5. "tier_batch": {"input": 0.025,"output": 0.025,"cache": 0.001}
    6. }

    These values are only relative coefficient examples, used to demonstrate the general patterns that “output cost is usually higher than input cost, cache hits can significantly reduce cost, and different tiers differ by orders of magnitude.” Real systems must rely on their own billing fitting results.

    3. From Budget to Throughput: Building an Explainable Estimation Model

    Let the input cost rate of a capability tier be Rin, the output cost rate be Rout, the cache hit cost rate be Rhit, the input share be p, the output share be 1-p, and the cache hit share of input be h. Then the average cost per million tokens can be written as:

    1. C_avg = p * (1-h) * Rin + p * h * Rhit + (1-p) * Rout

    Under budget B, the approximate number of processable tokens is:

    1. N ≈ B / C_avg * 1_000_000

    The value of this model is that it breaks down “whether a model is expensive” into “how much input, how much output, how many cache hits, and how many retries.” For example, high-capability tiers are suitable for low-concurrency, high-value planning and review tasks; even if the unit cost is high, they can amortize total cost by reducing rework. Low-cost tiers are suitable for high-volume simple tasks, but if unstable output quality increases the retry rate, the actual cost may be higher than the nominal estimate. Therefore, routing policies must consider unit cost, task success rate, and rework cost at the same time.

    4. Tiered Routing: High-Capability Models Think, Low-Cost Models Execute

    The core of tiered routing is not fixed assignment by model name, but dynamic selection of capability tiers based on task complexity, risk level, quality threshold, and budget constraints. The following strategy can be used:

    1. High-capability tier: planning, decomposition, and final review. Use for requirements analysis, solution design, critical code review, complex fault localization, and other low-token but high-value tasks. Its cost share should be controlled, but quality in critical steps should not be reduced simply to save money.
    2. Medium-capability tier: complex reasoning and difficult fallback. Use for multi-step reasoning, cross-file understanding, general review, and similar tasks. When the confidence of the low-cost tier is insufficient or the quality score is below the threshold, fall back to the medium or high tier.
    3. Low-cost workhorse tier: execution and generation. Use for routine code generation, document rewriting, structured extraction, batch classification, and other high-frequency tasks. It should be combined with context trimming, output length limits, and cache reuse.
    4. Ultra-low-cost tier: batch simple tasks. Use for formatting, label cleaning, simple summarization, and rule-defined batch processing. Quality sampling and failure fallback must be set to avoid the hidden cost of “cheap but reworked.”

    A general routing pseudocode is as follows:

    1. function route(task):
    2. score = estimate_complexity(task)
    3. risk = estimate_risk(task)
    4. budget_ok = check_budget(task.tenant, task.project)
    5. if risk == "high" or score > HIGH_THRESHOLD:
    6. tier = "tier_high"
    7. else if score > MEDIUM_THRESHOLD:
    8. tier = "tier_medium"
    9. else if task.batch_size > BATCH_THRESHOLD:
    10. tier = "tier_batch"
    11. else:
    12. tier = "tier_fast"
    13. if not budget_ok and tier == "tier_high":
    14. tier = "tier_medium"
    15. mark_degraded(task)
    16. result = invoke(tier, task)
    17. record_cost_and_quality(task, tier, result)
    18. if result.quality < QUALITY_THRESHOLD:
    19. result = invoke("tier_medium", task)
    20. record_fallback(task, tier, "tier_medium")
    21. return result

    This pseudocode reflects three principles: high-risk tasks prioritize quality; batch tasks prioritize low cost; when budget is insufficient, degradation is allowed but must be recorded; when quality does not meet the threshold, fallback is allowed but the fallback rate must be observed.

    5. Caching, Context, and Output Control Are the Second Front in Cost Optimization

    In many business workloads, input tokens are far higher than output tokens, so caching and context governance have a major impact on cost. Practical measures include: cache and reuse stable prefixes; cache results for repeated queries; use segmented retrieval for long documents instead of full concatenation; set maximum output length and structured constraints; merge requests for batch tasks; and set upper limits and backoff policies for failed retries. Caching must address correctness isolation: data from different tenants, different permissions, and different versions must not share caches; semantic caching also needs similarity thresholds and invalidation policies.

    6. Observability and Governance: Make Cost Measurable, Reversible, and Evolvable

    Recommended metrics include: average cost per task, cost per thousand tokens, cache hit rate, fallback rate, retry rate, quality score, budget burn rate, and call share by tier. Perform multi-dimensional analysis by project, tenant, and task type, and set budget alerts and anomaly spike alerts. Every adjustment to routing rules or cost coefficients should be canary released, and quality and cost changes should be compared. If platform billing rules change, cost coefficients should be refitted and the configuration version upgraded.

    7. Conclusion

    The essence of multi-model cost optimization is systems engineering: first infer input, output, and cache costs from request-level billing; then estimate throughput with a budget model; finally form a closed loop through tiered routing, cache reuse, quality fallback, and observability governance. High-price models handle planning and review, while low-cost models handle main execution and batch processing. This is an explainable and practical engineering strategy. However, any inferred data should be treated as a versioned empirical basis rather than an official price list. Only continuous observation and periodic refitting can maintain a stable balance between quality and cost.