DEV Community

NeverPayTwice
NeverPayTwice

Posted on Originally published at neverpaytwice.pages.dev

Claude Batch API: half price, if you can wait

Originally published at neverpaytwice.pages.dev.

Short answer: Anthropic's Message Batches API charges 50% of the standard price on all usage: input, output, cache writes and cache reads. You send up to 100,000 requests at once and collect the answers later. Most batches finish within an hour; a batch can take up to 24 hours.

If nobody is waiting for the answer (nightly jobs, classification, evaluations, backfills), batching halves that part of your bill with no change in quality. If a person is waiting, it isn't an option.

Batch prices

USD per million tokens, from Anthropic's batch processing page:

Model Standard input / output Batch input / output
Claude Opus 5.5 $4 / $20 $2 / $10
Claude Sonnet 5.5 $2 / $10 $1 / $5
Claude Haiku 5.5 (prompts up to 100K tokens) $0.10 / $0.50 $0.05 / $0.25
Claude Haiku 5.5 (prompts over 100K tokens) $0.50 / $2.50 $0.25 / $1.25
Claude Fable 5.2 $8 / $40 $4 / $20
Claude Opus 4.8 $5 / $25 $2.50 / $12.50
Claude Sonnet 4.6 $3 / $15 $1.50 / $7.50
Claude Haiku 4.5 $1 / $5 $0.50 / $2.50

An example: an Opus 5.5 request with 5,000 input tokens and 800 output tokens costs (5,000 × $4 + 800 × $20) ÷ 1,000,000 = $0.036 at the standard rate and $0.018 in a batch. Ten thousand of them a month: $360 or $180.

What fits in a batch, and what doesn't

  • Good fits: nightly or weekly summaries, tagging and classifying records, running evaluations, filling in old data, generating content in bulk. Anything where an answer in an hour, or by tomorrow, is fine.
  • Bad fits: chat and anything else a person is waiting on, and agent loops where each step needs the previous answer. Each request in a batch is answered once, on its own; there is no back-and-forth inside a batch.
  • Not available in a batch: streaming, fast mode (the speed setting), server-side fallbacks and max_tokens: 0. Almost everything else in the Messages API works, including tools, images and prompt caching.

The rules worth knowing

  • Size: up to 100,000 requests or 256 MB per batch, whichever comes first.
  • Time: most batches finish within an hour. A batch that isn't done after 24 hours expires, and the requests that never ran are marked expired.
  • You don't pay for failures: requests that come back errored, canceled or expired aren't billed.
  • Order: results can come back in any order. Give each request a custom_id and match on it, never on position.
  • Results expire too: they can be downloaded for 29 days after the batch was created.
  • No edits: a submitted batch can't be changed. Cancel it and send a new one.
  • Separate limits: batches have their own rate limits and don't use up your normal Messages API limits.

Batching and prompt caching together

The two discounts stack: a cache read inside a batch costs half the normal cache-read price. But requests in a batch run at the same time and in any order, so cache hits are best-effort; Anthropic says users typically see cache hit rates from 30% to 98%. To raise yours, put identical cache_control blocks in every request and share as much of the prompt as you can. Because a batch can run longer than five minutes, Anthropic also suggests the 1-hour cache for shared context. The caching break-even math shows when the 1-hour cache pays off.

What a batch looks like

In Python, with Anthropic's official SDK:

import anthropic
from anthropic.types.message_create_params import MessageCreateParamsNonStreaming
from anthropic.types.messages.batch_create_params import Request

client = anthropic.Anthropic()
batch = client.messages.batches.create(requests=[
    Request(custom_id=f"item-{i}", params=MessageCreateParamsNonStreaming(
        model="claude-sonnet-5-5", max_tokens=1024,
        messages=[{"role": "user", "content": text}]))
    for i, text in enumerate(texts)
])
# later: when client.messages.batches.retrieve(batch.id).processing_status == "ended"
for r in client.messages.batches.results(batch.id):
    if r.result.type == "succeeded":
        print(r.custom_id, r.result.message.usage)
Enter fullscreen mode Exit fullscreen mode

What would batching save you?

Save each response's JSON as one line in a file (in Python, message.to_json()). If you add a field such as "job" to each line, the script groups the totals by it, so you can see which jobs are worth moving. It prices every response at the standard and the batch rate. It also reads a batch results file, so you can check what a batch actually cost you. It prints numbers only and sends nothing anywhere. (Download it, or get it with the other scripts on GitHub.)

python3 claude_batch_savings.py responses.jsonl --by job
Enter fullscreen mode Exit fullscreen mode

Example output (made-up data):

job                    responses      standard    batch rate   difference
nightly-summaries           1200      $21.5327      $10.7664     $10.7664
evals                        500      $18.6521       $9.3261      $9.3261
chat                         300       $7.1660       $3.5830      $3.5830
total                       2000      $47.3508      $23.6754     $23.6754
Enter fullscreen mode Exit fullscreen mode

Chat can't wait, so leave it out: moving the nightly summaries and the evals saves $20.09 of $47.35 here, about 42% of the whole bill.

We tested the script on hand-checked cases: its standard prices match our bill-check script on every response, it reads both saved responses and batch result files, it leaves errored, canceled and expired batch results out of the totals, and it lists anything it can't price instead of counting it as free. Fast-mode responses are priced at the standard rate, since a batched copy would run at normal speed.

Or let something watch the bill for you

NeverPayTwice is a small app we make. It tracks your AI usage and its cost per day and per model against a monthly budget you set, flags every time you paid again for something you had already bought, and keeps a receipt for each AI purchase. It runs on your own computer; nothing is uploaded and API keys are never stored. Mac, Windows or Linux, $9 one time.

Sources: Anthropic's batch processing page (prices, limits, result types, caching) and API pricing page, checked November 15, 2026. Prices can change; check the current pages if something doesn't match.

Try the demo with sample data, no sign-up, or get NeverPayTwice for $9.

Top comments (0)