Evaluation, Testing & Optimization·Task 4.5·Bloom: apply·Difficulty 3/5·8 min read·Updated 2026-07-14

Prompt Caching for Cost and Latency Reduction

Optimize token usage, latency, and cost-performance trade-offs

SUBy Solomon UdohReviewed by Solomon UdohAI-assisted · human-reviewed
In short
Prompt caching is most effective when the system prompt is long and stable across many requests. It requires explicit cache_control markers, and cache writes cost more per token than standard input on first use, while cached input tokens are billed at the cache read rate on subsequent requests. The default cache TTL is short, on the order of minutes; workloads with request frequency lower than the TTL will not realise consistent savings, and cached content that must reflect live state creates a consistency-window risk.

The biggest cost lever, with conditions

When a cost model comes in over the ceiling, prompt caching is often the most powerful lever available, but it is a lever with conditions, and applying it where the conditions do not hold either saves nothing or introduces a correctness risk. This apply-level knowledge point is about knowing when caching genuinely reduces cost and latency, how its pricing actually works, and the two situations, low reuse frequency and live-state content, where it backfires.

Prompt caching
A mechanism that preserves the processed prefix of a prompt so the API does not reprocess those tokens on later requests. It is most effective for a long, stable system prompt reused across many requests. It requires explicit cache_control markers; cache writes cost more per token than standard input on first use, and cached tokens are billed at the lower cache read rate thereafter. The cache has a short default TTL, so infrequent reuse yields no savings, and caching content that must reflect live state creates a stale-data consistency window.

When caching pays off

Caching works by preserving the processed prefix of the prompt, so the model does not reprocess those tokens on every request. That means the win comes from two things multiplied together: how long the cached prefix is, and how often it is reused. A long, stable system prompt hit across many requests is the ideal case, lots of tokens saved, many times over. The prefix has to be stable, though: if the cached portion changes between requests, there is nothing to reuse, and the benefit disappears.

So the profile for caching is specific: a long system prompt (or other prefix) that stays the same across a high volume of requests. That is exactly the shape of many production deployments, which is why caching is such a common and effective cost lever, but it is not automatic.

The pricing has two rates and a write cost

Caching does not make the cached tokens free; it reprices them. On the first request that establishes the cache, the cached tokens incur a cache write cost that is higher per token than standard input, because writing the cache is extra work. On every subsequent request that hits the cache, those same tokens are billed at the cache read rate, which is much lower than the standard input rate. The net saving is the difference between paying standard input every time and paying one elevated write plus many cheap reads.

This is why the cost model has to account for the write cost on first use, not just the read savings. If you only model the cheap reads, you overstate the benefit; the honest calculation nets the one-time write premium against the repeated read savings, and the more reuse there is, the more the reads dominate and the bigger the net win.

Two ways caching backfires

The first way caching disappoints is when reuse is too infrequent relative to the cache TTL. The cache entry lives only for a short time, a default of roughly five minutes, and then expires. If requests arrive less often than the TTL, every request finds an expired cache and pays the write cost again, never reaching the cheap reads that make caching worthwhile. A workload has to be frequent enough, relative to the TTL, to keep hitting a live cache, or the "savings" are just repeated write premiums.

The second way is a correctness problem, not a cost one. Cached content is frozen for the life of the cache entry, so if you cache content that must reflect current, live state, the served responses can be stale for the duration of the consistency window. For a use case that depends on up-to-the-moment data, that staleness can be unacceptable, caching has traded correctness for cost. The rule is to cache stable content (the unchanging system prompt), not live-state content that has to be current. (TTL length and the exact read/write rates are set by current pricing and should be confirmed when modelling.)

long + stable + reused
the profile where caching pays off
write once, read cheap
elevated write cost, low cache read rate after
TTL + live state
the two ways caching backfires

What the exam trips candidates on

The first trap is assuming prompt caching always reduces cost, without checking that request frequency is high enough relative to the cache TTL to actually reuse the cache. A scenario will apply caching to a low-frequency workload; the credited reading points out that if requests arrive less often than the TTL, the cache expires between uses and only the write premium is paid, so caching adds cost rather than saving it.

The second trap is caching content that needs to reflect current, live state, introducing stale-data risk inside the cache's consistency window. A scenario will cache a prefix containing live data; the correct answer flags the consistency window and restricts caching to the stable portion of the prompt, keeping live-state content out of the cache.

Worked example

A team has a customer-service assistant with a 5,000-token system prompt that is identical on every request, serving 50,000 requests a month spread evenly through the day. They also want to cache a block of 'current account balances' they inject into each prompt. Advise on what to cache and what the cost effect will be.

Split the request into what should be cached and what should not, because the two parts have opposite profiles.

The 5,000-token system prompt is the textbook case for caching: it is long and identical on every request, and at 50,000 requests a month spread evenly through the day, the request frequency is high, requests arrive far more often than the short cache TTL, so the cache stays warm and nearly every request after the first hits it. The cost effect is a large net saving: the first request pays the elevated cache write cost on the 5,000 tokens, and the tens of thousands of subsequent requests pay the much lower cache read rate on that prefix instead of the standard input rate. Because reuse is so frequent, the one-time write premium is trivial against the repeated read savings, and the long prefix also cuts latency since those tokens are not reprocessed each time. The cost model should reflect the write-once, read-cheap pattern, not just the reads.

The block of current account balances is the opposite case and must not be cached. It is live-state content: the balances change, and a cached copy would be frozen for the life of the cache entry, so during the consistency window the assistant could serve stale balances. In a customer-service context that is a correctness failure, exactly the risk caching live-state content introduces. Keep the balances out of the cached prefix, inject them fresh on each request (or retrieve them at request time), and cache only the stable system prompt.

The general rule the example illustrates: cache the long, stable, frequently-reused prefix for its large net saving, and exclude anything that must reflect current state to avoid the consistency-window risk.

Common misreadings to avoid

Misconception

Prompt caching always reduces cost, so it should be turned on wherever there is a system prompt.

What's actually true

Caching only saves when reuse is frequent relative to the short cache TTL. If requests arrive less often than the TTL, the cache expires between uses and each request pays the elevated write cost again, so caching can increase cost. Check the reuse frequency first.

Misconception

Anything in the prompt can be cached to save money, including current data.

What's actually true

Cached content is frozen for the life of the cache entry. Caching live-state content that must be current introduces a consistency window during which stale data is served, which can be unacceptable. Cache only the stable prefix, not live-state content.

How this shows up on the exam

Domain 4 questions on this knowledge point present caching applied to a low-frequency workload or to live-state content. The reliable moves are to confirm the prefix is long and stable and reused frequently relative to the TTL, to model the write-once/read-cheap pricing honestly, and to keep live-state content out of the cache to avoid the consistency-window risk.

This is the main optimization lever built on cost and latency modeling inputs, and it directly attacks the input-cost side that token distribution skew inflates. Its latency benefit connects to p95 latency as the design target, and caching sits alongside the other production controls in layered reliability controls as part of a well-engineered call path.

Check your understanding

A workload has a long, stable system prompt but receives only a few requests per hour, and the team also wants to cache a block of live inventory counts. What is the correct guidance?

People also ask

When is prompt caching most effective?
When the system prompt is long and stable and reused frequently; savings scale with the prefix length and how often it is hit.
Does prompt caching always reduce cost?
No. Cache writes cost more on first use, and if reuse is less frequent than the TTL the cache expires between uses, so caching can add cost rather than save it.
What is the risk of caching live-state content?
Cached content is frozen for the life of the entry, so live-state content served from cache can be stale within the consistency window, which may be unacceptable.

Watch and learn

Official Anthropic Academy lessons first, then hand-picked walkthroughs. Videos load only when you press play.

No videos curated for this concept yet

We are still curating the best official and community videos for this topic.

Official prep for this domain

Anthropic's own free prep module for this part of the syllabus, on the official prep course. Free with an Anthropic Academy sign-in.

References & primary sources

Adaptive study

Master this concept with Archie

Practice it inside an adaptive study session. Archie, your Socratic AI tutor, tracks your mastery with Bayesian Knowledge Tracing and schedules the perfect next review.

Start studying