Anthropic Capability minor

Cache diagnostics beta explains prompt cache misses

Pass diagnostics.previous_message_id on a Messages request and the API returns a cache_miss_reason showing where the prompt cache prefix diverged from the previous turn. Requires the cache-diagnosis-2026-04-07 beta header.

What does this mean for me?

Action needed
  • Engineering leadership

    Cost, risk, timeline, team impact Worth knowing

    This turns prompt-cache regressions from a half-day bisect into a single request, which matters if cache hit rate is holding down your input token bill. No migration cost — it is opt-in per request.

  • Engineer

    What to change, what breaks, what to test Action needed

    Next time cache hit rate drops, send `diagnostics.previous_message_id` with the `cache-diagnosis-2026-04-07` beta header and read `cache_miss_reason` to see where the prefix diverged. Pair it with mid-conversation system messages (2026-05-28) if the divergence is instructions changing mid-session.

  • General consumer

    Using the Claude apps, not the API No impact

    Nothing to do — this is an API debugging feature.

Prompt cache misses used to be diagnosable only by inspecting usage numbers and guessing which part of the prefix moved. Cache diagnostics names the divergence point, which is the difference between fixing a caching regression in minutes and bisecting a prompt by hand.

The feature is in public beta behind the cache-diagnosis-2026-04-07 beta header. It pairs with mid-conversation system messages (2026-05-28), which exists to keep cache hits when instructions change mid-session.

API surface

ParameterChangeBreakingModels
diagnostics.previous_message_idaddedno
anthropic-beta: cache-diagnosis-2026-04-07addedno

Terms on this page: Prompt caching

Sources

Confidence
high
Verification
Verified: stated on the vendor's own pages
Date precision
exact
How this entry was made
Drafted by an agent, reviewed by a person