cache_control breakpoint:
Inspecting cache usage
When a backend reports a cache hit, the response includes:
On the OpenAI-shaped APIs, cached tokens are a subset of input tokens; do not add them again. An omitted detail field does not establish that caching is available or unavailable for the model.
Request logs expose
cachedInputTokens and cacheWriteTokens. Messages also reports writes as cache_creation_input_tokens.
Billing
Cache reads use the model’scached_input_per_mtok_usd rate. Cache writes can cost more than ordinary input: read cache_write_per_mtok_usd and cache_write_1h_per_mtok_usd in the live catalog. Uncached input uses the normal rate.
A first write can make a request more expensive. Compare repeated requests and their actual usage before assuming caching saves money.
Request-level and explicit breakpoints
Request-level and explicit breakpoints
The request-level marker places one breakpoint on the last cacheable block and advances with the conversation. It works on Chat Completions, Responses, and Messages.For precise placement, put The prefix through that block is cached. Use the appropriate content-part format for your endpoint. On a Chat Completions
cache_control on a content part. Any explicit marker takes precedence over the request-level marker:tool message, a marker is supported only on its last content part because the whole tool result is cached together.Cache lifetime and minimum length
Cache lifetime and minimum length
Anthropic’s default lifetime is five minutes, refreshed on a hit. For a one-hour window, use:
5m and 1h are the accepted TTL values. One-hour writes use the higher published write rate. Choose the window based on how often the prefix is reused.The minimum cacheable prefix length depends on the model and backend. A short prefix can return no cache usage without an error. Prefix changes, including whitespace, can cause a miss. After the cache expires, the next eligible request needs another write.Other providers
Other providers
OpenAI, xAI, DeepSeek, and Google routes can cache implicitly. The Anthropic
cache_control extension does not force a cache hit on these routes. Availability, prefix length, and expiry depend on the provider. Inspect reported usage instead of assuming that the second request will be cheaper.
