Prompt caching is not a setting you enable. It is a property your prompt either has or does not have, and one timestamp in the wrong place removes it from every request you will ever send.
It is a prefix, and that is the whole design
The pricing and mechanics of cached tokens belong to the tokens cluster. The one structural fact that governs assembly is this: caching operates on a prefix. The provider can reuse the computed state of your request up to the first position where it differs from a previous request, and not one token further.
This is a much harsher constraint than “repeated content is cheaper.” Content that repeats but has moved is worth nothing. A 40,000-token reference block that is identical between two requests gets no discount at all if a 12-token session id was inserted ahead of it. There is no partial credit, no fuzzy match, and no recovery later in the prompt — one early difference forfeits the entire remainder.
Which turns cache optimisation into a single question with a mechanical answer: what is the longest prefix of my request that is byte-identical across the requests I actually send? Everything else follows.







