Skip to content
eWiki The practical AI reference

AI Tool Glossary

What Is Prompt Caching in the Claude API and When Should You Use It?

Alternating white and translucent rectangular blocks arranged in a row, with a blue glow inside the central block.

Claude prompt caching lets the Claude API reuse a previously processed prompt prefix when later requests share that prefix. It can reduce repeated processing time and input costs for applications that repeatedly send stable instructions, examples, documents, tool definitions, or conversation history.

How Claude Prompt Caching Works

Claude prompt caching stores a processed prefix for reuse by subsequent matching requests. The eligible prefix follows a defined order: tools, system content, and messages, continuing through the block designated by cache_control.

This makes caching relevant when substantial context stays stable across calls. Documented use cases include prompts with many examples, large background documents, consistent instructions, long multi-turn conversations, coding assistants, document processing, and iterative tool use. The variable portion of each request can follow the stable cached prefix.

Caching is most useful when requests repeat enough context, and occur close enough together, to justify creating and reusing the entry. The documentation’s examples illustrate the mechanism, but they do not guarantee a particular performance improvement for every application.

Stacked white and blue translucent rectangular pieces on a work surface beside black tweezers and a metal ruler.

Automatic Caching vs. Explicit Cache Breakpoints

Automatic caching is enabled with a top-level cache_control field. Claude places the cache breakpoint on the last eligible cacheable block and advances that breakpoint as a conversation grows. This approach reduces configuration work for applications whose reusable context naturally expands over successive messages.

Explicit caching instead applies cache_control to individual content blocks. It gives developers finer control over where cached material ends, which can help when a request contains clearly separated stable and changing sections.

The two approaches can be combined. The practical choice is between the convenience of an automatically moving breakpoint and the placement control of explicit breakpoints. A workflow with straightforward, growing conversation history may suit automatic caching, while a carefully structured prompt with selected reusable sections may benefit from explicit placement.

A person placing a white box with a blue stripe into an open cabinet drawer in a bright archive room lined with shelves.

Cache Lifetimes, Usage Tracking, Costs, and Limits

The default cache lifetime is five minutes, and using an entry refreshes its lifetime. Anthropic also documents a one-hour duration at additional cost. The lifetime begins when the request that writes or reads the entry starts, so response-generation time consumes part of the available window. Follow-up requests that start too late may therefore miss the cache.

The first cached request creates the entry. A later request with a matching prefix can reuse that cached content. As an editorial check, review the usage information for repeated requests alongside the current documentation.

Configuration has limits. Automatic caching consumes one of four available cache-breakpoint slots. A request can return a 400 error when four explicit breakpoints already use every slot, or when the final explicit breakpoint and automatic caching specify incompatible lifetimes.

Costs also require model-specific checking. Anthropic’s product article describes a standard cache write as costing 25% more than base input and a cache read as costing 10% of base input. Current platform documentation identifies different read multipliers for certain supported models, however, and the one-hour duration costs extra. Consult the current pricing for the chosen model before calculating savings.

Conclusion

Claude prompt caching fits API workflows that repeatedly send a substantial, stable prefix within the applicable cache lifetime. Automatic caching favors simpler setup, while explicit breakpoints offer more control over reusable sections.

Identify the stable prefix in one repeated workflow, choose automatic or explicit caching, and make a matching follow-up request within the configured lifetime. As a practical next step, review usage for repeated requests and check the current documentation for the selected model’s cache pricing before estimating savings.

Disclosures and limitations

  • This article was prepared with AI assistance using the cited Anthropic documentation, product material, and cookbook as source material.
  • Pricing and cache behavior can vary by supported model and cache duration; verify the current Anthropic documentation before making implementation or cost decisions.

Sources

Improve this guide

Report a problem or suggest the next question

Submissions enter a private editorial queue. They are reviewed and deduplicated before any public update or new page is created.