LLM Token Cost Benchmarking and Tiered Routing in Practice

    This article breaks down how to measure real LLM token consumption rates from usage logs using least-squares regression, convert credit quotas into token budgets across model tiers, and design a tiered routing strategy that assigns high-cost models to planning and review while low-cost models handle bulk execution. It also covers prefix caching, budget circuit breakers, quality gates, and observability needed to keep costs predictable without sacrificing output quality.

    1. Why a Cheap Unit Price Doesn’t Mean a Cheap Bill

    When you run several large language model services at once, the most common mistake is comparing only the price per million tokens while ignoring three decisive variables: the input-to-output ratio, the cache hit rate, and the difficulty distribution of the tasks themselves. A model with a higher output price may contribute less to the total bill than a very cheap model if it only handles a small amount of high-value planning and review work, while the cheap model is used for massive volumes of simple tasks.

    So the right starting point for cost governance is not the price list but the actual call logs. The core method in this article is to fit real usage records with least squares, back out the per-token consumption rate for each class of model, and then build a budget model and routing policy on top of that.

    2. Method: Backing Out Unit Consumption Rates from Real Records

    Let C be the credit consumption in a given time window, x_i the input tokens and y_i the output tokens for model class i:

    1. C = Σ (a_i * x_i + b_i * y_i) + e

    Here a_i and b_i are the unknown input/output consumption rates and e is the error term. As long as you collect enough samples of (C, x_i, y_i) across different windows, you can solve this with ordinary linear regression.

    Illustrative implementation:

    1. import numpy as np
    2. # rows: one per stats window; cols: [model A in, model A out, model B in, model B out, ...]
    3. X = np.array([
    4. [820000, 180000, 1500000, 300000],
    5. [610000, 240000, 980000, 410000],
    6. [1050000, 150000, 2200000, 260000],
    7. ], dtype=float)
    8. C = np.array([186000, 172000, 265000], dtype=float)
    9. coef, *_ = np.linalg.lstsq(X, C, rcond=None)
    10. pred = X @ coef
    11. r2 = 1 - ((C - pred) ** 2).sum() / ((C - C.mean()) ** 2).sum()
    12. print(coef, r2, (C - pred).max())

    With enough collection windows and a consistent token accounting definition, the goodness of fit can approach 1 and the residuals approach 0. That means billing is almost a linear function of tokens, so cost can be modeled precisely — the prerequisite for every optimization that follows.

    Three engineering caveats: input and output must be counted separately; cache hits need their own column, otherwise two different prices get merged into one coefficient; and the sample windows must cover both peaks and troughs, or collinearity will make the coefficients unstable.

    3. The Scale Gap: Consumption Rates Across Model Tiers

    Fitting with the method above, the models on the market can be roughly grouped into four cost tiers (in “credits per million tokens”, order-of-magnitude illustration only):

    Tier Input Output Cache hit
    Flagship reasoning ~80,000 ~400,000 depends on the rules
    Balanced ~32,000 ~112,000 depends on the rules
    Fast ~4,000 ~8,000 ~80
    Lite ~2,000 ~2,000 ~80

    Two key takeaways:

    • The output-to-input price gap can reach about 5x, and the flagship tier’s output cost can be roughly 200x that of the lite tier. Letting an expensive model write one more paragraph is the most expensive operation there is.
    • A cache hit can push input cost down to a few percent of normal, which is the biggest lever for long-context scenarios with repeated prefixes (system prompts, codebase context, spec documents).

    4. Budget Conversion: Turning a Credit Quota into a Token Allowance

    Let Q be the window quota, p the input share and 1-p the output share. The total usable tokens are roughly:

    1. Tokens ≈ Q / (p * a + (1 - p) * b)

    With p = 0.8 and a weekly quota of 600,000 credits, plugging in the four tiers above (ignoring cache for now) gives approximate allowances:

    • Flagship reasoning: ~417,000 tokens / 5 hours
    • Balanced: ~1.25 million tokens
    • Fast: ~12.5 million tokens
    • Lite: ~30 million tokens

    The same quota buys nearly two orders of magnitude more tokens depending on the tier. That is why “send every request to the strongest model” is not sustainable on a budget.

    5. Tiered Routing: Expensive Models Think, Cheap Models Do

    Grading tasks by “reasoning depth” is the core cost governance strategy:

    1. Planning and final review (flagship): task decomposition, approach selection, code review, risk backstop. Small token volume, highest value density.
    2. Complex reasoning (balanced): cross-file refactoring, tricky defect localization, algorithm derivation.
    3. Main execution (fast): routine coding, test generation, documentation writing — the bulk of total volume.
    4. Batch simple tasks (lite): format conversion, field extraction, batch summarization, log categorization.

    The routing layer can be a rule engine, for example:

    1. def route(task):
    2. if task.risk == "high" or task.needs_review:
    3. return "flagship"
    4. if task.complexity >= 3:
    5. return "balanced"
    6. if task.batch and task.complexity <= 1:
    7. return "lite"
    8. return "fast"

    Three supporting constraints: budget circuit breakers, with per-tier quota caps and automatic downgrade when a cap is hit; a quality gate, where flagship output must pass automated validation before it can be merged; and observability, instrumenting input/output/cache-hit tokens and credit consumption per tier to close the loop and re-fit the coefficients weekly.

    6. Further Optimization: Caching and Prefix Hygiene

    • Keep system prompts, spec documents, and long context in the request prefix and byte-for-byte stable to maximize prefix reuse;
    • Extract frequently repeated content into fixed templates, and avoid injecting changing timestamps or random IDs on every request;
    • Summarize long documents in segments before they enter the model, trading one expensive call for many cheap ones afterward;
    • Constrain output length (structured formats, field whitelists), since output unit price is usually far higher than input.

    7. Risks and Caveats

    The consumption rates above are reverse-engineered from personal measurements, not an official price list; billing rules, caching policies, and model versions can all change, so the coefficients need periodic re-fitting. Also guard against “over-downgrading” that degrades quality — keep 5%–10% of the quota as a flagship buffer. For tasks involving sensitive data, prefer a private deployment or dedicated instance rather than relying on shared cache reuse.

    8. Conclusion

    The essence of the cost difference is not the unit price but how well tasks match tiers. Fit billing into a computable model with regression first, then use three levers — input/output ratio, cache hit rate, and task grading — to schedule work. That can raise usable tokens by an order of magnitude on the same budget while keeping quality risk auditable.