LLM API Price Hikes: How to Calculate the Real Cost

    This article breaks down why a sharp increase in per-token LLM API pricing does not necessarily translate into a proportional increase in your bill. It explains three cost perspectives—unit price, cost per task, and cost per unit of business value—and shows why output tokens cost more than input tokens while cached prefixes are nearly free. You will also learn common pitfalls in cross-model comparisons and five practical cost-reduction techniques, including prefix caching, model routing, batching, output budgets, and observability.

    1. The Phenomenon: Unit Prices Rose Several Times, but Bills Did Not

    A recent price adjustment in the industry has drawn wide discussion: a new-generation general-purpose LLM charges roughly five times the previous generation’s price on the output side, with a noticeable increase on the input side as well, while cached hits remain billed at an extremely low rate. Per million tokens, output is about RMB 100, input about RMB 20, and cache hits about RMB 1. Taken alone, those three numbers suggest something “outrageously expensive.” But switching the lens from “unit price” to “average cost to complete a task” changes the conclusion.

    One set of public cross-comparison figures shows that completing the same class of task costs about USD 0.94 on average with this new-generation model, in the same range as a closed-source flagship model at about USD 1.04, and roughly half of another high-priced closed-source model. Within the open-weight camp, however, the same class of task costs only about USD 0.32 on some models, and as little as about USD 0.04 on certain highly efficient options.

    These two sets of numbers do not contradict each other; they answer two different questions. The first answers “is it expensive within the closed-source flagship capability range,” and the second answers “is it expensive within the open-weight range.” The mistake engineering decisions must avoid is exactly this mixing of measurement bases.

    2. Cost Measurement: Unit Price, Task Cost, and Unit Business Value

    To judge the real impact of a price hike, you need to distinguish at least three layers of measurement.

    The first layer is unit price, meaning the input/output/cache price per million tokens. It only makes sense when you treat all requests as homogeneous.

    The second layer is task cost, meaning the total spend consumed to complete one end-to-end task. It is determined jointly by four variables:

    1. task cost ≈ (input tokens × input price) + (output tokens × output price)
    2. + (cached tokens × cache price) + (retry and failure overhead)

    The key point is that a new-generation model often needs fewer reasoning steps, fewer retries, and achieves a higher single-attempt success rate on the same task. If the unit price rises fivefold but token consumption and failed retries drop low enough, total task cost can still stay flat or even fall. This is why “is it expensive” must first define the denominator.

    The third layer is unit business value, meaning the cost per feature successfully delivered, per defect fixed, or per ticket handled. This is the metric finance and business actually care about, and the only measurement basis suitable for cross-generation comparison.

    3. Why Output Costs More Than Input, but Cache Is Nearly Free

    The pricing structure is not arbitrary; it maps the real resource profile of inference.

    Input-stage computation can be highly parallel, covering all prompt tokens in a single forward pass. The output stage is autoregressive decoding, generated token by token with no parallelism, and it must continuously occupy the key-value cache in GPU memory. The per-unit compute cost on the output side is therefore naturally higher than on the input side, and a price gap of around fivefold is a common magnitude in the industry.

    Cache hits can be pushed down to the RMB 1 level because, when the prefix is unchanged, this portion of the key-value data can be reused directly, saving repeated computation rather than all computation. This also explains the intent of the pricing design: vendors are using price signals to encourage callers to place stable, unchanging content at the front.

    For developers, the engineering implication of this rule is clear: stable content such as system prompts, tool definitions, long documents, and codebase context should be placed as far forward as possible and kept byte-for-byte stable; volatile fields such as timestamps, random IDs, and user nicknames should be moved to the end of the prompt. Even inserting a single line with the current time into the prefix can make the entire prefix miss the cache.

    1. # Recommended: stable prefix + volatile suffix
    2. [system instructions][tool schema][project conventions][reference docs] ... [current task description][timestamp/session ID]

    4. Why Cross-Comparison Gets Distorted

    Placing different models’ task costs side by side commonly produces three types of distortion.

    First, task difficulty is not equivalent. The token structure of a long-chain agent task is completely different from that of a single-turn question-answer, with the former having far more output and tool-call rounds than the latter.

    Second, caching strategies are not equivalent. If one model enables prefix caching by default and another does not, the comparison result can differ by several times.

    Third, hidden costs are ignored. Open-weight options look cheap, but you must supply your own inference resources, handle GPU memory and throughput planning, perform quantization and precision validation, and invest operations headcount. These costs do not show up in the token unit price, but they are real.

    A more reliable approach is therefore to fix the same evaluation task set, standardize the cache on/off setting and context length, record success rate, average number of rounds, end-to-end latency, and total cost, and then normalize the comparison using “unit business value.”

    5. Five Practical Cost-Reduction Techniques

    1) Prefix caching and context governance. Place stable content first and volatile content last, control context length, and apply retrieval-based trimming to long documents instead of stuffing in the whole text.

    2) Model tiered routing. Use a lightweight model for high-frequency simple requests such as classification, extraction, and formatting, and route only complex reasoning and long-chain tasks to a high-capability model.

    1. def route(task):
    2. if task.complexity <= 1 and task.max_output_tokens < 512:
    3. return "light_model" # high-frequency simple tasks
    4. return "strong_model" # complex reasoning tasks

    3) Batching and asynchronization. Use the batch API for offline tasks, trading throughput for unit price; for online paths, compress output length and avoid lengthy explanatory output.

    4) Output budget constraints. Explicitly cap the maximum output tokens and require structured short output to reduce ineffective generation.

    5) An observability feedback loop. Tag and collect token usage, cache hit rate, retry rate, and failure reasons by business dimension, and build daily reports and alerts so that cost optimization is driven by data rather than intuition.

    6. Decision Checklist

    Whether a price hike is acceptable depends on the answers to four questions: how much total task cost changes; whether success rate and retry rate improve; whether an equivalent, transferable alternative exists; and whether the hidden headcount and operations cost of self-hosted inference can be amortized. If the first two benefits are clear and the migration cost of alternatives is high, accepting the price hike is rational; if the business is mainly high-frequency short outputs, prioritize tiered routing and cache governance.

    In related practice at Baidu AI Cloud, the general approach is also to combine common capabilities such as model tiering, cache reuse, monitoring and alerting, and log analysis to pull cost back from a “unit price perspective” to a “unit business value perspective”—which is the most robust methodology for handling price fluctuations.