Your personal memory, across sessions, agents, and devices.

Claude Prompt Caching: How It Works, Pricing and TTL

memU Team memU Team

Claude prompt caching lets the API reuse the processed form of a prompt prefix it has seen recently, so repeated context costs a fraction of the normal input price. Anthropic launched it in public beta on August 14, 2024. It now has an automatic mode and a one-hour lifetime option. On some models, reads cost as little as 0.025 times the base input price. Below we cover how it works and what it costs, then the mistakes that cause silent misses. Memory across sessions needs something else, covered at the end.

What is Claude prompt caching, in one sentence?

Prompt caching stores the processed state of an exact prompt prefix for 5 minutes or 1 hour, so later requests with the same prefix pay a reduced cache-read price.

The prompt caching docs define the prefix in a fixed order: tools first, then the system prompt, then messages. A hit needs that prefix to be identical, byte for byte, up to a cache breakpoint. The model's output is the same as for an uncached request, so only cost and latency change.

How prompt caching differs from memory

Anthropic offers both. Here they are side by side, from the caching docs and the memory tool docs.

Prompt caching Memory tool
What is kept Processed state of an exact prompt prefix Files Claude writes in a memories directory
Lifetime 5 minutes or 1 hour, refreshed on each hit Until you delete the files
Where it lives Anthropic's servers, isolated per workspace Your side: the client executes every file operation
Matching Exact prefix match only Claude decides what to read
Effect on answers None, same output as uncached Changes what Claude knows
Cost effect Cheaper repeated input Normal token prices for what is read

An agent with memory still pays to send what it loads. If that loaded context sits early in a cached prefix, it pays the cache-read price.

How does prompt caching work?

There are two ways to turn it on. Since February 19, 2026, the release notes list automatic caching for the Messages API. You add one top-level cache_control field, and the API places the breakpoint on the last cacheable block. It then moves the breakpoint forward as the conversation grows.

The explicit way is to put cache_control on specific content blocks. You can set up to four breakpoints per request, and automatic caching uses one of those slots. At each breakpoint the API looks back up to 20 blocks for an earlier cache entry it can read. Cache writes happen only at your breakpoints, so a breakpoint placed too late in a long, changing conversation may never hit.

The default lifetime is 5 minutes. Every hit refreshes it at no extra cost. For longer gaps, set the ttl to 1h on the block. The docs note that the clock starts when the request begins. If you mix lifetimes, one-hour entries must come before five-minute ones.

What does Claude prompt caching cost?

Writes cost more than normal input, and reads cost much less. The pricing page sets a five-minute write at 1.25 times the base input price and a one-hour write at 2 times. A cache read is 0.1 times the base price on most models. Some newer models get cheaper reads: 0.05 times on Claude Opus 5.5 and Claude Sonnet 5.5, and 0.025 times on Claude Fable 5.1 and Claude Mythos 5.1.

Model Base input 5-minute write 1-hour write Cache read Output
Claude Opus 5.5 $4 $5 $8 $0.20 $20
Claude Sonnet 5.5 $2 $2.50 $4 $0.10 $10
Claude Haiku 4.5 $1 $1.25 $2 $0.10 $5

Prices are per million tokens. Anthropic's pricing page says a five-minute cache pays for itself after one read, and a one-hour cache after two. The release notes show Sonnet 5.5's read price was cut from $0.20 to $0.10 on October 7, 2026. Caching multipliers stack with other modifiers, such as the Batch API discount.

Caching also helps with rate limits. The rate limits page says only uncached input tokens count toward input tokens per minute on most models. Cache writes do count. Claude Haiku 3.5 is the exception, where reads count too.

What breaks the cache?

Anything that changes the prefix. The docs describe a hierarchy: a change at one level invalidates that level and everything after it. Editing a tool definition invalidates the whole cache, because tools come first. Changing the tool_choice setting breaks it. So does adding or removing images, or changing thinking parameters.

Each model has a minimum cacheable length, and shorter prompts are processed without caching and without an error. The minimum is 512 tokens on the newest models, including Opus 5.5 and Sonnet 5.5. It is 1,024 on models such as Sonnet 4.6. Older models such as Opus 4.5 and Haiku 4.5 need 4,096. Also, a new cache entry is only usable after the first response starts. Parallel requests sent at the same moment can all miss the cache.

To check, read the usage block. It reports cache_creation_input_tokens and cache_read_input_tokens, and input_tokens covers only what came after the last breakpoint.

How does Claude Code use prompt caching?

Claude Code orders every request so stable content comes first: the system prompt and tools, then project context such as CLAUDE.md and auto memory, then the conversation. Its caching docs say it requests the one-hour lifetime on a Claude subscription within your plan's usage, and five minutes otherwise. Each model has its own cache, so switching models mid-session with the model command starts from an empty cache.

Read the fine print

The launch post from 2024 promised cost cuts of up to 90% and latency cuts of up to 85% for long prompts. The release notes give the latency figure as up to 80%. Both are Anthropic's own best-case numbers. Your savings depend on how much of each request is a stable prefix and how often requests arrive within the lifetime.

Isolation depends on the platform. The Claude API isolates caches by workspace. Amazon Bedrock and Google-managed Vertex AI isolate them per organization. Different organizations never share caches, even with identical prompts.

The bottom line

Turn on automatic caching for any agent or chat app that resends a long system prompt or tool list. Use one-hour caching when gaps between requests exceed five minutes, and keep tool definitions stable so you do not pay for rewrites. Check cache_read_input_tokens in your logs, because a silent miss looks exactly like a normal request.

How do you keep what an agent learned once the cache expires?

A cache lasts an hour at most, and it only holds text you already sent. When a Claude Code session ends, the fixes it found are not in any cache. Claude Code's auto memory files, per Anthropic's memory docs, stay on the machine that wrote them. Another device, or another agent such as Codex, starts without them.

memU keeps that knowledge where every connected host can read it. The agent decides what to keep and writes it as readable Markdown files, for memory or for reusable skills. memU makes no LLM calls of its own. It stores and embeds those files and returns them when asked.

A standing instruction in CLAUDE.md or AGENTS.md tells the agent to retrieve before answering, and every connected host shares the same memory backend. The retrieved notes then become ordinary context, which Claude Code can cache like any other. More on the design is in why memU leaves the thinking to the agent.

The self-hosted setup and supported agents are in the memU GitHub repository. To try the hosted version, get an API key from memu.so and send your agent one message:

Read https://memu.pro/SKILL.md, follow its instructions to install and configure memU, API Key is YOUR_MEMU_API_KEY.

FAQ

How long does Claude's prompt cache last?

Five minutes by default, refreshed at no cost each time the cache is read. You can request a one-hour lifetime per block, which costs 2 times the base input price to write.

How much does Anthropic prompt caching save?

Cache reads cost 0.1 times the base input price on most models. Some newer models charge less. Five-minute writes cost 1.25 times the base price, so caching pays off after one read.

Is prompt caching the same as memory?

No. The cache holds the processed form of an exact prompt prefix for up to an hour and never changes the output. Memory, such as Anthropic's memory tool, stores information across sessions that changes what Claude knows.

Does prompt caching work automatically?

It can. Since February 2026 you can add a single top-level cache_control field and the API manages the breakpoint for you. You can also set up to four breakpoints by hand.

Why is my Claude prompt not being cached?

Usually the prompt is below the model's minimum length, or something in the prefix changed. A gap longer than the cache lifetime also causes a miss. Check cache_creation_input_tokens and cache_read_input_tokens in the usage block.