Token Cost Breakdown Behind Large Model API Price Increases

    This article breaks down the cost structure behind large model API pricing using a recent price adjustment as a sample case. It explains the three-tier token billing model (uncached input, cached input, and output), shows why token volume ratios matter more than unit prices, identifies usage patterns that amplify bills, and lists practical cost levers such as prefix stabilization, semantic caching, and observability. Readers will learn how to model API costs and plan budgets around cache hit rates.

    1. Why a Price Change Drew Attention

    A recent generation of an AI coding tool’s model published a new billing standard: output pricing is roughly four times the previous generation, uncached input is roughly three times, while the cached-hit tier rose more moderately. Because the tool has high penetration among developers, the pricing structure quickly became a discussion topic.

    This article does not evaluate any specific vendor’s pricing strategy. Instead, it treats the change as a representative sample for dissecting the cost structure of large model APIs. For developers, the useful questions are not “how much did it go up,” but: how does the three-tier token billing structure determine the bill, which usage patterns get amplified by a price increase, and what cost levers are controllable at the architecture level.

    2. From List Price to a Cost Model

    Mainstream large model API billing is usually split into three tiers, priced per million tokens:

    • Uncached input: the full context of the request must participate in computation;
    • Cached input hit: the context prefix matches cached content, so intermediate computation results can be reused;
    • Output: the portion generated token by token.

    Let the uncached input unit price be P_in, the cached hit price be P_hit, and the output price be P_out. The bill for a single request can be written as:

    1. Cost = (Tin - Tcache) * P_in
    2. + Tcache * P_hit
    3. + Tout * P_out

    Here Tin is total input tokens, Tcache is tokens served from cache, and Tout is output tokens. The formula highlights an often-overlooked fact: unit prices are only coefficients. What actually determines the amount is the three token volumes and the ratios between them.

    3. Three Ratios That Matter More Than Unit Price

    Turning the sample numbers into ratios yields two structural metrics.

    First, the uncached-to-cached ratio. It was about six times in the previous generation and has widened to about ten times. The penalty for a cache miss has grown heavier: for the same context, going through cache versus bypassing it changed from “six times more expensive” to “ten times more expensive.”

    Second, the output-to-cached ratio. It was about twenty-five times in the previous generation and is now about fifty times. This ratio captures how scarce “generation” is relative to “reuse,” and explains why the output tier saw the steepest increase: generation is priced as the most expensive resource.

    A counterintuitive conclusion follows: the cached-hit tier had the mildest increase, so the relative payoff of raising the hit rate actually went up. In other words, after a price increase, caching shifts from an optimization to a requirement.

    4. Usage Patterns That Get Amplified

    The model above points to three high-risk scenarios.

    1. Long context, low reuse. Pasting an entire document or full log on every request, with almost no repeated prefix, pushes nearly everything into the uncached tier and absorbs the full ten-times gap.
    2. Output-heavy workloads. Batch code generation, long-form rewriting, and test case completion have a high Tout share and sit directly in the tier with the largest increase.
    3. Unstable prefixes. Inserting timestamps, random request IDs, or dynamic retrieval results at the start of a request makes the prefix hash inconsistent and invalidates the cache entirely. This is the most common “invisible full-price bill” in engineering practice.

    5. An Actionable Optimization Checklist

    • Stabilize the prefix: put system prompts, tool descriptions, and fixed examples first and keep them byte-for-byte identical; place dynamic content afterward.
    • Increase reuse granularity: split long documents into reusable stable blocks to cut repeated input per request.
    • Control output length: set an explicit max output limit, require concise structured output, and avoid lengthy explanations.
    • Tiered model selection: route simple tasks to smaller models or rule-based logic, and call high-capability models only for complex reasoning.
    • Semantic caching: build a result cache for frequent similar questions and return hits directly, bypassing all three billing tiers.
    • Observability: use logging services and monitoring alerts to track token consumption across the three tiers by business dimension, attributing cost to specific features.

    Illustrative usage estimation logic:

    1. def estimate_cost(tin, tcache, tout, p_in, p_hit, p_out):
    2. return (tin - tcache) * p_in + tcache * p_hit + tout * p_out
    3. # After prefix stabilization, cached tokens rise and the bill drops significantly
    4. before = estimate_cost(120_000, 10_000, 8_000, 20, 2, 100)
    5. after = estimate_cost(120_000, 110_000, 8_000, 20, 2, 100)
    6. print(before, after)

    6. Three Takeaways for Decision Makers

    First, evaluate models not by unit price alone, but with weighted estimates based on your own input/output distribution. Second, treat cache hit rate as a core engineering metric in capacity and budget planning. Third, do cost optimization at the architecture level rather than relying on after-the-fact prompt compression. If an organization has already deployed related capabilities on platforms such as Baidu AI Cloud, it can combine general-purpose offerings (for example object storage, message queues, container platforms, logging services, and monitoring alerts) to build a complete usage attribution pipeline, turning token cost into something measurable and governable.