Skip to content

Guides · Glossary

What is prompt caching? Cache reads and writes explained

Prompt caching reuses work when requests share the same prompt prefix.

— OpenAI API docs · Read the original

Anthropic (Claude API)

  • Turn it on with cache_control, either once at the top level (automatic caching) or on individual content blocks.
  • The cache lives 5 minutes by default and is refreshed for free each time it's used. A 1-hour lifetime is available.
  • Cache writes cost 1.25x the input price for 5 minutes and 2x for 1 hour. Cache reads cost 0.1x, or 0.05x on Opus 5.5 and Sonnet 5.5 and 0.025x on Fable 5.1.
  • On current models, prompts shorter than 512 tokens aren't cached. Check cache_read_input_tokens and cache_creation_input_tokens in the response.

OpenAI (API)

  • Caching is on by default for supported models. On GPT-5.6 and later you can let OpenAI place cache breakpoints or set them yourself.
  • The minimum cacheable prefix is 1,024 tokens on GPT-5.6 and later. A cached prefix stays eligible for 30 minutes after its last write or reuse.
  • Cache writes cost 1.25x the input rate. Reads cost 0.1x on most of these models and 0.05x on GPT-6.1 Sol.

What breaks a cache hit

The cached part must match exactly, from the start. Changing earlier content, the model, the tools or, often, the effort setting means a miss. Put stable content first and anything that changes per request, like timestamps, last.

In Claude Code and Codex

Anthropic's Claude Code guide says CLAUDE.md is resent every turn but billed at the cheaper cache-read rate after the first. Codex credit billing has no separate cache-write charge. At API rates, cache reads cost $0.20 per million tokens on Opus 5.5 and $0.10 on GPT-6.1 Sol, against $4 and $2 for fresh input.

Sources

  1. Prompt caching · Anthropic Docs
  2. Claude API pricing · Anthropic Docs
  3. Prompt caching · OpenAI API Docs
  4. GPT-6.1 Sol model page · OpenAI API Docs
  5. Codex pricing and usage limits · OpenAI · ChatGPT Learn
  6. Models, usage, and limits in Claude Code · Claude Help Center

Last checked . Facts change; the sources above are authoritative. See how we verify or report a correction.

Computer mode

Prefer a retro PC?

Boot the MYPC98 desktop: windows, the big reset button, the community inbox, Token Hop and lo-fi radio. The website stays the default.

Boot computer mode