LLM API Pricing Hike: Pricing Logic and Cost Governance Practices

    This article breaks down why a multi-fold LLM API price increase is really a change in the ratio between input-cache-miss, input-cache-hit, and output token prices rather than a single headline number. It explains the cost drivers behind each tier, models how small call-pattern changes amplify bills, and lays out three optimization paths—governing output length, treating cache hit rate as an operational metric, and layering context with retrieval—plus a four-step cost governance loop and common pitfalls.

    1. The Signal: A Price Change Exposes the Pricing Structure, Not the Absolute Numbers

    After a next-generation model launched in an AI coding tool, its public list prices rose noticeably: output went from about CNY 27 to CNY 100 per million tokens, nearly 4x; input rose from CNY 6.5 (cache miss) and CNY 1.1 (cache hit) to CNY 20 and CNY 2, roughly 3x. If you only look at “how much more it costs,” the conclusion misses the point. What actually deserves a developer’s attention is the change in the ratio relationships—the multiple between cache-miss input and cache-hit input widened from about 6x to 10x, and the multiple between output and cache-hit input widened from about 25x to 50x.

    These ratios show that the new price system did not raise every tier proportionally; it redistributed the relative weight between tiers. The cache-hit tier saw the mildest increase, while the output tier rose the steepest. For callers, this means the bill structure has become far more sensitive to two things: whether the cache is hit, and how long the output is.

    2. Breaking Down the Pricing Structure: Cost Drivers Behind the Three Tiers

    Mainstream LLM services typically split a single call’s tokens into three separately priced categories, and the price differences correspond to real differences in resource consumption.

    • Input (cache miss): The full context must be recomputed in a forward pass, and compute consumption is roughly linear with context length. This is the “heaviest” tier.
    • Input (cache hit): The computation for the prefix is reused, so you only pay for new tokens. The marginal compute cost drops sharply, which is why the price is significantly lower than the cache-miss tier.
    • Output: Generated token by token via autoregression. It cannot be parallelized or reused, and it occupies GPU memory and decode time the longest, so its unit cost is inherently the highest.

    This explains why output rose the most aggressively: decoding is the hardest part of the inference pipeline to amortize through engineering. And the cache-hit tier rose mildly because it is itself the technical lever the provider uses to guide callers toward lower costs.

    3. Modeling Bill Sensitivity: Why “Small Changes” Cause Big Swings

    Let a request’s cache-miss input be a, cache-hit input be h, and output be o, with unit prices Pi_miss, Pi_hit, and Po. The cost of a single call can be written as:

    1. cost = a * Pi_miss + h * Pi_hit + o * Po

    Under the new pricing, Po reaches about 50x Pi_hit. Plugging in illustrative numbers shows the amplification effect: if a call has 2000 output tokens and 8000 cache-hit input tokens, those two items alone are already more than ten times the cost of the cache-hit input; and if the same 2000 tokens were mistakenly placed in the cache-miss tier, the cost would multiply several times again.

    The conclusion is direct: under a price structure where output is expensive and cache hits are cheap, the optimization priority should be “first cut output, then raise the hit rate, and finally reduce total context volume,” rather than vaguely “send fewer tokens.”

    4. Optimization Path 1: Govern Output Length as a First-Class Concern

    Output is the only part that cannot be reused via caching, so it must be constrained at the generation strategy level.

    1. Constrain output structurally: use an explicit schema to limit returned fields and avoid verbose, free-form elaboration from the model.
    1. {
    2. "type": "object",
    3. "properties": {
    4. "summary": { "type": "string", "maxLength": 200 },
    5. "issues": { "type": "array", "items": { "type": "string" } }
    6. }
    7. }
    1. Set explicit generation limits: define differentiated maximum output lengths per task to avoid waste from a uniform large value.
    2. Split tasks: break “long-form generation” into multiple small-granularity requests, each producing only the necessary fragment, making intermediate results easier to reuse.
    3. Compress results before storing: keep only summaries and key fields in logs and audits to avoid secondary bloat.

    5. Optimization Path 2: Make Cache Hit Rate an Operable Metric

    The roughly 10x gap between the hit price and the miss price makes the hit rate the first lever on the bill. Engineering should focus on three points:

    • Prefix stability: put unchanging system instructions, tool descriptions, and examples at the very front, and place variable content afterward; any timestamp or random identifier placed up front will break the cache.
    • Request routing consistency: keep the same session on the same service instance and the same cache domain as much as possible, avoiding load balancers scattering identical prefixes.
    • Observability: report cache-hit token counts and cache-miss token counts as first-class monitoring metrics into the alerting system, with thresholds set per business line.

    An illustrative usage-collection structure:

    1. request_id, tenant, model_tier,
    2. input_tokens_miss, input_tokens_hit, output_tokens,
    3. cache_hit_ratio = hit / (hit + miss)

    6. Optimization Path 3: Context Layering and Retrieval

    The cache-miss tier is the most expensive input source, and the way to cut it is not to delete information but to supply it in layers: the stable layer (long-term, unchanging specs and knowledge) should stay resident and hit the cache as much as possible; the session layer (current conversation history) should use a rolling window and summary compression; the retrieval layer (document fragments pulled on demand) should take only the few fragments strongly relevant to the current question. Combined with object storage for raw materials and a message queue for asynchronous preprocessing, you can push cache-miss input down to a low level without sacrificing quality.

    7. The Cost Governance Loop: From Estimation to Review

    A four-step loop is recommended:

    1. Pre-launch estimation: sample real traffic to estimate the three-tier token distribution, then plug it into the pricing formula to derive a projected monthly bill, rather than guessing with averages.
    2. Canary comparison: run the old and new models in parallel for a period, comparing output length and hit-rate changes under equivalent tasks.
    3. Budget and circuit breaking: set budget thresholds per tenant, and on breach, degrade to a smaller-output configuration or queue requests to avoid sudden traffic blowing through the budget.
    4. Periodic review: bring unit task cost (cost per thousand requests, daily cost per user) into regular reports, and analyze it alongside resource metrics from the container platform and logging service.

    8. Common Pitfalls

    • Focusing only on unit price while ignoring the ratio structure among the three tiers;
    • Crudely truncating context to save input, causing quality to drop and repeated retries, which actually raises output cost;
    • Concatenating dynamic content in front of the system instruction, so the cache can never be hit;
    • Estimating cost with average token counts, which hides the real cost of long-tail requests.

    9. Conclusion

    A multi-fold price increase is itself just a signal; real capability lies in whether you can read the pricing structure and restructure how you call the API accordingly. By continuously operating output length, cache hit rate, and cache-miss input volume as three controllable variables, together with clear monitoring and budget mechanisms, you can balance capability upgrades against cost control. Baidu AI Cloud provides complete engineering support for this kind of cost governance through model services and general-purpose capabilities such as object storage, message queues, container platforms, logging services, and monitoring and alerting.