loading
loading
Reusing the model's processing of a repeated prompt prefix so you pay roughly 10% instead of full price on the cached part.
Caching is a prefix match: the cache key is the exact bytes of tools → system → messages up to each cache_control breakpoint, so a single changed byte anywhere in the prefix invalidates everything after it. Keep stable content (frozen system prompt, deterministic tool list) first and volatile content (timestamps, per-request IDs) last, then mark breakpoints at stability boundaries. The classic silent killer is a datetime.now() or unsorted JSON in the system prompt — check usage.cache_read_input_tokens; if it's zero across identical-prefix requests, something is invalidating the cache.
Plainly
Think of Prompt Caching as roads and power for the app city. Reusing the model's processing of a repeated prompt prefix so you pay roughly 10% instead of full price on the cached part.
In practice
Use it when local behavior needs to become a reachable, reliable deployed service. In practice, define the owner, input, output, and failure mode before you rely on it.