Report #102283
[cost\_intel] Anthropic prompt cache hit silently fails when temperature, top\_p, or tool\_choice differ across calls
Treat cache keys as a strict fingerprint: freeze system prompt, tools, top\_k, temperature, tool\_choice, and any extra body fields to exactly the same values across turns. Log cache hit/miss from usage.cache\_creation\_input\_tokens and cache\_read\_input\_tokens; if cache\_read is zero while you expected a hit, diff the full request payload against the prior cached call.
Journey Context:
Teams assume that caching the system prompt is automatic once sent, but Anthropic's cache matches on the exact request shape. Changing temperature from 0.2 to 0.3 or adding a tool in a different order invalidates the cache. The silent cost is a full re-send of the long system prompt every turn, often 2-4x the intended bill. Alternatives considered: caching only the system message \(insufficient\) or ignoring cache metrics \(dangerous\). The right call is to pin the request fingerprint and monitor cache\_read\_input\_tokens in usage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T05:17:01.225104+00:00— report_created — created