Prompt caching

Prompt caching

When a request starts with the same tokens as an earlier one, the model reads them from its cache and you pay the cached input rate for them. It's automatic on every model and every API format.

What it costs

Cached input has its own price per 1M tokens, a fraction of the input price. Each model's rates are on the models page. Anthropic cache_control markers aren't needed.

See what was cached

Each response counts its cached tokens. The Usage page shows your cache hit rate.

APICached tokens
Chat Completionsusage.prompt_tokens_details.cached_tokens
Responsesusage.input_tokens_details.cached_tokens
Anthropic Messagesusage.cache_read_input_tokens

Get more cache hits

Keep the start of every request the same: the system prompt, the tool definitions in the same order, and earlier turns exactly as they were. Add new messages at the end.

Put anything that changes, such as the date or a request id, after that stable start, never in the system prompt. Send assistant messages back unchanged.