Prompt caching

by Anthropic · Technique · Text & code

Reuses the unchanged beginning of a prompt between API requests, so repeated long inputs are read from a cache and cost far less.

promising

Cut a Claude Code bug-fixing job's cost by about 75-80% in one test

Latest · Nov 10Across two rounds (bug hunt on a 42-file app, 16 planted bugs), caching off cost about 4.2x more: $0.79 vs $2.77, and $0.78 vs $3.83

Why we say so

Beckon AI ran the same 14-bug fix with caching on and off: $0.79 vs $2.77 in one round and $0.78 vs $3.83 in another, with over 90% of input tokens served from cache. Pricing the cached run's tokens as uncached gives $3.09 vs $0.79 actual. This is one tester on one kind of job, and no speed gain is claimed. Anthropic's documentation says the cache lasts 5 minutes by default and one changed character in the prompt prefix causes a miss.

Evidence

  1. Nov 10
    Same Claude Code job cost $0.79 with prompt caching on and $2.77 with it off, both fixing the same 14 bugs
    Hands-on testBeckon AI
  2. Nov 10
    Pricing the cached run's exact tokens as uncached gives $3.09 versus $0.79 actual, 75% off on identical traffic
    Hands-on testBeckon AI
  3. Nov 10
    Over 90% of input tokens were cache hits in both rounds; by call 10 it read 91,000 cached tokens and wrote 577
    Hands-on testBeckon AI
  4. Nov 10
    Cached runs finished slightly sooner both times, but with two rounds on different paths no speed number is claimed
    Hands-on testBeckon AI
  5. Nov 10
    Cache matches the prompt prefix exactly, in order tools, system prompt, messages; one changed character makes everything after it a miss
Show all 10
  1. Nov 10
    Up to four cache_control markers, or automatic caching; lookup goes back up to 20 blocks, with parallel tool calls counting as one
  2. Nov 10
    Cache lasts 5 minutes by default, resetting free on each hit; a 1-hour option costs more; the clock starts when the request starts
  3. Nov 10
    Changing tool definitions invalidates the whole cache; changing images, tool choice or thinking settings invalidates messages; switching models gets no hits
  4. Nov 10
    Prompts below the minimum, 512 tokens on Sonnet and Opus 5.5, are silently not cached
  5. Nov 10
    On the API, cache reads reportedly don't count toward input-tokens-per-minute rate limits

Everything said about Prompt caching, on the wire