Developers · Advanced · 7 min

How to cut Claude API costs with prompt caching

If every request repeats the same long instructions or documents, caching cuts the cost and speeds up responses.

What you pay for the repeated part
No caching
First request (writes the cache)
Repeat request (reads the cache)

Illustrative. Cache writes cost slightly more than normal input; reads cost a small fraction. See the pricing page for exact rates.

Most apps send Claude the same system prompt, tools and reference documents again and again. Here is how to use prompt caching so you stop paying full price for the repeated part.

How prompt caching works

The API saves the start of your prompt (tools, then the system prompt, then messages, in that order) up to the point you mark. Later requests that begin the same way read it from the cache, which costs a fraction of normal input. Cache entries last five minutes by default, and a one-hour option is available at extra cost.

The easy way: automatic caching

Add one field at the top level of your request:

{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "cache_control": { "type": "ephemeral" },
  "system": "Your long, unchanging instructions...",
  "messages": [{ "role": "user", "content": "Today's question" }]
}

How to structure prompts for caching

Put what never changes first (tools, instructions, reference documents) and what changes last (the user’s message). Any change early in the prompt breaks the cache for everything after it.

How to check it’s working

The response’s usage section reports cache_creation_input_tokens and cache_read_input_tokens. If cache reads stay at zero, something at the start of your prompt changes between requests, like a timestamp.

Common questions

Which models support it? All current Claude models.

Is it worth it for short prompts? Usually not. The savings come from long, repeated content.

Sources: Claude Platform documentation: Prompt caching (checked November 2026)

Keep reading

The Sunday Signal

One email every Sunday morning: the week in AI, in five minutes. In English or Arabic.