LLM Inference Cost: Benchmarking Real Token Rates and Tiered Model Routing

    This article shows how to measure the actual cost of large language model inference by fitting token usage against billing data with linear regression, then use the resulting cost gradient to plan capacity and route tasks across model tiers. It covers the regression method, measured per-million-token rates for four model tiers, quota-to-token conversion, a tiered routing strategy, and practical cache and context cost optimizations. All figures are personal reverse-engineered estimates, not official pricing.

    1. Background: Why “It Runs” Is Not the Same as “It Runs Cheap”

    Once a large language model is wired into real business workflows, the first problem teams hit is usually not quality but how fast the quota drains. For the same task, switching to a different combination of model tiers can change the number of available calls per unit of time by tens or even hundreds of times. The original benchmark notes give a clear takeaway: fitting the same usage log shows that the per-token cost gap between the top-tier model and the lowest-tier lightweight model can reach two orders of magnitude, while cached input can be pushed down to a few percent of normal input cost.

    This gap is not marketing talk; it can be derived directly from billing data. There is really only one key action: treat “points consumed” as the dependent variable and “input tokens, output tokens, cached tokens” as the independent variables, then run a linear regression.

    2. Method: Fitting Unit Cost from Real Usage

    Let the points consumed in a given time window be $C$, and the input, output, and cache-hit token counts be $x_1, x_2, x_3$. The model is:

    $C = a \cdot x_1 + b \cdot x_2 + c \cdot x_3 + \varepsilon$

    Here $a, b, c$ are the per-million-token point consumption rates to solve for. As long as you collect enough samples of “window usage + window consumption,” you can solve with least squares. A sample implementation:

    1. import numpy as np
    2. # rows: [input tokens, output tokens, cache-hit tokens], target: points used in the window
    3. X = np.array(usage_rows, dtype=float)
    4. y = np.array(points_used, dtype=float)
    5. coef, *_ = np.linalg.lstsq(X, y, rcond=None)
    6. pred = X @ coef
    7. ss_res = ((y - pred) ** 2).sum()
    8. ss_tot = ((y - y.mean()) ** 2).sum()
    9. r2 = 1 - ss_res / ss_tot
    10. print("Per-million-token rate:", coef * 1e6, "R²:", r2)

    In practice, the goodness of fit is close to 1 and the residuals approach zero, which shows that billing is approximately a linear model. This brings two direct benefits: first, you can estimate the quota cost of any task offline; second, you can turn “model selection” into a computable optimization problem instead of a gut feeling.

    Three things to watch when collecting data: window boundaries must align with the billing cycle; samples must cover different input/output ratios to avoid collinearity making the coefficients unidentifiable; cache hits must be counted separately, otherwise they get absorbed into the input term and inflate the coefficient.

    3. The Cost Gradient: Measured Rates Across Four Model Tiers

    Reverse-engineering with the method above, the four model tiers show a clear cost gradient (points per million tokens, personal reverse-engineered values, not official pricing):

    • Flagship reasoning tier: input about 80,000, output about 400,000;
    • Mid-high general tier: input about 32,000, output about 112,000;
    • High-speed main tier: input about 4,000, output about 8,000, cache hit about 80;
    • Lightweight batch tier: input and output both about 2,000.

    Two conclusions are worth remembering: the flagship tier’s output unit price is about 200 times that of the lightweight tier; and for the high-speed main tier on a cache hit, input cost is only 2% of normal input. This means that in long-context repeated-prefix scenarios, whether the cache hits matters more to the bill than switching models.

    4. Quota Conversion: How Many Tokens the Same Points Buy

    Quotas are typically granted on sliding windows like “60,000 points per 5 hours, 600,000 points per week.” Assuming input is 80% and output is 20%, ignoring cache for now, the available tokens within a 5-hour window are about:

    • Flagship reasoning tier: about 417,000;
    • Mid-high general tier: about 1.25 million;
    • High-speed main tier: about 12.5 million;
    • Lightweight batch tier: about 30 million.

    The conversion logic itself is simple: take the reciprocal of $0.8/a + 0.2/b$ and multiply by the window points. The real value is that it turns a vague “the quota seems a bit short” into a concrete capacity planning number.

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

    Based on the cost gradient, tasks can be routed by “required reasoning depth”:

    1. Flagship tier: task decomposition, solution design, final code review;
    2. Mid-high tier: complex logical reasoning, tricky defect localization;
    3. High-speed main tier: the main workhorse for daily coding and refactoring;
    4. Lightweight tier: repetitive work like batch formatting, comment completion, and simple classification.

    When implementing, add a routing abstraction layer to avoid hardcoding model selection into the business logic:

    1. def route(task):
    2. if task.needs_deep_reasoning and task.is_final_review:
    3. return "flagship"
    4. if task.complexity >= 3:
    5. return "mid_high"
    6. if task.batch and task.simple:
    7. return "lite"
    8. return "fast_main"

    Three engineering constraints to pair with it: set a quota budget and circuit-breaker threshold for each task class; do fallback retries on failed requests, automatically dropping from a higher tier to a lower one; and push token usage, cache hit rate, and point consumption into a monitoring and alerting system, aggregated hourly, with immediate alerts on abnormal growth.

    6. Cache and Context Cost Engineering

    Cache hits are the most easily overlooked lever. Practical points include: put stable content like system prompts, project conventions, and long documents at the very front of the context, keeping the prefix byte-for-byte identical; avoid inserting volatile content like timestamps or random IDs mid-session; and structurally trim reusable retrieval results to cut down on useless prefixes. If you use general cloud capabilities, you can store intermediate artifacts in object storage, use a message queue to smooth out task spikes, and use logging and monitoring/alerting services for usage attribution. These are all common industry categories and do not involve any specific vendor interface.

    7. Conclusion and Caveats

    The essence of the cost difference is “pricing by reasoning depth,” not simply expensive versus cheap. The actionable methodology is: first fit your account’s real consumption rates with regression, then convert to capacity using the window quota, and finally use tiered routing to spend the expensive model on the few key decisions. It should be emphasized that all figures above are personal reverse-engineered estimates and do not constitute an official billing basis; rules and quota policies may change at any time, so production environments should defer to the official documentation and keep a fallback plan.