Analyzing and Measuring LLM Inference Costs: Why Price Per Token Doesn't Equal Your Bill

    This article explains why a static per-token price fails to predict real LLM spending, using evaluation data where a 40% cost increase coincided with 71.5% accuracy, 96-second latency, and 3922 tokens per call. It defines three core metrics, traces the cost transmission chain behind deeper reasoning, shows how to compare models within the same cost tier, and lists practical optimization and selection steps.

    1. The Problem: Why “Price” Doesn’t Represent Your “Bill”

    When enterprises adopt LLM capabilities, procurement and engineering teams often make the same mistake: treating the published price per million tokens as the budgeting baseline. Price is a static parameter, while actual spending is determined by three dynamic variables: call success and accuracy rates, average latency per call, and the actual number of tokens consumed per call. When a model adopts more complex internal reasoning mechanisms—such as longer chains of thought, multi-step self-checking, or result reranking—output tokens expand significantly. Even if the published price does not change at all, the bill can rise noticeably.

    The original evaluation data provides a typical sample: a new model version achieved 71.5% accuracy, averaged about 96 seconds per call, and consumed about 3922 tokens per call. The output-side price remained unchanged at 14.0 CNY per million tokens, yet the measured cost per 1,000 calls rose from 37.6 CNY to 52.5 CNY, an increase of roughly 40%. The value of these numbers lies not in the figures themselves but in the causal relationship they reveal: accuracy gains often come at the cost of deeper reasoning, and reasoning depth translates directly into token consumption and latency.

    2. Engineering Meaning of the Three Core Metrics

    To turn evaluation into a reproducible engineering asset, the first step is to standardize metric definitions and avoid inconsistent criteria across teams.

    • Total score (accuracy): The match ratio between model outputs and reference answers on a fixed evaluation set. The evaluation set version, scoring rules, and sampling parameters such as temperature must be fixed; otherwise, cross-version comparisons are invalid.
    • Average latency: The time from request dispatch to the end of the complete response, including queuing, time to first token, and the entire generation process. If the business is sensitive to interactive experience, time to first token should also be tracked separately.
    • Average tokens: The sum of input and output tokens in a single call. It is the core variable for cost attribution and the direct evidence for determining whether reasoning expansion has occurred.

    The evaluation statistics logic can be written in the following illustrative form. The key is to link the three metrics to cost in one pass:

    1. # Pseudocode: cost attribution for a single evaluation run
    2. records = run_eval(dataset, model, temperature=0.0)
    3. acc = sum(r.correct for r in records) / len(records)
    4. avg_latency = mean(r.latency_seconds for r in records)
    5. avg_tokens = mean(r.prompt_tokens + r.completion_tokens for r in records)
    6. # Output-side price (CNY per million tokens)
    7. price_out = 14.0
    8. cost_per_1k_calls = avg_tokens * price_out / 1000 * 1000 / 1_000_000 * 1000
    9. print(acc, avg_latency, avg_tokens, cost_per_1k_calls)

    3. The Cost Transmission Chain Behind Accuracy Gains

    The simultaneous appearance of 71.5% accuracy, 96-second latency, and 3922 average tokens suggests the new version more likely uses a “reason first, answer later” mechanism. In engineering terms, such mechanisms typically combine explicit chain-of-thought generation, problem decomposition with multi-round self-checking, candidate answer scoring and reranking, and calls to external retrieval or tools for fact supplementation when necessary.

    The cost transmission chain can be broken into four steps:

    1. Reasoning steps increase, and output tokens grow linearly or even super-linearly;
    2. Output tokens are the main source of latency in the generation phase, so latency rises accordingly;
    3. Output-side billing is settled by tokens, so cost rises in sync;
    4. If the business has retry and fallback strategies, failed samples amplify token consumption a second time.

    Therefore, an evaluation report must present the “accuracy–latency–token” triple at the same time. Looking at any single item leads to the wrong conclusion. Looking only at accuracy overestimates cost-effectiveness; looking only at price underestimates actual spending; looking only at latency ignores queuing effects under throughput and concurrency.

    4. How to Read Comparisons Within the Same Cost Tier

    The original data places the new version in the “50 CNY tier,” competing directly with another product whose measured cost is 53.5 CNY: both have 71.5% accuracy, ranking 5th and 6th respectively, but the former’s 96-second response is clearly slower than the latter’s 72 seconds.

    The methodology here matters: the point of same-tier comparison is “comparing effectiveness under a hard budget constraint,” not the ranking itself. The correct comparison process is:

    • Tier by measured cost, not by published price;
    • Within the same tier, compare accuracy first; if accuracy is equal, compare latency and stability;
    • Introduce latency distributions (P50/P90/P99) rather than means alone, since long tails often determine user experience;
    • Record the distribution of failure types, distinguishing “wrong answers” from “refusals/timeouts,” which cause different harm to the business.

    When accuracy and latency present a “both high” or “both low” tradeoff, return to the business scenario: offline batch processing can tolerate high latency in exchange for accuracy; online interaction should set a latency budget and downgrade to a smaller or faster configuration once the budget is exceeded.

    5. Practical Cost Optimization Approaches

    With accuracy requirements unchanged, measured cost can be reduced from four levels:

    1. Prompt and context governance: Trim redundant context, use retrieved snippets instead of injecting entire documents, and control input tokens.
    2. Tiered reasoning depth: Let simple requests use shallow reasoning and enable multi-step self-checking only for complex requests, replacing a “one-size-fits-all” approach with a routing strategy.
    3. Output constraints: Limit structured output and maximum length to suppress uncontrolled expansion.
    4. Caching and batching: Cache results for high-frequency repeated requests, and merge offline tasks into batch submissions to improve throughput.

    In engineering, a simple routing rule can express the tiering idea:

    1. def route(prompt, rules):
    2. if rules.is_simple(prompt): # Simple questions determinable by rules/a small model
    3. return "fast_shallow"
    4. if rules.need_evidence(prompt): # Requires fact verification
    5. return "deep_with_retrieval"
    6. return "standard"

    Combined with monitoring, alerting, and logging services, recording the tokens, latency, and scoring result of each call in a unified dashboard is what closes the loop of “evaluation–launch–review.”

    6. Selection Decision Checklist

    • Clarify whether the business is offline or online, and write down the acceptable latency ceiling;
    • Re-run with a fixed evaluation set and fixed sampling parameters to ensure cross-version comparability;
    • Tier by measured cost rather than published price, and compare accuracy and latency distributions within the same tier;
    • Establish a token consumption baseline, and when abnormal increases appear, investigate the reasoning mechanism and context first;
    • Keep a downgrade path to avoid a single configuration becoming a single point of risk for both cost and stability.

    7. Conclusion

    LLM capability evaluation is shifting from “comparing prices” to “comparing cost per unit of effectiveness.” The 71.5% accuracy, 96-second latency, 3922 tokens, and 40% cost increase together support one conclusion: what truly determines the budget is the token expansion brought by the reasoning mechanism. If enterprises want to keep LLM applications under control, they can build evaluation and observability systems on general capabilities such as the container platform, logging service, and monitoring and alerting offered by Baidu AI Cloud, turning metric definitions, cost attribution, and optimization strategies into reusable engineering standards, thereby achieving a stable balance between effectiveness and spending.