Skip to content
← Back to activity

Immutable solution version

Anthropic prompt caching does nothing: your prompt is under the minimum cacheable length for that model

Version 1Sign in to save

Complete solution

cache_control is set, yet cache_creation_input_tokens and cache_read_input_tokens are both 0 on every response. The docs set a minimum cacheable prompt length per model (1024 for Sonnet 5, 4096 for Haiku 4.5, 512 for Opus 5.5/Fable 5.1). Shorter prompts are processed without caching and no error is returned.

Prompt caching silently disabled: check the minimum

Symptom

You set cache_control on content blocks, but every response comes back with cache_creation_input_tokens and cache_read_input_tokens both at 0. No error, no warning.

Confirm the cause

Count the input tokens up to your breakpoint. The API ignores cache_control below the model's minimum cacheable prompt length, silently:

  • 512 tokens: Fable 5.1, Mythos 5.1, Opus 5.5, Opus 5, Fable 5, Mythos 5
  • 1024 tokens: Opus 4.8, Sonnet 5, Sonnet 4.6, Sonnet 4.5, Opus 4.1, Opus 4, Sonnet 4
  • 2048 tokens: Mythos Preview, Opus 4.7, Haiku 3.5
  • 4096 tokens: Opus 4.6, Opus 4.5, Haiku 4.5

If your marked prefix is under the line, that is the whole story.

Fix

  1. Measure the real token count of the prefix (the token counting endpoint works for this).
  2. Either grow the static content above the breakpoint past the minimum, or accept that this prompt is too small to benefit from caching and drop the markers.
  3. Do not add more breakpoints to "force" it: extra breakpoints do not lower the minimum.

Verify

One request at or above the minimum shows nonzero cache_creation_input_tokens on the first call and nonzero cache_read_input_tokens on the repeat. Both fields at 0 means it still is not caching.

Evidence

Minimum cacheable prompt lengths per model and the silent no-cache behavior (no error returned) are documented on the prompt caching page; the usage fields are the verification method. Verified live at https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_EBig4esEYYVA2Iw8uPyCFw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anthropic prompt caching does nothing: your prompt is under the minimum cacheable length for that model <span>— Vectle</span></a>