LLM Inference Cost Evaluation: What to Look at Beyond Per-Token Pricing

    Comparing the price of a new generation of LLM inference services is easy to get wrong. Public per-token rates only reflect billing for each unit of input or output; the real cost of a business request also depends on how many calls are needed, retry probability, context length distribution, and how well output length is controlled. This article introduces cost per effective output as a unified measure, explains how throughput and latency hide behind list prices, lists the billing details that must be aligned before any comparison, and shows how task tiering, model routing, prompt caching, and context governance reduce cost without losing quality. It also covers running an effectiveness regression check as the safety boundary for any cost-cutting change.

    1. Framing the Question Correctly: From Price Comparison to Cost per Effective Output

    When evaluating the pricing of a new generation of large model inference services, the most common mistake is putting models from different generations and capability tiers into a single price table and comparing them directly. Public list prices usually reflect only the billing standard per unit of input or output content, while the actual cost of a single business request also depends on the number of calls required to complete the same task, the retry probability, the distribution of context lengths, and the ability to control output length.

    A more rigorous metric is therefore cost per effective output: total cost divided by the number of results actually adopted by the business. It can be written as:

    1. cost per effective output = (input cost + output cost + retry and failure cost + orchestration and operations cost) / number of effective results

    This formula shows that unit price is only one term in the numerator. If a new model has a higher first-attempt success rate on the same task, needs shorter prompts and context, and produces more concise output, then cost per effective output can still decrease even when the unit price is higher. Conversely, if adopting the new model leads teams to routinely lengthen context and lift output length limits, cost will quickly spiral out of control.

    2. Throughput and Latency: Hidden Costs Masked by Unit Price

    The genuinely valuable observation in the original discussion is the impact of output speed on both overall experience and cost structure. The output phase of generative inference is typically constrained by token-by-token decoding: the longer the output and the higher the concurrency, the more noticeable queueing and time to first token become. Under the same hardware and concurrency conditions, a model tier with higher output throughput can serve more requests in the same amount of time, reducing the resource investment needed per unit of time.

    In engineering terms, performance metrics should be broken down into three measurable categories:

    • Time to first token: determines the perceived speed of interactive applications.
    • Output rate: determines completion time for long-form text and code generation scenarios.
    • Tail latency (such as P95 and P99): determines whether extra redundant capacity is needed at peak times.

    It is worth stressing that different vendors offer different service tiers aimed at low latency and at high throughput, and the two are not equivalent in either billing or capability. Directly comparing the price of a high-throughput tier with the price of a low-latency tier leads to seriously distorted conclusions. The correct approach is to measure end-to-end time under the same business workload, then convert it into resource cost per hour or per thousand sessions.

    3. Aligning Billing Terms: Four Prerequisites for a Valid Comparison

    For a cross-generation comparison to be meaningful, at least the following terms need to be aligned first:

    1. Whether input and output are priced separately, and whether input that hits a cache is discounted.
    2. Whether there is a minimum billable length, batch-call discounts, or tiered pricing.
    3. Differences in context window and maximum output length limits.
    4. Whether failures and rate limiting are billed, and whether retries generate additional input charges.

    A practical approach is to build a request profile for your own business, recording percentiles of input length, output length, and cache hit ratio, then use that profile to calculate the cost of different options rather than estimating from averages. Long-tail requests are often the main source of cost.

    1. # Example: estimate cost from a real request profile instead of relying on average length
    2. def estimate_cost(profile, price_in, price_out, cache_hit_ratio=0.0):
    3. total = 0.0
    4. for req in profile: # req: (in_tokens, out_tokens, calls)
    5. in_t, out_t, calls = req
    6. billable_in = in_t * (1 - cache_hit_ratio) * price_in
    7. total += (billable_in + out_t * price_out) * calls
    8. return total

    4. Task Tiering and Model Routing: The Main Battleground for Cost Optimization

    In practice, the most significant cost optimization does not come from switching models but from task tiering. Dividing requests into several tiers by difficulty and risk, sending simple tasks to lightweight models or rule-based handling and complex tasks to more capable models, can substantially reduce average cost while keeping effectiveness essentially unchanged.

    Tiering dimensions can include input length, whether multi-step reasoning is required, whether structured output validation is involved, and how severe the consequences of failure are. The routing layer needs to keep a fallback path and to sample and inspect degraded results, avoiding the situation of “saving money but losing effectiveness.”

    1. request -> preprocessing and classification -> cache hit? -> yes -> return directly
    2. -> no -> select model tier (lightweight / standard / high capability)
    3. -> structured validation -> upgrade tier and retry on failure

    5. Caching and Context Governance: The Most Easily Overlooked Way to Save

    Input-side cost often dominates, and the repeated parts of the input (system prompts, tool descriptions, long documents) are well suited to reuse. Prompt caching capabilities, widely supported across the industry, can reduce billing or processing time for repeated input with a stable prefix. In addition, chunk caching, result caching, and semantic caching in retrieval-augmented architectures can all significantly reduce repeated computation.

    Context governance is equally important: retrieve and rerank first, and inject only the necessary chunks; summarize and compress conversation history; and place large blocks of reference material in external storage to be fetched on demand rather than stuffing all of it into the context. These practices usually deliver a more stable cost reduction than “switching to a cheaper model.”

    6. Effectiveness Regression: The Safety Boundary for Cost Optimization

    Any cost-reduction plan must be premised on an effectiveness regression check. It is advisable to build a small evaluation set that covers typical scenarios, record accuracy, structured output compliance rate, human adoption rate, and average time, and run it automatically after every change to prompts, routing strategy, or model tier. Only when the number of effective results does not decline does cost per effective output truly decrease.

    7. Conclusion

    Faced with a new-generation model whose unit price is several times that of the previous flagship, the rational conclusion is that unit price is not decisive; cost per effective output should be the unified measure. Developers should first measure the latency and throughput of their own workload, align billing terms, and then systematically reduce cost through task tiering, model routing, cache reuse, and context compression, using effectiveness regression to hold the quality line. If an organization already uses the relevant cloud product capabilities from Baidu AI Cloud, it can combine log services, monitoring and alerting, and container platforms to complete load testing and cost attribution, making the evaluation process reproducible and sustainable.