The Economics Behind LLM Subscriptions: KV Caching and Speculative Decoding

    This article explains why AI coding tool subscriptions that appear heavily underpriced are actually profitable. By breaking down how KV caching makes repeated context nearly free to process and how speculative decoding accelerates token generation in pattern-heavy code workloads, it shows that the real compute cost behind "billions of tokens" is an order of magnitude lower than API list prices suggest. It also offers practical guidance for developers on maximizing cache hits and evaluating provider pricing models.

    The Economics Behind LLM Subscriptions: KV Caching and Speculative Decoding

    1. A Bill That Doesn’t Add Up

    A story has been circulating among AI developers recently: a senior engineer reviewed a year of subscription bills for an AI coding tool and found that a $200 annual plan had consumed tens of billions of tokens. Priced at standard pay-as-you-go API rates, that usage would be worth tens of thousands of dollars. Faced with this enormous gap between nominal value and actual payment, many concluded that vendors must be “burning cash to buy market share.”

    Similar calculations are widespread. Analysts working backward from real usage data have found that the weekly token volume carried by mainstream subscription plans, converted at API prices, often amounts to dozens of times the subscription fee. On the surface, this looks like a classic “subsidize to conquer the market” strategy — and some even worry whether vendors can sustain runaway compute costs.

    The truth is the opposite: the first lesson of inference engineering is that tokens that hit the cache incur almost no additional compute cost, and speculative decoding dramatically improves decoding efficiency in long-session scenarios. Coding workloads happen to push both techniques to their limits. Once you understand this, it becomes clear why seemingly “loss-making” subscriptions are actually a profitable business.

    2. The Key Question: Are All Consumed Tokens Newly Computed?

    To settle the accounts, we first need to answer one question: of the billions of tokens a user consumes, how many are actually “original computation” generated token by token by the model?

    The answer is: nowhere near all of them. In early conversational interactions, the user asks one question and the model answers once; compute grows linearly with each turn, leaving little room for cache reuse. Coding scenarios changed this completely — their interaction patterns, context structure, and request characteristics are naturally suited to large-scale cache reuse and accelerated inference.

    3. Pillar One: KV Caching — Near-Zero Marginal Cost

    3.1 What Is KV Caching?

    Inference in the Transformer architecture has two phases: prefill and decode. During prefill, the model computes attention over the full input context layer by layer, generating and caching Key and Value vectors for every token. In the subsequent decode phase, as long as the context hasn’t changed, these KV vectors can be reused directly without recomputation.

    This means: the cost of reading existing KV cache entries is negligible compared to computing an entire context segment from scratch.

    3.2 Why Coding Is the Perfect Match for KV Caching

    Coding interactions have three distinctive traits that maximize cache reuse:

    1. Very long, highly overlapping context. A project’s code files easily run to thousands of lines. Within a coding session, the system prompt, project structure descriptions, and existing code snippets recur across a large number of requests. These repeated parts only need to be computed once; everything after that is a cache hit.

    2. Incremental edits. A programmer’s instructions are typically “add a check inside this function” or “refactor this section.” In each request, the genuinely new tokens may be only a small fraction — over 90% of the preceding context is identical to the previous turn and can be read directly from cache.

    3. High-frequency iteration. Coding is a loop of “change a line, run it, check the result.” The number of requests per unit of time far exceeds ordinary conversation, amplifying the cost savings from cache hits many times over.

    A simplified illustration:

    1. Request 1: [system prompt 2000 tokens][project context 20000 tokens][instruction 200 tokens]
    2. → Prefill cost: computation for 22000 tokens
    3. Request 2: [system prompt 2000 tokens][project context 20000 tokens][edited code 500][instruction 200 tokens]
    4. → Cache hit: 22000 tokens (near-zero cost)
    5. → Actual computation: only the 700 new tokens

    On paper, the second request consumed 22,700 input tokens; in terms of compute cost, the real workload was prefilling only 700 tokens plus a small amount of decoding. This is the first source of the dozens-fold gap between “nominal usage” and “real cost.” It’s also why the industry has widely adopted tiered cache pricing — cached tokens are billed far lower than newly computed ones.

    4. Pillar Two: Speculative Decoding — Multiple Tokens per Forward Pass

    4.1 How It Works

    Traditional autoregressive decoding produces one token per forward pass, and during the decode phase large models are bottlenecked by memory bandwidth, leaving GPU compute utilization low. Speculative decoding uses a lightweight draft model to quickly guess several candidate tokens, then has the main model verify all the guesses in parallel in a single pass. Accepted tokens effectively yield “multiple outputs from one forward pass”; rejected portions are discarded and regenerated.

    Because the parallel cost of verifying multiple tokens is close to verifying a single one, speculative decoding can multiply decoding throughput by several times while keeping the output distribution unchanged.

    4.2 Why Coding Benefits the Most

    The speedup from speculative decoding depends on the draft model’s hit rate — and code is one of the most predictable text types there is:

    • Highly patterned: variable naming, function signatures, boilerplate code, and repetitive syntax structures all follow strong local patterns, giving the draft model a much higher hit rate than free-form writing.
    • Repetition and symmetry: paired brackets, loop bodies, and families of similar functions let the draft model “guess” long stretches correctly.
    • Long sessions with high output: coding sessions produce large outputs across many turns, so the acceleration compounds continuously over total volume.

    Combined, these two techniques compress the real compute cost per nominal token in coding scenarios by more than an order of magnitude.

    5. Recalculating the Books

    With this analysis, the business logic of subscriptions becomes clear:

    Dimension Nominal View Real-Cost View
    Input tokens Billed at full volume Mostly KV cache hits, near-zero cost
    Output tokens Billed per token generated Speculative decoding raises throughput, sharply lowering marginal cost
    Time distribution Evenly spread across the day Usage concentrates in off-peak hours, utilizing idle compute

    Two amplifying factors remain. First, while subscriber usage is high in aggregate, the distribution is extremely uneven — heavy users are a limited share, and most users consume far below the cap. Second, subscriptions bring predictable cash flow and very low acquisition friction, diluting overall operating costs.

    So after discounting for cache hits and decoding acceleration, those seemingly “dozens-fold subsidies” don’t necessarily translate into negative gross margins — they may in fact be quite healthy.

    6. Takeaways for Developers and Enterprises

    Understanding this cost model has direct value for technology selection and cost optimization:

    1. Make good use of context caching. When calling LLM APIs, place stable system prompts and project descriptions at the front of the context and keep them unchanged. This significantly improves cache hit rates and reduces actual spending.
    2. Control the “volatile parts” of the context. Put frequently changing content (such as the latest code snippets) at the end of the context. Insertions in the middle invalidate all subsequent cache.
    3. Evaluate providers on their caching policies. Platforms differ widely in how they price cache hits, which directly affects the real cost of long-context applications.
    4. Code generation workloads are inherently low-cost. If your business centers on code completion or structured text generation, its marginal cost is often lower than intuition suggests, leaving more room to design your business model.

    7. Conclusion

    Both “windfall profits” and “charity” are illusions produced by looking only at nominal token counts. The true cost of LLM inference depends on engineering details such as cache hit rates, decoding efficiency, and load distribution. KV caching makes repeated context nearly free, and speculative decoding makes code generation fast on top of fast — together, these two techniques explain why coding-tool subscriptions can “look like a loss while actually making money.”

    For developers, this is not just a key to understanding the industry’s business logic; it’s also a practical guide to optimizing the cost of your own AI applications: in the inference era, saving money isn’t about using fewer tokens — it’s about making every token’s computation worth its price.