LLM Inference Cost Evaluation and Model Selection: A Practical Guide

    Comparing per-million-token prices is often mistaken for a real cost conclusion, but the gap between list price and the actual bill is shaped by token consumption structure, request patterns, billing modes, and retries. This guide explains four cost amplification mechanisms—long-context surcharges, cache write and retention fees, billing mode differences, and token inflation—and shows how to evaluate models with both outcome and process metrics. It also offers a layered capability view and a practical framework based on per-task total cost, canary traffic replay, monitoring, and dual-tier model routing.

    1. Where It Starts: Treating “Price Comparison” as a “Cost Conclusion”

    In model selection and budget reviews, the most common approach is to compare the per-million-token prices on a price list and then extrapolate total spend by simple ratios. One platform’s price adjustment introduced three tiers: an entry tier at $1 per million input tokens, $0.05 for cached input, and $5 per million output tokens; a mid tier at $2 input and $10 output; and a high tier at $10 input and $50 output. The entry tier happens to be exactly half the mid tier and one-tenth the high tier.

    The conclusion looks straightforward: migrate mid- and high-tier traffic to the entry tier, and cost drops by half immediately. But real bills rarely fall by that ratio. The reason is not a misleading price list, but four layers of variables between “unit price” and “bill”: token consumption structure, request feature distribution, billing mode, and failure retries.

    2. The Overlooked Middle: Checking Only the Result, Not the Path

    After migration, teams usually verify only whether the final output is correct, and rarely ask what the model did in intermediate steps: whether it ran multiple rounds of self-checking, repeatedly read the same context, or rewrote several times due to misinterpreting instructions. As long as the final answer matches, the workflow is considered passed.

    This is similar to a team hiring a new colleague at half the salary of a senior member. The output is basically usable, so large volumes of tasks are assigned to them. The manager accepts deliverables without reviewing the process. Most of the time there is no problem; occasionally the path goes off track but the result happens to be correct, so the deviation stays hidden for a long time until a task is scaled up and the issues surface all at once.

    The engineering lesson is that model evaluation must include both outcome metrics and process metrics. Outcome metrics are task success rate and field accuracy; process metrics are average rounds, repeated reads, context length distribution, and retry rate. Without process metrics, cost optimization is flying blind.

    3. Why the Bill Doesn’t Match: Four Amplification Mechanisms

    3.1 Long-Context Surcharge

    Most platforms raise the price of an entire request once input length exceeds a threshold, commonly by doubling input and cache rates and multiplying the output rate by 1.5. Requests above the threshold are a minority, but enough to pull up the monthly average.

    3.2 Cache Write and Retention Duration

    Caching is not free. Writing to cache is usually billed separately, and retaining data for 30 minutes costs differently from retaining it for 12 hours. If request prefixes are unstable, the cache hit rate stays low, and write costs become a net expense.

    3.3 Billing Mode Differences

    Batch and flexible modes are often billed at 50% of the standard price, at the cost of queueing latency and throughput limits respectively; accelerated mode is billed at double the price, trading budget for latency. Looking only at unit price during selection ignores these structural differences introduced by mode.

    3.4 Token Consumption Inflation

    A less capable model often needs more rounds and longer context to complete the same task. Third-party estimates show an entry-tier cost of $0.40 per task versus $0.72 for the mid tier—an actual saving of about 44%, not the 50% implied by the price list. The difference is exactly the extra tokens consumed.

    The illustrative cost estimation logic can be written as:

    1. def estimate_cost(reqs, price, threshold=272000):
    2. total = 0.0
    3. for r in reqs:
    4. in_tok, out_tok, cached = r.input_tokens, r.output_tokens, r.cached_tokens
    5. in_rate, out_rate = price.input, price.output
    6. if in_tok > threshold: # long-context whole-request surcharge
    7. in_rate *= 2
    8. out_rate *= 1.5
    9. total += in_tok * in_rate / 1e6
    10. total += cached * price.cache_write / 1e6
    11. total += out_tok * out_rate / 1e6
    12. return total * r.mode_multiplier # batch 0.5 / standard 1.0 / accelerated 2.0

    This code is deliberately generic: the threshold, multipliers, and mode coefficients should be configuration items rather than hard-coded into business logic.

    4. Capability Boundaries Should Be Viewed by Dimension

    Benchmark results in release materials need to be read carefully. On a terminal coding benchmark, for example, an entry tier at the highest reasoning effort scores above the mid tier but still leaves roughly half of tasks unsolved, and the material itself recommends higher tiers for complex coding tasks. Computer-use benchmarks (watching the screen, clicking, filling forms) show a similar pattern: routine flows can be completed, but long-chain tasks tend to become unstable.

    A reasonable conclusion is therefore layered:

    • Extraction, classification, formatting, short summarization: the entry tier is sufficient, with a clear cost advantage;
    • Multi-file refactoring, complex debugging, long-chain tool calls: mid-to-high tiers are needed;
    • High-risk scenarios (finance, compliance, production changes): model output alone is not enough; rule-based validation and human review must be added.

    5. A Practical Evaluation Framework

    1. Build a task tier list, marking the success-rate requirement and tolerable latency for each task type.
    2. Use real traffic replay for small-scale canary testing, and track the token distribution rather than averages.
    3. Replace “unit price” with “total cost per task” as the reporting metric.
    4. Bring cache hit rate, retry rate, and the share of long-context requests into daily monitoring and alerting.
    5. Keep dual-tier model routing for critical paths: use the low-cost tier by default and escalate when complex features are detected.

    If an enterprise already uses a cloud platform’s log service, monitoring and alerting, and message queues, these metrics can be consolidated into a unified dashboard for attributable and traceable cost. Baidu AI Cloud’s general practices in model services and observability also emphasize per-task cost rather than unit price as the optimization target.

    6. Conclusion

    Division on a price list becomes mixed arithmetic on a bill. Real cost governance is not about finding a cheaper unit price, but about making task success rate, process efficiency, and billing structure visible at the same time. Complete the process metrics, make the estimation logic configurable, and switch the reporting metric to per-task cost—then “half the price” won’t turn into an unexplained discrepancy at month end.