CloudCodeTree LogoCloudCodeTree
AI NewsTutorialsAbout
CloudCodeTree Logo
CloudCodeTree
  • AI News
  • Tutorials
  • About
← Back to AI News
One Field Cuts Your Claude API Bill 60-90%: Prompt Caching With cache_control

One Field Cuts Your Claude API Bill 60-90%: Prompt Caching With cache_control

Chris Harper

3 min read

Aug 17, 2026 · 04:06 UTC

AI
Workflow
Claude Code
Best Practices

Add "cache_control": {"type": "ephemeral"} to any stable content block and Claude reads it from cache on subsequent calls at roughly 10% of the normal input-token price.

Any API workflow that sends the same system prompt, long instruction set, or reference document on every call is paying 100% of input cost each time. Prompt caching marks those stable blocks once; Claude caches them for an hour and charges cache-read rates on hits — about $0.30/M for Sonnet 5 instead of $3.00/M.

How to add it

import anthropic

client = anthropic.Anthropic()

system_prompt = """[Your stable system prompt — 1,024 tokens minimum to qualify]"""

response = client.messages.create(
    model="claude-sonnet-5-20260801",
    max_tokens=1024,
    system=[
        {
            "type": "text",
            "text": system_prompt,
            "cache_control": {"type": "ephemeral"}  # one field — this is all it takes
        }
    ],
    messages=[{"role": "user", "content": "What is the refund policy?"}],
)

# Inspect whether you got a cache hit
print(response.usage)
# cache_creation_input_tokens: N  (first call — writes the cache)
# cache_read_input_tokens: N      (subsequent calls — reads from cache)

The cache_control marker goes at the end of the stable block — Claude caches everything up to that point. Put volatile content (the user's question, the current date) after it. Never let timestamps or UUIDs drift into the cacheable prefix; that kills your hit rate.

Where the savings are largest

WorkloadStable blockTypical hit rate
Support botFull product docs + policy90-95%
Code review CIRepo conventions + style guide85-90%
Eval suiteAll test cases + rubric~100%
Multi-turn chatSystem prompt + tool list60-80%

Cost math

A support bot sending a 10,000-token system prompt on 1,000 daily requests:

ApproachDaily input cost (Sonnet 5)
No caching1,000 × 10K × $3/M = $30.00
Prompt caching$3.00 (cache write) + 999 × 10K × $0.30/M = $6.00

80% saved, same responses, zero code refactoring beyond adding one field.

Caching also works on tool definitions and large user-turn messages — add cache_control to any block 1,024+ tokens long that appears on multiple requests. The minimum is 1,024 tokens for standard models; 2,048 for extended context.

Sources: Prompt caching — Claude Platform Docs · Prompt caching cookbook — platform.claude.com · How to cut Claude API costs 90% with prompt caching — Iron Mind