LLM API Tiered Pricing: The Cost Logic Behind Prefix Caching and How to Optimize Your Bill

    A major LLM provider recently raised API prices for its flagship model—but the increases are far from uniform. Output tokens jumped nearly 4x, cache-missed input roughly 3x, while cache-hit input stayed nearly flat. This tiered price structure reflects the real cost of inference: prefill, decode, and KV cache reuse. This article breaks down the pricing logic, compares actual costs across workloads, and shares practical engineering techniques—from prefix stabilization to model routing—to systematically cut Agent-era inference costs.

    1. Three-Tier Pricing Hides in the Price List

    A leading LLM provider recently released a new flagship model with noticeably higher API pricing: output prices rose from roughly 27 RMB to 100 RMB per million tokens—close to a 4x increase. Input prices for cache misses rose from 6.5 RMB to 20 RMB, and cache hits from around 1 RMB to 2 RMB, an overall increase of about 3x. On the surface, this looks like a blanket price hike. But when you break down the pricing structure, a more interesting signal emerges: the price ratios between tiers are being deliberately widened.

    In the previous generation, uncached input cost about 6x the cached input price; the new model widens that ratio to 10x. Output price relative to cached input went from roughly 25x to 50x. In other words, the price curve isn’t shifting uniformly upward—it’s forming a clear “scissors gap”:

    • Cached input tier: mildest increase, nearly matching the previous generation;
    • Uncached input tier: moderate increase;
    • Output tier: the most aggressive increase.

    This structure is anything but arbitrary. Pricing is guidance—the provider is using price signals to tell users: the more “inference-friendly” your request patterns are, the bigger the de facto discount you get.

    2. Why Pricing Favors Cache Hits

    To understand this pricing logic, you need to look at the cost structure of LLM inference.

    An inference request roughly involves two phases: the Prefill phase processes all input tokens, with compute scaling with input length; the Decode phase generates output token by token, and each step reads and writes the entire KV Cache, making it highly sensitive to memory bandwidth. In Agent workloads, inputs are often extremely long contexts—system prompts, tool definitions, conversation history, and retrieved content can easily reach tens of thousands of tokens. If every inference step recomputes the prefix, GPU compute gets wasted on redundant work.

    The industry-standard solution is prefix caching combined with disaggregated inference architecture: deploying Prefill and Decode on separate compute pools, persisting highly reusable prefix KV Caches, and letting subsequent requests that hit the cache skip redundant computation. The higher the hit rate, the lower the marginal inference cost per token.

    So the low cached-input price is essentially passing the “saved compute” back to users, while the high output price reflects the fact that bandwidth and memory consumption during Decode are real, rigid costs—tasks with long outputs and long contexts genuinely cost more. The pricing structure is a mirror of the inference cost structure.

    3. Cost Estimates for Two Real-World Scenarios

    Listed prices are nominal; actual cost depends on workload shape. Here are two illustrative scenarios.

    Scenario A: Enterprise-grade long-running Agent. Input-to-output ratio of about 20:1 (common for long-context coding Agents), highly reusable prefixes, 90% cache hit rate:

    • Effective input price ≈ 2 × 0.9 + 20 × 0.1 = 3.8 RMB per million tokens
    • Output price = 100 RMB per million tokens
    • Blended cost ≈ (20 × 3.8 + 1 × 100) / 21 ≈ 8.4 RMB per million tokens

    Scenario B: Individual developer, low-frequency calls. Each prompt is different, cache hit rate only 20%, input-to-output ratio 5:1:

    • Effective input price ≈ 2 × 0.2 + 20 × 0.8 = 16.4 RMBidth per million tokens
    • Blended cost ≈ (5 × 16.4 + 1 × 100) / 6 ≈ 30.3 RMB per million tokens

    Same model, but the former’s unit cost is less than a third of the latter’s. The conclusion is clear: under the new pricing system, workload shape matters more to your bill than the listed price. Enterprise customers running the same system prompts with highly reusable prefixes effectively get a discount; callers with highly random prompts that can’t leverage the cache pay full price—or a relative premium.

    4. From the Chat Era to the Agent Era: A Cost Paradigm Shift

    In traditional chat scenarios, a single interaction involves only a few hundred to a few thousand tokens, so unit price didn’t matter much. The Agent paradigm changes the scale of token consumption entirely: a complex task may involve thousands of tool calls, context accumulating to hundreds of thousands of tokens, with multiple Agent instances running in parallel for days. At that scale, every doubling of unit price amplifies total cost by hundreds or thousands of times.

    This yields two engineering takeaways:

    1. Cost evaluation must be based on end-to-end tasks, not single calls. To judge whether an Agent solution is economical, measure “how many tokens a task consumes and what the cache hit rate is,” then plug those into the tiered pricing—don’t rely on gut feelings about output unit price.
    2. Cache hit rate is now a first-class engineering metric. Like latency and accuracy, it needs to be continuously monitored and included in alerting systems.

    5. Cost-Reduction Engineering Practices for the Agent Era

    Given this cost structure, developers can systematically optimize in several directions:

    1. Stabilize prompt prefixes. Put static system prompts, tool definitions, and specifications at the very front of the prompt, and dynamic content (user input, intermediate results) at the end. Any change in the middle of the prefix invalidates the cache for everything after it. Consider version-controlling your prompt templates and avoiding frequent tweaks to the prefix.

    2. Manage context window budgets. Establish a token budget mechanism: summarize and compress conversation history rather than appending indefinitely; trim lengthy tool outputs before injecting them into context; where possible, replace full history replay with “structured state + on-demand retrieval.”

    3. Control the output side. Output tokens are the most expensive tier in the pricing structure. You can reduce Decode-phase consumption by constraining output format (e.g., asking the model to return only structured results instead of lengthy explanations), capping maximum generation length, and splitting long-form generation into multiple review-and-refine steps.

    4. Task-level cost accounting. Instrument your call chain to track input/output token counts and cache hit rates per task, and build a cost dashboard. For example:

    1. def estimate_cost(input_tokens, output_tokens, hit_rate):
    2. price_hit, price_miss, price_out = 2, 20, 100 # RMB per million tokens
    3. input_cost = input_tokens * (hit_rate * price_hit
    4. + (1 - hit_rate) * price_miss) / 1e6
    5. output_cost = output_tokens * price_out / 1e6
    6. return input_cost + output_cost
    7. # An Agent task with 100K input tokens, 5K output tokens, 90% hit rate
    8. print(estimate_cost(100_000, 5_000, 0.9)) # about 0.88 RMB

    5. Tiered model routing. Not every inference step needs the flagship model. Lightweight steps like planning and tool selection can be routed to smaller, cheaper models, reserving the large model for critical reasoning steps—a cascading architecture that spreads out total cost.

    6. Leverage cloud platform capabilities for stability. Enterprise-grade long-running Agent tasks place high demands on inference service elasticity and reliability. You can use container platforms for elastic scaling of inference workloads, log services and monitoring alerts to track token consumption and hit-rate anomalies, and object storage to persist intermediate states and task checkpoints—avoiding the waste of full recomputation when long tasks are interrupted.

    6. Conclusion

    What looks like an aggressive price adjustment is actually an honest reflection of inference cost structure in pricing: output is expensive because Decode-phase bandwidth and memory costs are rigid; cache hits are cheap because prefix reuse genuinely saves compute. For developers, the right way to read this price list isn’t to complain about the hike—it’s to re-examine your workload shape. In the Agent era, architecture design capability is itself a cost advantage. Whoever achieves higher cache hit rates, more restrained outputs, and smarter task scheduling gains order-of-magnitude cost savings under the exact same pricing system.