Evaluating LLM Inference Cost: What to Look at Beyond Token Pricing

    A new flagship model's per-token price being several times higher than the previous generation is not enough to call it expensive. This article breaks down the real drivers of inference cost—output throughput, context caching, task success rate and retry amplification, and engineering overhead—and shows how to compare models on a like-for-like basis. It includes a reusable cost calculation approach, practical evaluation suggestions, and a step-by-step selection process centered on cost per successful task for tiered model routing.

    1. Turn “Is It Expensive?” into a Computable Question

    When a new flagship model’s per-token price is several times that of the previous generation, the first reaction is usually “the price went up.” But in real engineering work, the bill is never determined by unit price alone. What actually drives cost is the cumulative spend required to complete one business task, which can be roughly written as:

    1. cost per task ≈ (input tokens × input price + output tokens × output price) / task success rate
    2. + retry and human fallback cost + engineering overhead

    This formula makes three things clear: unit price is only one multiplier; throughput and concurrency determine how many tasks can be completed per unit of time, which affects resource usage; and success rate together with retry strategy can multiply or dilute cost. The intuition that a model “turns out to be cheaper once you use it” essentially means the denominator (effective output) got larger, not that the numerator got smaller.

    2. Dimension 1: Output Throughput Determines Real Value

    LLM conversation and generation tasks are usually “output-bound”: the input is read in once, while the output is generated segment by segment, so both user wait time and machine occupancy time are dominated by output speed. If a new-generation model delivers significantly higher output throughput than the previous generation at the same concurrency, the same machine hours can serve more requests, which is equivalent to diluting the unit price.

    It is worth stressing that vendors often offer tiered response modes: a low-latency tier and a high-throughput tier differ in both billing and capability. Comparing a new-generation standard tier against a previous-generation high-throughput tier is a mismatch of baselines; the correct comparison is tier against tier, or simply normalizing everything to actual spend per million output tokens.

    A reusable approach for load testing and normalization is outlined below (illustrative, not tied to any specific API):

    1. def effective_cost(input_price, output_price, in_tok, out_tok,
    2. qps, concurrency, success_rate):
    3. per_call = (in_tok * input_price + out_tok * output_price) / 1e6
    4. per_task = per_call / success_rate
    5. # Throughput determines how many tasks can be handled per unit of time, which affects resource amortization
    6. throughput_factor = min(1.0, qps / max(concurrency, 1))
    7. return per_task / throughput_factor

    3. Dimension 2: Context Reuse and Cache Hits

    In real business scenarios, system prompts, knowledge base snippets, and tool definitions are often repeated across a large number of requests. Mature inference services provide context caching capabilities that bill repeated prefixes at a lower price. This means the cost structure of long prompts, fixed templates, and batch extraction tasks is completely different from the intuition of “billing everything in full every time.”

    Practical suggestions:

    • Put stable, unchanging content first and variable content later to improve prefix hit rates;
    • Split very long documents into a “reusable summary + incremental snippets” to reduce repeated input;
    • Build a semantic cache for high-frequency short Q&A, returning on a hit and skipping billing entirely.

    4. Dimension 3: Task Success Rate and the Retry Amplification Effect

    What is most easily overlooked in unit price comparisons is the cost of failure. If a model is more reliable at structured output, long-context adherence, and multi-turn instruction retention, its higher first-pass rate means the savings from fewer retries can often offset a higher unit price. Conversely, if a cheaper model frequently produces malformed output, the engineering side has to pay for parsing tolerance, secondary validation, and even manual review.

    The recommendation is to upgrade evaluation from “can it answer” to “can it be used directly”:

    • Define acceptance criteria that can be validated automatically (complete fields, valid enums, length constraints);
    • Track first-pass rate, average retry count, and end-to-end latency;
    • Run regressions on real business samples rather than public leaderboards to avoid selection bias.

    5. Dimension 4: Engineering Overhead and Hidden Costs

    Model calls are only one link in the chain. Logging services, monitoring and alerting, rate limiting and quota management, content safety review, and data retention in object storage all add to the total cost. A high-unit-price model with more complete observability and governance capabilities can significantly reduce the cost of fault localization and compliance; these gains do not show up on the token bill but genuinely affect the overall investment.

    6. A Practical Selection Process

    1. Define the baseline: normalize to “cost per thousand successful tasks,” and note the input/output ratio;
    2. Compare like for like: low-latency tier against low-latency tier, high-throughput tier against high-throughput tier;
    3. Run a small-traffic canary: run shadow traffic with real requests and collect throughput, success rate, and latency distribution;
    4. Use tiered routing: send simple tasks to a lightweight model and complex reasoning to a flagship model;
    5. Keep regressing continuously: both models and prices change, so make the cost dashboard an ongoing mechanism.
    1. Routing strategy (pseudocode)
    2. if task complexity is low and second-level latency is acceptable:
    3. use the lightweight model
    4. elif long-context deep reasoning is required:
    5. use the flagship model + context caching
    6. else:
    7. use the standard tier with semantic caching enabled

    7. Conclusion

    “The unit price is several times that of the previous generation” is not enough on its own to judge whether something is expensive or not. When output throughput, context reuse, first-pass rate, and engineering overhead are placed in the same cost table, a flagship model can well be the more cost-effective choice, especially in long-text generation, batch extraction, and complex reasoning scenarios. The rational approach is not to argue about the sticker price, but to build a measurement system centered on “cost per successful task” and use data to drive tiered selection. If an enterprise wants to implement a similar approach on Baidu AI Cloud, it can combine general-purpose large model service platforms, container platforms, and monitoring and alerting capabilities to build a reusable cost evaluation and routing system.