# Prompt caching

> Prompt caching lets an LLM API reuse a processed prompt prefix. How Claude

Canonical: https://scaplet.com/glossary/prompt-caching

Glossary Glossary · AI search

Prompt caching lets an LLM API reuse a processed prompt prefix. How Claude's cache_control and OpenAI's automatic caching work, TTLs, minimums and what breaks a hit.

3 min

read

3

sources

Oct 31, 2026

updated

Scaplet Editorial Team

author

In one line

Prompt caching lets a model API reuse the processed beginning of a prompt across requests instead of processing it again. Anthropic caches the prefix in the order tools, system, messages, up to a `cache_control` breakpoint. OpenAI caches by default when requests share an identical prompt prefix. Either way, a match needs the prefix to be identical.

30-second check

## Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fprompt-caching%20(%22Prompt%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fprompt-caching%20(%22Prompt%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fprompt-caching%20(%22Prompt%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fprompt-caching%20(%22Prompt%20caching%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

## At a glance

4 facts from the sources below

tools, then system, then messages

Claude cached order

5 minutes; 1 hour with ttl: 1h

Claude default TTL

Up to 4 per request

Claude breakpoints

On by default for supported models

OpenAI

_01_At a glance

## Anatomy of a cached Claude request

Piece

### Top-level `cache_control`

What it does

Automatic caching. The breakpoint moves to the last cacheable block as the conversation grows.

Piece

### `cache_control` on a block

What it does

An explicit breakpoint. Up to 4 per request; automatic caching uses one of them.

Piece

### `"ttl": "1h"`

What it does

One-hour lifetime instead of the 5-minute default. In one request, 1-hour entries must come before 5-minute entries.

Piece

### Long second `system` block

What it does

The stable bulk of the prompt, the part worth caching.

Piece

### `response.usage`

What it does

Reports what was written to and read from the cache.

From Anthropic's prompt caching docs

```
response = client.messages.create( model="claude-opus-5-5", max_tokens=1024, cache_control={"type": "ephemeral"}, system=[ {"type": "text", "text": "You are an AI assistant tasked with analyzing legal documents."}, { "type": "text", "text": "<full 50-page agreement text>", "cache_control": {"type": "ephemeral", "ttl": "1h"}, }, ], messages=[{"role": "user", "content": "What are the key terms in this agreement?"}], ) print(response.usage.model_dump_json())
```

_02_At a glance

## Numbers and limits

Item

### Default lifetime

Claude (Anthropic docs)

5 minutes; each hit or refresh resets it at no extra cost

Item

### Longer lifetime

Claude (Anthropic docs)

1 hour via `ttl`

Item

### Minimum cacheable prompt

Claude (Anthropic docs)

512 [tokens](/glossary/tokenization) on Sonnet 5.5, Opus 5.5 and Haiku 5.5; 1,024 on Sonnet 5, Sonnet 4.6 and Sonnet 4.5; 2,048 on Opus 4.7; 4,096 on Opus 4.6, Opus 4.5 and Haiku 4.5

Item

### Below the minimum

Claude (Anthropic docs)

Processed without caching, no error returned

Item

### Price multipliers

Claude (Anthropic docs)

5-minute write 1.25x, 1-hour write 2x, read 0.1x of base input, with model exceptions

Item

### Sonnet 5.5 per million tokens

Claude (Anthropic docs)

$2 base input, $2.50 5-minute write, $4 1-hour write, $0.10 read

Item

### Lookback

Claude (Anthropic docs)

Checks up to 20 blocks back from each breakpoint for a prior write

Item

### Isolation

Claude (Anthropic docs)

Per organization, and per workspace on the [Claude](/ai-search/anthropic/ads) API

Anthropic adds that caching does not change generated output. For what fills a request in the first place, see [context window](/glossary/context-window).

_03_At a glance

## Claude and OpenAI compared

Question

### Opt in?

Anthropic

Yes, with `cache_control`

OpenAI

On by default for supported models

Question

### What must match

Anthropic

An identical prefix up to the breakpoint

OpenAI

The entire rendered prefix; a change before a breakpoint blocks reuse of everything after it

Question

### Where to read hits

Anthropic

`cache_read_input_tokens` and `cache_creation_input_tokens` in `usage`

OpenAI

`usage.input_tokens_details.cached_tokens`

Question

### Documented savings

Anthropic

Reads cost 0.1x base input, with exceptions

OpenAI

Cached input can be discounted by up to 95%; exact rates vary by model

_04_At a glance

## What breaks a cache hit

Change

### Edit a tool definition (name, description, parameters)

Effect on the Claude cache

Invalidates tools, system and messages

Change

### Toggle web search or citations

Effect on the Claude cache

System and messages caches invalidated; tools cache stays valid

Change

### Change `tool_choice` or add or remove images

Effect on the Claude cache

Messages cache invalidated

Change

### Change thinking settings such as `budget_tokens`

Effect on the Claude cache

Messages cache always invalidated

**A timestamp in the cached block means no hit, ever**Anthropic's docs say writes happen only at your breakpoint, and reads look for earlier writes, not for stable content. If the block carrying `cache_control` includes a timestamp or per-request text, its prefix hash changes every time. Put the breakpoint on the last block that stays identical.

Keep JSON key order stable in `tool_use` blocks, since Anthropic notes some languages randomize it. See also [extended thinking](/glossary/extended-thinking) for why changing a budget midway costs you the cache.

_05_How it works

## Check it in 2 minutes

1. 1

### Send the same request twice

Within the lifetime. The first response should show tokens in `cache_creation_input_tokens`, the second in `cache_read_input_tokens`.
2. 2

### Total the input

Anthropic gives the formula: `cache_read_input_tokens` plus `cache_creation_input_tokens` plus `input_tokens`.
3. 3

### Both cache fields at 0

The prompt was not cached, usually because it was under the model's minimum length.
4. 4

### On OpenAI, read `cached_tokens`

Check `usage.input_tokens_details.cached_tokens` on the second call.

Sources · 3

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- claude.com
- openai.com

1. 01 [Prompt caching (Claude docs)](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) platform.claude.com · checked 2026-11-01
2. 02 [Prompt caching (OpenAI developer docs)](https://developers.openai.com/api/docs/guides/prompt-caching) developers.openai.com · checked 2026-11-01
3. 03 [Extended thinking (Claude docs)](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) platform.claude.com · checked 2026-11-01

Questions

## Asked a lot.

1 questions people ask next, answered from the sources on this page.

_01_ Does prompt caching change what the model answers?

No. Anthropic states that caching does not change the generated output. It changes how much of the prompt is processed again and how that is billed.

## Keep learning

[All glossary](/glossary)

[Learn Extended thinking AI search](/glossary/extended-thinking) [Related Tool use AI search](/glossary/tool-use) [Read next System prompt AI search](/glossary/system-prompt) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[Programmatic SEO](/glossary/programmatic-seo) [Progressive web app](/glossary/progressive-web-app)

More in AI search
[Chunking](/glossary/chunking) [Context window](/glossary/context-window) [Conversational AI](/glossary/conversational-ai) [Embeddings](/glossary/embeddings) [Extended thinking](/glossary/extended-thinking) [Fine-tuning](/glossary/fine-tuning) [Generative engine optimization](/glossary/generative-engine-optimization) [Grounding](/glossary/grounding) [Knowledge cutoff](/glossary/knowledge-cutoff) [Large Language Model](/glossary/large-language-model) [Model Context Protocol](/glossary/model-context-protocol) [Multimodal AI](/glossary/multimodal-ai) [Prompt caching](/glossary/prompt-caching) [Prompt engineering](/glossary/prompt-engineering) [Prompt tracking](/glossary/prompt-tracking) [Reranking](/glossary/reranking) [Retrieval-Augmented Generation](/glossary/retrieval-augmented-generation) [Semantic Search](/glossary/semantic-search) [Structured outputs](/glossary/structured-outputs) [System prompt](/glossary/system-prompt) [Temperature](/glossary/temperature) [Tokenization](/glossary/tokenization) [Tool use](/glossary/tool-use) [Vector search](/glossary/vector-search)

Terms on this page
[Tokenization](/glossary/tokenization) [Context window](/glossary/context-window) [Extended thinking](/glossary/extended-thinking)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
