Claude Prompt Caching Recorded Zero Hits Over 1,412 Calls Due to a Timestamp

A developer enabled Claude prompt caching but found the usage logs showed zero cache reads across 1,412 consecutive calls, with no API errors raised. The cause was that the system prompt began with a seconds-precision timestamp, making the request prefix differ on every turn and forcing a full miss. A second issue came from tool lists built from a Python set, whose order varied across worker processes, capping the hit rate at 66%. A third problem was a prompt variant too short to be cached at all. After fixing all three issues, the developer reported a 94% cache hit rate and a 58% reduction in input token cost per session.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in