Full Byte Developer.

Is your Claude prompt caching working? A 10 second check

One changing line at the top of your prompt can make every call write the cache and never read it.

Published here · 2 sources

You turned on prompt caching and the bill did not move. One changing line at the top of your prompt can make every call write the cache and never read it.

The 10 second check

  1. Send the exact same request twice, within 5 minutes (the default cache lifetime).
  2. On the second response, read two fields in usage: cache_creation_input_tokens and cache_read_input_tokens.

What the second response tells you

ResultMeaning
cache_read_input_tokens above 0Caching works
Both 0Not cached, most likely under the minimum length
cache_creation_input_tokens above 0 again, read 0Something at or before your cache_control block changed (a timestamp, a user name, the incoming message). Move it after the cached block

Minimum token counts

From the docs, checked November 9 [1]:

ModelMinimum tokens
Claude Sonnet 5.5512
Claude Sonnet 51,024
Claude Haiku 4.54,096

Every other model is in the table on the docs page.

Check a saved response

bash
jq -r '.usage | if .cache_read_input_tokens > 0 then "HIT" elif .cache_creation_input_tokens > 0 then "MISS: wrote again" else "NOT CACHED" end' response.json

Why the second case hurts

A 5 minute cache write is billed at 1.25x the base input price [2]. A write that never gets read costs more than no caching at all.

To compare what a cached read costs on another model, see Amazon Ergo vs Opus 5.5 on price and long tasks.

Send this to the friend who turned on Claude prompt caching and saw the bill stay the same.

Keep this guide

By Full Byte Developer

Filed under AI agents, Cost and context

Questions about this guide

Why does a cache write that never gets read cost more?

A 5 minute cache write is billed at 1.25x the base input price. If it never gets read, you paid extra for nothing.

Where do the fields appear in streaming?

The same fields arrive in the message_start event.

Sources

  1. Claude docs: prompt cachingplatform.claude.com
  2. Claude docs: pricingplatform.claude.com

Next in this stack