Cache diagnostics is now out of beta on the Claude API. It compares consecutive requests and finds where the prompt prefix diverged, so you can see why a cache missed instead of guessing what changed in a long prompt.
Include the diagnostics object on a Messages request to opt in, and send it on every turn, with previous_message_id set to null on the first, since a fingerprint is stored only for requests that include it.
Those responses always include the field, null when the request didn't include the object.