- Home
- Learn
- Deep Dives
- Claude Prompt Caching and the Batch API
Claude Prompt Caching and the Batch API
How Claude prompt caching and the Batch API cut API cost, with a worked pipeline, break-even point and cache rules. Checked on 15-10-2026.
Published 15-10-2026. Prices and limits last verified on 15-10-2026 and reviewed monthly.
Quick answer
For a document pipeline on Claude Sonnet 5.5 with 10,000 documents a month and a 6,000-token fixed prompt, caching plus the Batch API takes the monthly bill from $220 to between $54 and $103, a saving of 53% to 75% depending on your cache hit rate. These are our calculations from list prices on 15-10-2026, not measured invoices. This page is for the developer or small team that runs the same long instructions through Claude thousands of times and wants to know what to cache, what to batch and what to measure.
How we checked the information in this article
Our gate: every saving claim shows the arithmetic behind it, and every price and rule comes from an Anthropic documentation page we read on 15-10-2026. The brief for this page asked for a before-and-after run on a real workload. We did not run one, so both bills below are calculated by us, and we say so every time. The gate also keeps out cache hit rates we cannot source. The only hit-rate range we use is the 30% to 98% that Anthropic quotes for batches.
We sell skills that load into Claude Code, Cursor, Codex CLI and Copilot, and we name a few of ours where they help. No vendor paid to be listed here.
What is prompt caching in Claude and how does it work?
Prompt caching lets the API resume from a stored prompt prefix instead of processing it again. The cache covers the whole prefix in a fixed order: tools, then system, then messages, up to and including the block marked with cache_control. You can add one top-level cache_control field for automatic caching, which suits multi-turn conversations, or place breakpoints on individual blocks for control. By default the cache lives 5 minutes and is refreshed at no extra cost each time it is used. The lifetime counts from the start of the request, so a response that streams for 4 minutes leaves you about a minute to send the next one.
Two rules decide whether it works at all. The prompt must reach the minimum length, which is 512 tokens for Claude Sonnet 5.5, Opus 5.5 and Haiku 5.5 but 4,096 for Haiku 4.5 and Opus 4.5, and a shorter prompt is processed without caching and without an error. And a hit needs a 100% identical prefix. Prompt caching does not change the output you get back, per the docs.
What do cache writes and cache reads cost?
A 5-minute write costs 1.25 times the base input price and a 1-hour write costs 2 times. A read costs 0.1 times the input price, or 0.05 times on Claude Sonnet 5.5 and Opus 5.5. On Sonnet 5.5 that is $2.50 to write, $4 to write for an hour and $0.10 to read, per million tokens, against $2 for plain input.
The break-even is short. We worked it out for Sonnet 5.5: a 5-minute write plus one read costs 1.30 times the input price for two requests, against 2.00 without caching, so caching wins on the second request inside the window. A single request loses, at 1.25 against 1.00. The docs say the same: a 5-minute write pays off after one read and a 1-hour write after two. So the question is never whether caching is clever, only whether the same prefix recurs within five minutes. Prices for the other models are in our Claude API pricing guide.
When should you use the 1-hour cache?
The docs say to keep the 5-minute cache for prompts you use more often than every 5 minutes, because it refreshes for free. The 1-hour cache is for prompts used less often than that but more often than hourly, such as an agent that takes longer than 5 minutes, or a user who may not reply for a while. Our view: start with 5 minutes and move to 1 hour only when your logs show gaps, since the write costs 60% more.
What should go in the cached prefix, and what breaks it?
Put stable material first: tool definitions, system instructions, examples and background documents. Anything that changes goes after the last breakpoint. According to the docs, changing a tool definition invalidates the whole cache, toggling web search or citations invalidates the system and message caches, and changing thinking or effort settings invalidates the message cache. Images added or removed also affect the message blocks. We treat the prefix like a contract: one owner, versioned, changed on purpose. Our guide to context engineering for AI agents covers how to structure that stable context.
That applies to long instruction files too. A skill or agent prompt that is loaded unchanged on every request is a good cache candidate, and one that is rebuilt with a timestamp is not. The LLM App Cost Prompt Caching Optimizer skill audits LLM token spend and implements provider-specific prompt caching, according to its listing. We have not run it on your code, so review the diff it proposes. Our prompt and skill engineering skills help you keep long prompts stable.
How do you combine caching with the Batch API?
The Message Batches API takes 50% off input and output for work that does not need an immediate answer. Per the docs, a batch holds up to 100,000 requests or 256 MB, most batches finish within an hour, results stay available for 29 days and a batch expires if it is not done in 24 hours. The two discounts stack, but cache hits inside batches are best effort, and Anthropic says users typically see hit rates between 30% and 98%. Use identical cache_control blocks in every request and keep a steady stream so entries do not lapse. The max_tokens: 0 pre-warming trick is not supported inside a batch.
Here is the worked pipeline, calculated by us from list prices on 15-10-2026: 10,000 documents a month, 8,000 input tokens each of which 6,000 are a fixed prompt, 600 output tokens, Claude Sonnet 5.5. We assume the cache-write and cache-read multipliers also scale with the batch discount, as the docs say the discounts stack.
| Setup | Hit rate | Monthly cost | Saving |
|---|---|---|---|
| Baseline, no caching, no batch | n/a | $220.00 | 0% |
| Caching only | 30% | $206.80 | 6.0% |
| Caching only | 95% | $113.20 | 48.5% |
| Batch only | n/a | $110.00 | 50.0% |
| Batch plus caching | 30% | $103.40 | 53.0% |
| Batch plus caching | 95% | $56.60 | 74.3% |
| Batch plus caching | 98% | $54.44 | 75.3% |
What this tells us: at a 30% hit rate, caching is nearly worthless on its own and batch carries the saving, so we would batch first and treat caching as an upgrade you earn by measuring. At 95%, caching alone nearly matches batch. The same pipeline on Claude Haiku 5.5 costs $11.00 at baseline and $2.97 with both at a 95% hit rate, which is why the model choice still matters more than either lever. If your pipeline is slow to restart after failures, the Partial Batch Failure Repair skill adds checkpoints, item-level tracking and idempotent retries to bulk jobs, per its listing. Browse workflow automation skills for the surrounding job runner.
Is a shared prompt cache secure?
The docs describe isolation at two levels. Caches are never shared between organizations, even for identical prompts. On the Claude API, Claude Platform on AWS and Microsoft Foundry they are also isolated per workspace, while Bedrock and Google Cloud isolate at the organization level only. Our guide to Claude on Bedrock, Vertex AI and Foundry compares those routes. If you run several customers through one workspace, that boundary is yours to enforce, so we would not put one customer's private text in a shared prefix. The docs also point to zero data retention terms for this feature, which we did not review, so ask your account team if that matters to you. Related work belongs in our security skills, and the Stop Crosstenant Cache Leaks skill audits Redis and Memcached keys for data leaks between customers, per its listing. That covers your own application cache, not the Anthropic prompt cache.
How do you measure your cache hit rate?
Read the usage fields on every response: cache_creation_input_tokens for writes, cache_read_input_tokens for hits and input_tokens for everything after the last breakpoint. Total input is the sum of the three. If both cache fields are 0, the prompt was not cached, usually because it was too short. Your hit rate is reads divided by reads plus writes. The Console usage page also shows cache hit rate, per the rate limit docs. Log the three fields per request and you can replace every number on this page with your own, using the Token Cost Estimator skill or a spreadsheet. The LLM ops skills and APIs and backend skills cover the logging side, and DevOps and cloud skills cover Bedrock or Vertex deployments, where field names and minimums can differ.
What to do next
Pick one workload, log the usage fields for a week, then decide on batch first and caching second. Caching also raises throughput, since cache reads do not count toward input token limits for most models. For coding sessions rather than API pipelines, read our guides on reducing Claude Code token usage, skills that cut Claude Code costs and AI coding agent costs compared. Verify the figures against the Anthropic pricing page, the prompt caching docs and the batch processing docs (listed under Sources) before you budget. This is cost guidance, not financial advice.
Written by Samuel Rose, Founder of Agensi. Next scheduled review: 15-11-2026.