Breaking Down LLM Inference Pricing: Cache Hits and Agent Costs

    This article explains why a single per-million-token price is an incomplete guide to LLM inference costs. It compares cache-miss input, cache-hit input, and output prices together, then uses cache hit rate and input-output ratio to estimate an effective unit cost. It also covers why output pricing matters more for agent and long-context workloads, why sparse MoE models are not automatically cheap, and how teams can build a cost model. The analysis uses normalized illustrative prices, not any specific product's pricing.

    LLM inference pricing has become harder to read from a single price per million tokens. As services handle agent and long-context coding workloads, a more useful approach puts three prices in one table: cache-miss input, cache-hit input, and output. Compare their ratios, then combine them with the cache hit rate and input-output ratio of your real workload to estimate an “effective unit cost.” This article uses a set of normalized illustrative prices to explain the logic. It does not refer to any specific product’s pricing and is intended only for technical cost analysis.

    1. Look at the Billing Structure, Not a Single Price

    LLM inference is usually billed in three token categories: input that misses the cache, input that hits the cache, and output. Each consumes different resources. Cache-miss input requires a full prefill computation. Cache-hit input reuses an existing KV Cache. Output enters the token-by-token decoding stage, which keeps memory bandwidth and scheduling resources busy for as long as it runs. For this reason, the relative ratios among the three prices tell you more than the absolute numbers.

    Suppose one model generation uses these normalized prices: cache hit at 1 unit, cache miss at 10 units, and output at 50 units. The previous generation was roughly 1 unit for cache hit, 6 units for cache miss, and 25 units for output. Two signals stand out. First, the ratio of cache miss to cache hit widened from about 6x to about 10x. Second, the ratio of output to cache hit widened from about 25x to about 50x. In other words, the cache-hit tier stayed relatively moderate, while the output tier rose more sharply. This ratio shift is central to the cost analysis that follows.

    2. How Cache Hit Rate Changes Real Unit Prices

    The effective input price can be estimated with this formula:

    Effective input price = hit price × hit rate + miss price × (1 − hit rate)

    The blended unit cost also depends on the input-output ratio:

    Blended cost = (input-output ratio × effective input price + output price) / (input-output ratio + 1)

    Using the normalized prices (hit 1, miss 10, output 50), compare two scenarios.

    Scenario A: An enterprise agent where system prompts, tool descriptions, and code context are heavily reused. The cache hit rate is about 90%, and the input-output ratio is about 20:1. Effective input price = 1 × 0.9 + 10 × 0.1 = 1.9. Blended cost = (20 × 1.9 + 50) / 21 ≈ 4.19 units per million tokens.

    Scenario B: A developer making infrequent calls, with prompts that differ widely each time. The cache hit rate is about 20%, and the input-output ratio is about 5:1. Effective input price = 1 × 0.2 + 10 × 0.8 = 8.2. Blended cost = (5 × 8.2 + 50) / 6 ≈ 15.17 units per million tokens.

    The gap between the two is about 3.6x. For the same model, the high-reuse agent pays an effective input price close to a discount, while the low-reuse caller pays close to the full cache-miss price plus a high output price. What looks like a uniform price increase is, in practice, a billing structure that rewards prefix reuse and charges a premium for one-off calls with variable prompts.

    3. Why Output Prices Rose Sharply: Agent Workloads and Decoding Resources

    In the chat era, a single interaction often involved tens to thousands of tokens. Output made up a meaningful share, but total consumption stayed limited. Agent workloads are different. Long-context coding, tool calls, and multi-turn planning can quickly inflate the context of a single task. Publicly shared agent practices report single tasks with thousands of tool-call steps and hundreds of thousands of tokens of context, with hundreds of tasks running in parallel over several days. Such workloads may reach an input-output ratio of 20:1 or higher. Output tokens are a small fraction of the total, but every decoding step continuously occupies memory bandwidth and scheduling resources.

    More importantly, in long-context settings, KV Cache storage, memory footprint, and decoding bandwidth consumption grow linearly or even super-linearly with context length. Input can lower prefill cost through cache reuse. Output, however, must be generated token by token and cannot be reused the way a prefix cache can. The higher output price therefore reflects the scarcity of decoding resources and the real cost of serving long contexts. Running high-frequency, long-context tasks at old prices can easily lead to cost inversion, where serving costs exceed what the prices cover.

    4. Sparse Architectures Do Not Automatically Mean Low Cost

    Larger sparse Mixture-of-Experts (MoE) architectures limit per-token computation by activating only a subset of experts. However, a small number of active parameters does not mean low total cost. A larger total parameter count keeps more weights resident in memory, and weight loading and parallel communication become more complex. Expert routing adds cross-device communication overhead. KV Cache usage grows with concurrency and context length. Operator and kernel optimization for hybrid attention mechanisms also requires ongoing engineering investment. Batch scheduling, cache management, and fault recovery all affect the unit cost per token. Price changes should therefore be read as a redistribution of costs across inference infrastructure, memory capacity, communication bandwidth, and engineering optimization.

    5. Diverging Bills for Enterprise Customers and Individual Developers

    Enterprise customers usually have stable system prompts, fixed tool schemas, reusable code prefixes, and high input-output ratios. They can achieve high cache hit rates, which keeps effective input prices well below the cache-miss list price. Individual developers and low-frequency callers face the opposite situation. Their prompts vary from call to call, so cache hit rates are low. Their input costs approach the cache-miss price, and their output is billed at the higher rate, so their blended cost is higher. The same model therefore produces a split: enterprise bills look discounted, while individual developer bills carry a premium. When evaluating costs, focus on three metrics: cache hit rate, input-output ratio, and output token share, rather than the first row of the price table.

    6. Engineering Practice: Build a Cost Model and Optimize

    First, build an observable cost model that continuously collects cache hit rate, input-output ratio, and output token count. Example code:

    1. def effective_input(hit_price, miss_price, hit_rate):
    2. return hit_price * hit_rate + miss_price * (1 - hit_rate)
    3. def blended_cost(hit_price, miss_price, output_price, hit_rate, io_ratio):
    4. ei = effective_input(hit_price, miss_price, hit_rate)
    5. return ei, (io_ratio * ei + output_price) / (io_ratio + 1)
    6. for name, hit_rate, io_ratio in [("High-reuse agent", 0.9, 20), ("Low-reuse calls", 0.2, 5)]:
    7. ei, bc = blended_cost(1, 10, 50, hit_rate, io_ratio)
    8. print(name, "effective input=%.2f blended=%.2f" % (ei, bc))

    Second, optimize prefix reuse. Keep system prompts, tool descriptions, and example order stable, and move dynamic content later in the prompt to reduce cache invalidation. Third, trim and summarize context to reduce the size of cache-miss input. Fourth, control output through structured formats, maximum token limits, stop sequences, and step-by-step generation. Fifth, set SLAs by scenario. Enterprise agents and low-frequency tool calls should use different cost models and budget thresholds.

    7. Conclusion: Price Lists Are Signals, and Real Cost Is a Function of Workload

    Discussing LLM inference pricing should go beyond how much prices have risen. Cache hit rate and input-output ratio change effective unit prices substantially. The rise in output pricing reflects the resource pressure of long contexts and decoding. Sparse MoE architectures are not free either. For enterprises, high cache reuse, stable prefixes, and long-context agents can spread unit costs over more work. For low-frequency callers with variable prompts, costs are closer to the full cache-miss price or even a premium. Understanding billing structure and workload characteristics is necessary for accurately assessing and optimizing inference costs in the agent era.