Cached input pricing and how to actually hit it
Every major API provider now advertises a discount for “cached input tokens.” The pitch is simple: send the same chunk of context twice, pay less the second time. In practice, a lot of teams turn this on, watch their bill, and see almost no change. The discount is real, but it only fires under specific conditions, and most default usage patterns don’t meet them.
This is a mechanics post, not a price comparison. I’m not going to quote you exact per-token rates, because they change often enough that anything I print here will be stale by the time you read it, and I’m not going to hand you benchmark numbers I didn’t personally run. What I can walk through is how the caching layer actually works underneath the API, because once you understand the mechanism, the “why isn’t this saving me money” question answers itself.
What “cached input” actually means
When you send a prompt, the model has to convert your text into key/value attention state before it can generate anything. For a long system prompt, a big tool schema, or a chunk of retrieved documents, that conversion work is the same every single time you send it, token for token. Prompt caching is the provider storing that computed state server-side so a repeat request can skip recomputing it.
That’s the whole trick. It is not a semantic cache. It doesn’t recognize “this is basically the same question as last time.” It recognizes “these bytes, in this exact order, starting from the beginning of the prompt, are identical to something I already processed.” Change one character early in the prompt and the entire cache for everything after that point is invalid, even if the last 90% of your prompt is unchanged.
The pricing shape, generically
Across the providers I’ve used, the pattern is the same even though the exact multipliers differ and shift over time: writing to the cache costs a bit more than a normal input token, and reading from the cache costs a lot less than a normal input token. You’re trading a small upfront premium for a large discount on every subsequent hit.
That framing matters because it changes what question you should be asking. It’s not “is caching cheaper.” It’s “how many times will I reuse this exact prefix before it expires.” If the answer is once, you paid the write premium for nothing. If the answer is dozens of times inside the cache’s lifetime, the write premium is noise and the read discount dominates your bill.
Here’s the shape of that math with made up but representative numbers, just to make it concrete. Say a block of context costs 1.0 unit per token to send normally, 1.25 units to write into the cache, and 0.1 units to read from the cache on a hit. Send it once with no caching: 1.0 unit. Send it once with caching enabled: 1.25 units, worse. Send it ten times with caching: 1.25 + 9(0.1) = 2.15 units, versus 10.0 units with no caching. The savings only show up on reuse, and they show up fast once reuse happens.
Why the cache doesn’t hit by default
The most common reason teams don’t see savings is prompt ordering. Caching works front to back: the provider hashes your prompt from the start and finds the longest prefix that matches something already stored. Anything you put before your stable content, even a timestamp, a request ID, or “today’s date is X,” breaks the match for everything after it.
So the practical rule is: put the volatile stuff last. System instructions, tool definitions, retrieved documents, few-shot examples, anything that’s identical across many calls, all of that goes at the front of the prompt. The user’s actual question, today’s date, session-specific variables, that goes at the end. If you build your prompt by string-concatenating “here’s the current context” ahead of your system prompt because it felt natural to write it that way, you have silently disabled caching for the whole request.
The second most common reason is prompt drift you don’t notice. RAG pipelines are a classic offender: if your retrieval step returns documents in a slightly different order run to run, or if you’re stuffing in a live “results found: 47” count before the retrieved chunks, every call looks unique to the cache even though the retrieved content is 95% the same underlying corpus. The fix is the same idea again: put anything nondeterministic after the stable block, and if you can, sort or normalize retrieved content so identical queries produce identical prefixes.
Multi-turn chat has its own version of this. In a growing conversation, only the prefix up to (but not including) the newest turn can be a cache hit, because the newest turn is by definition new. That’s fine and expected, it’s how the mechanism is supposed to work, but it means your savings scale with how long conversations run, not with how many conversations you have. A product with lots of short one-and-done exchanges will see much less benefit than one with long back-and-forth sessions built on a shared system prompt.
TTL is not free storage
The cached state is held for a limited window, short by default in most implementations, with some providers offering a longer-lived tier at a higher write cost. If the time between calls that reuse the same prefix is longer than that window, you get a cache miss and pay the write cost again, with nothing to show for it.
This matters for batch and cron-style workloads more than anyone expects. If you’re processing a queue of documents against the same system prompt but there’s a 20-minute gap between batches because of rate limiting or a slow upstream step, and your provider’s default TTL is measured in single-digit minutes, you’re paying write premiums on every batch and never reaching the read discount. The fix isn’t complicated, it’s just easy to miss: either keep the request rate high enough that the cache stays warm, or pay for the extended TTL tier if the provider offers one and the math still works out in your favor.
Where caching doesn’t help at all
Small prompts. If your system prompt is 200 tokens, the compute you’re saving by caching it is trivial next to the fixed overhead of the request itself, and the write premium may eat the entire benefit. Caching earns its keep on large, stable blocks: long system prompts, big tool/function schemas, retrieved document sets, few-shot libraries. Wiring it up only pays off when your prompt has a chunk like that; otherwise the added complexity in your request builder isn’t worth it.
It also doesn’t help with output tokens at all. Generation is generation, there’s no discount on what the model writes back, so a workload that’s expensive because it produces long responses won’t be touched by prompt caching no matter how you structure the input.
A short checklist before you claim the discount
Before you tell your team caching is saving money, check these:
- Is the stable content actually first in the prompt, with nothing volatile ahead of it?
- Is the stable content byte-identical across calls, including whitespace and ordering of any injected lists?
- Are calls happening frequently enough to land inside the cache TTL, or are you paying write costs every time?
- Is the cached block big enough that the write premium is worth paying at all?
If you can answer yes to all four, look at your actual token usage breakdown from the API response, most providers report cached versus uncached input tokens per call, rather than trusting that flipping a flag did the work for you. That number is the only honest way to know if you’re actually hitting the cache or just paying extra to miss it.
If you want more breakdowns like this on the mechanics behind AI tool pricing and how to actually get what you’re paying for, come find us at AI Tool Gazette.