What is Prompt caching?
Reusing a previously-sent prompt prefix (system message, tool list, large context) at a fraction of the normal token cost. Anthropic's ephemeral cache has a 5-minute TTL. Pins system prompts to slash routine-job cost by 60–90%.
How it works
Prompt caching lets a request resume from a previously processed prefix of the prompt, in the order tools, then system, then messages, up to a cache_control marker. Because the repeated part is not reprocessed, it is faster and cheaper. You can turn it on with a top-level cache_control setting, or place up to four explicit breakpoints on individual content blocks.
Lifetime and price (Anthropic API)
The default cache lifetime is five minutes and is refreshed each time the cached content is used; a one-hour option costs more. Relative to the normal input price, writing a five-minute cache costs 1.25 times, writing a one-hour cache costs 2 times, and reading from the cache costs a fraction of the input price (0.1 times for most models, lower for some newer ones). Check the current pricing page for the exact figure for your model.
What breaks a cache
A hit needs an identical prefix up to the marked block, so any change to the cached content is a miss. Changing tool definitions invalidates the tools, system and messages caches; changing tool_choice or adding or removing images invalidates the messages cache. Prompts shorter than the model's minimum cacheable length (512 to 4,096 tokens depending on the model) are processed without caching and without an error.
Example
An agent sends the same 20,000-token system prompt and tool list on every turn. Marking that prefix for caching means turns after the first read it from the cache at a fraction of the input price, as long as the prefix stays byte-for-byte identical and turns arrive within the cache lifetime.
Sources
See also
← Back to the full AI agent glossary.