Study FAQ
When does Claude prompt caching reduce cost for repeated API requests?
Also asked as 2
- How do I tell whether a repeated Claude prompt prefix is worth caching?
- What should I measure before enabling Claude API prompt caching?
Answer
Claude prompt caching can reduce total cost when a sufficiently long, eligible prefix is reused enough times before expiration. Keep stable instructions, tool definitions, or shared reference materials ahead of request-specific content. Set a documented cache breakpoint, then compare observed cache writes and reads against uncached operation. Prefix matches must follow the API's matching rules. Prompt caching
Check the minimum cacheable length, available TTLs, isolation and retention policy, and model or provider support. A changing prefix or a long gap between requests can lead to another write. Cache writes can cost more than ordinary input, while hits use the cache-read rate. Measure cache_creation_input_tokens, cache_read_input_tokens, latency, and hit frequency on your workload, then price creation, reads, and the remaining uncached tokens with their respective rates. Prompt caching Claude pricing
For example, a large shared handbook used repeatedly in one short window may repay the initial write. The same handbook may cost more to cache if each request sees a changed revision or arrives after the entry expires. Recheck the results after changing prefix content, the model, or the traffic pattern. Prompt caching Optimizing for cost and intelligence
Full explanation
Claude Model Selection, Thinking, Token, and Cost Tradeoffs
Study guide · CCDV-F
Read the full explanation