Prompt caching in Claude explained simply

Prompt caching means: β€œDon’t make Claude read the same big instructions over and over again.”

Imagine you have a 50-page instruction manual for your AI assistant.

Every time you ask Claude something, normally it has to process that manual again:

πŸ“– 50-page instructions + β€œWhat is the answer to this question?”

If you ask 100 questions, Claude repeatedly processes those same instructions.

Prompt caching lets Claude temporarily remember that repeated part.

So the next request becomes more like:

⚑ β€œUse the instructions you already processed + here is my new question.”

This can make requests faster and cheaper. (Claude)


A real-world example

Suppose you're building a customer-support AI.

You always send:

You are a customer support agent.

Here are our company policies...
[20,000 tokens of policies]

Here are 50 example conversations...
[30,000 tokens of examples]

Now answer this customer's question:
"Where is my order?"

The company policies + examples don't change very often.

So you can cache them.

Then the next customer asks:

β€œCan I return this product?”

Claude can reuse the cached policies and examples instead of processing all 50,000 tokens from scratch.

That's where the savings come from.


How long does Claude remember it?

By default, the cache lasts 5 minutes.

If the cached information is used again, the cache is refreshed. Anthropic also offers a 1-hour cache, which costs more. (Claude)

So think of it as a temporary memory, not permanent memory.


What does cache_control mean?

You'll see this in the code:

cache_control={"type": "ephemeral"}

Don't let the terminology scare you.

It basically tells Claude:

β€œYou can temporarily cache this part of my prompt.”

Anthropic currently provides two approaches:

  • Automatic caching β€” easiest; Claude manages the cache location for you.
  • Explicit caching β€” you tell Claude exactly which part should be cached. (Claude)

For beginners, start with automatic caching.


When should you use prompt caching?

Prompt caching is especially useful when you repeatedly send large amounts of the same information, such as:

  • πŸ“š Large documents
  • πŸ“‹ Long system instructions
  • πŸ§‘β€πŸ’» Coding guidelines
  • πŸ› οΈ Tool definitions
  • πŸ’¬ Long conversations
  • πŸ“ Lots of examples
  • 🏒 Company policies or knowledge

If your prompt is tiny and changes completely every time, caching probably won't help much. (Claude)


The most important idea

Think of your prompt as:

Stable information β†’ Changing information

For example:

[Company policies]
[Product documentation]
[Instructions]
[Examples]
-------------------
[Customer's new question]

You want to cache the top/stable part.

The customer's question can change every time.

That's the basic idea behind prompt caching.


One important detail

Caching isn't automatically free.

There is a small cost when Claude creates the cache, but reading from an existing cache is much cheaper than processing the same input normally. Anthropic currently lists cache reads at 0.1Γ— the base input-token price, while creating a 5-minute cache costs 1.25Γ— the base input price. (Claude)

So prompt caching is most valuable when you reuse the same large prompt repeatedly.

In one sentence

Prompt caching is a way to temporarily reuse the expensive, repetitive part of your prompt instead of making Claude process it from scratch every time.

Read the official Anthropic Prompt Caching documentation