CLAUDE LABJP
2.1.269 — A broad release with 98 CLI changes. The one worth your attention is claude plugin eval, which finally lets you measure whether a plugin earns its placeEVAL — Every case runs three times with the plugin loaded and three times without, so the number you get back is the difference the plugin makes, not just a pass or a failGRADER — Three kinds of grader are available: a regex over the reply, a check for whether a particular tool was called, and a rubric judged by a second modelDIFF — The Bash tool result now includes a diff of the files a command changed. Turn it on with bashEditDiffEnabledSTYLE — /output-style [name] lists and switches output styles, including over Remote Control and in cloud or headless sessionsOTEL — OTEL_METRICS_INCLUDE_REPOSITORY tags metrics and events with vcs. repository attributes, and commit events carry vcs.ref.head2.1.269 — A broad release with 98 CLI changes. The one worth your attention is claude plugin eval, which finally lets you measure whether a plugin earns its placeEVAL — Every case runs three times with the plugin loaded and three times without, so the number you get back is the difference the plugin makes, not just a pass or a failGRADER — Three kinds of grader are available: a regex over the reply, a check for whether a particular tool was called, and a rubric judged by a second modelDIFF — The Bash tool result now includes a diff of the files a command changed. Turn it on with bashEditDiffEnabledSTYLE — /output-style [name] lists and switches output styles, including over Remote Control and in cloud or headless sessionsOTEL — OTEL_METRICS_INCLUDE_REPOSITORY tags metrics and events with vcs. repository attributes, and commit events carry vcs.ref.head
Articles/API & SDK
API & SDK/2026-05-29Advanced

Splitting Claude API prompt cache into 5m and 1h tiers — separate TTLs cut cost and stabilize ops

Anthropic's cache_control supports two TTLs: 5 minutes and 1 hour. Splitting them into a two-tier layout — 1h for static system/tools, 5m for variable few-shot — meaningfully changed both my costs and my on-call life. Here's the design with the numbers I observed.

claude-api82prompt-caching15cache-control2ttlcost-optimization31production111

Premium Article

The Messages API in the Anthropic SDK exposes a cache_control field that lets you ask the server to cache the prefix of a long prompt. I run Claude Lab as part of Dolice Labs (four sites I operate in parallel) and a handful of iOS / Android apps I have been shipping as an indie developer since 2014 (cumulative downloads passed 50 million along the way). Across all of that, the single biggest lever I have found for API cost is not "do you cache or not" but "how many TTLs do you use."

cache_control supports two TTLs: the default 5-minute ephemeral cache, and a 1-hour cache via ttl: "1h". I used to keep everything on 5m and assume that was fine. Six months ago I read the invoices line by line and realized I was leaving a lot on the table. The winning layout turned out to be 1h for static layers (system + tools) and 5m for variable layers (few-shot, RAG slices). This article is the engineering record of that change, with the actual numbers I saw.

Why a single TTL underperforms

My first prompt-cache layout looked like this:

# Before: a single 5m TTL for everything cacheable
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=2048,
    system=[
        {
            "type": "text",
            "text": SYSTEM_PROMPT,  # ~4,500 tokens
            "cache_control": {"type": "ephemeral"},  # 5m
        }
    ],
    tools=TOOLS,        # ~1,200 tokens
    messages=[
        {"role": "user", "content": user_text},
    ],
)

Cache hits started appearing in usage.cache_read_input_tokens, so it looked like things were working. Two real problems took weeks of logs to surface.

First, every time traffic went quiet for more than five minutes — which happened a lot at night and on weekends — the full 4,500-token system prompt was re-written and re-billed at the write rate. The write rate is 1.25x the normal input rate for 5m TTL, so dozens of cold-starts per day quietly ate most of my cache savings.

Second, when I tried to add a variable few-shot block at the end of the prompt, my fixed prefix kept getting invalidated. That was my own misunderstanding of where to put the breakpoint, but the two-tier layout described below removes the temptation entirely.

When 1h TTL is actually worth it

Passing ttl: "1h" extends the cache window to one hour, but the write cost roughly doubles versus the 5m option. If you apply 1h indiscriminately, your bill goes up, not down.

The rule I use is simple:

write-cost increase  <  hit savings
↓
mean inter-request gap  <  1h, with no extended idle windows
↓
1h TTL is worth it

For variable content — per-user few-shot, just-fetched RAG passages — 1h is meaningless. That content does not survive an hour and does not need to. Keep those layers on 5m.

In my workloads, the layers that actually benefit from 1h are:

  • The long system prompt (persona, output format, safety rails)
  • The tools JSON Schema block, especially when I have five or more tools defined
  • A shared knowledge "core" common across all users

Everything user-specific or daily-rotating stays on 5m.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
A concrete two-tier layout: 1h TTL for system/tools, 5m TTL for variable few-shot — with code
How to read cache_read_input_tokens vs. cache_creation_input_tokens to decide whether your TTL choice is correct
Numbers from my production workload (multiple iOS/Android apps and the four Dolice Labs sites) where this layout reduced input-token cost by about 42%
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $15 for lifetime access
View Membership →

Related Articles

API & SDK2026-06-24
My Morning Batch Was Missing the Prompt Cache Every Time — Warming Cadence and the Break-Even Math for the 1-Hour TTL
Jobs that run a few hours apart cold-miss the prompt cache even with a 1-hour TTL. Here is how to back out the right warming interval from the TTL, and how to write the break-even formula that decides whether warming pays off — with numbers from a four-site daily generation pipeline.
API & SDK2026-04-26
How I Cut My Claude API Bill in Half With Prompt Caching
Done right, Anthropic's prompt caching can roughly halve your monthly API spend on workloads with long, repeated system prompts. Here is the design playbook I use after six months of running it in production.
API & SDK2026-09-07
A 75% cheaper cache read moved one bill by 29% and another by 2.8%
Fable 5.1 and Mythos 5.1 changed the cache read multiplier from 0.1 to 0.025. Here is how to estimate your own saving from your token mix, and how to fix code that hard-codes the multiplier.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links