When a request arrives, the model runs a prefill pass that computes key and value vectors for every input token at every attention layer, and decode then attends over those stored vectors instead of recomputing the sequence each step (the KV cache guide). Prompt caching is the billed, provider-side version of that same idea: the server keeps those tensors keyed to a prompt prefix, and a later request that starts with the identical prefix skips the recomputation (the caching comparison).
The critical property is exact match. OpenAI's documentation lists compute efficiency as the first benefit, and it only applies when requests share the same prompt prefix (the OpenAI caching guide). Anthropic describes the same mechanism as resuming from specific prefixes, with an explicit breakpoint placed on individual content blocks for fine-grained control (the Claude caching docs).
Three consequences follow, and they drive everything below.
First, a miss is expensive in two currencies. You pay full input price for tokens you have already sent before, and you pay the prefill latency again. The caching breakdown puts the write side at a premium over base input and the read side at a steep discount, which means a cache that misses on most requests is worse than no cache at all (the caching comparison).
Second, caching does not change output quality. The model still generates a fresh, non-deterministic answer every time; only the processing of the repeated prefix is skipped (what prompt caching is not). That makes prompt layout a pure engineering decision rather than a quality trade-off, which is why it belongs before any retrieval-order tuning.
Third, prompt caching is not response caching. Response caching hashes the whole request and replays the stored completion with zero tokens billed; prompt caching discounts part of one call (the response caching docs). Do not conflate the two in your dashboards, because a response-cache hit skips the provider entirely while a prompt-cache hit only reduces the prefix cost (the hit rate metric).



