Benchmarking LLM Inference Pricing: Logic and Practice

    This article explains why LLM inference prices are hard to compare across channels and how to build a reproducible framework for evaluating them. It breaks inference cost into four sources, introduces an effective cost model that factors in throughput and capability, and shows how context caching, subscription plans, and channel differences affect the real cost. A practical selection checklist is included to help teams make neutral, measurable pricing decisions.

    1. The Problem: Why Prices Are Hard to Compare Horizontally

    Once LLM applications move into production, the first practical issue teams face is not “whether the model is capable enough,” but “why does the same call volume get quoted at several times the price across different channels.” A typical observation: the same model shows roughly a threefold gap in input and output unit prices between the official channel and a third-party hosting channel, while the actually available context length, maximum output length, and throughput are noticeably reduced. Looking only at unit price distorts the conclusion; looking only at throughput ignores the rigid constraints of long-text and structured-output scenarios.

    Therefore, evaluating whether an inference price is reasonable requires a reproducible measurement framework: first break the bill into cost items, then convert service capability into “effective throughput,” and finally combine cache hit rate and subscription caps to derive a comparable unit effective cost.

    2. Breaking Down the Bill: Four Sources of Inference Cost

    The widely accepted structure of inference cost can be roughly split into four parts:

    1. Compute usage: strongly correlated with input length, output length, batching efficiency, and GPU memory bandwidth;
    2. GPU memory and concurrency: long contexts significantly increase KV cache usage, which in turn limits concurrency and batch size;
    3. Service redundancy: fixed overhead from multi-availability-zone deployment, elastic scaling, monitoring and alerting, and logging services;
    4. Gross margin and reinvestment: whether a reasonable profit is included determines whether the price can remain stable over the long term.

    When a vendor publicly states that its pricing goal is “basically not to lose money, mainly to recover costs,” it is effectively pushing item 4 to a very low level. The reason such pricing is suitable as a “price benchmark” is not that it is cheap in itself, but that it is closer to the cost curve, making it easier to place other channels on the same yardstick for examination.

    3. Effective Cost Model: Folding Throughput and Capability into Unit Price

    Comparing only the unit price per million tokens ignores service differences. A more rigorous approach is to calculate the “unit effective cost”:

    1. Effective cost = (input unit price × input tokens + output unit price × output tokens)
    2. ÷ (discount from cache hit rate × context completeness × throughput compliance factor)
    3. where:
    4. throughput compliance factor = measured throughput / minimum throughput required by the business (capped at 1)
    5. context completeness = actually available context / context required by the business (capped at 1)

    Under this model, a threefold unit price accompanied by throughput of only single-digit tokens/s and truncated context and maximum output may result in an effective cost far higher than the nominal unit price. In other words, low throughput turns “cheap” into “unusable,” and truncated context directly breaks long-document, multi-turn agent, and codebase-level tasks.

    4. Cache Hits: An Undervalued Cost Lever

    For workloads such as multi-turn conversations, fixed system prompts, and repeated Q&A over long documents, context caching can amortize the computation of repeated prefixes. In engineering practice, cost can often be reduced to about 20% of the original level, provided that:

    • The prefix is stable: system prompts, tool descriptions, and the order of knowledge snippets stay fixed;
    • Sessions are sticky: the same session is routed to the same instance as much as possible to reduce cache invalidation;
    • Hits are observable: hit rates are measured through logging services and monitoring and alerting, rather than by intuition.

    Illustrative pseudocode:

    1. # Place the stable prefix first to improve cache hit rate
    2. messages = [
    3. {"role": "system", "content": STABLE_PROMPT}, # long and fixed
    4. {"role": "user", "content": dynamic_query} # short and changing
    5. ]

    5. Causes of Channel Differences: Why Third Parties May Be Both Pricier and Weaker

    The same model can perform differently across channels for common reasons: different queuing and rate-limiting policies, different batching and quantization implementations, context and output limits trimmed on the platform side, and redundancy costs added to meet service levels. When a channel offers “threefold price for about 30% of the capability,” its positioning is not cost leadership but a premium for convenience and availability; whether such a premium is reasonable depends on the business’s sensitivity to stability and compliance, not on the unit price itself.

    6. The Boundary Between Subscription and Pay-as-You-Go

    Subscription plans (such as monthly packages for AI coding tools) can, in high-frequency, long-duration usage scenarios, work out to a cost far lower than pay-as-you-go, sometimes by several times; but the trade-off is uncertainty around usage caps, time-window restrictions, and capability trimming. The judgment method is simple: use two weeks of real usage as a baseline, calculate the “total pay-as-you-go cost” and the “total subscription cost,” then add migration cost and lock-in risk. If usage fluctuates heavily or strict auditing is required, pay-as-you-go is more controllable; if the workload is stable and caps are tolerable, subscription is more cost-effective.

    7. An Actionable Selection Checklist

    1. Establish a baseline: fix the input/output length distribution and record P50/P95 latency and throughput;
    2. Verify completeness: confirm whether context and maximum output meet the needs of long documents and structured output;
    3. Quantify caching: measure hit rates and factor the discount into effective cost;
    4. Load-test concurrency: observe how rate limiting, queuing, and error rates affect effective throughput;
    5. Attribute cost: use monitoring and alerting and logging services for bill attribution, avoiding “discovering it only at month end”;
    6. Preserve portability: abstract a unified invocation layer to avoid being locked into a single channel.

    In related practice at Baidu AI Cloud, the recommendation is typically to complete the above loop with a combination of general-purpose capabilities: use a container platform to run load tests and canary releases, use object storage to accumulate evaluation datasets, and use logging services and monitoring and alerting for cost and hit-rate attribution. This keeps comparisons neutral and reproducible, and turns the “price benchmark” from a slogan into a reproducible engineering metric.