Tools

Message Batches API: cut Claude costs by 50% for work that can wait

TL;DR

The Batch API accepts up to 100,000 requests (or 256 MB) per batch, billed at 50% of standard prices. Most batches finish in under an hour, at most 24 hours; results are kept for 29 days. It stacks with prompt caching.

When to use it

Good fitPoor fit
Bulk classification / labelingReal-time user-facing chatbots
Summarizing or translating archivesMulti-step agents that need the previous result
Running evals, comparing promptsAnything with a seconds-level deadline

Python example

import anthropic
client = anthropic.Anthropic()

batch = client.messages.batches.create(requests=[
    {"custom_id": f"ticket-{i}",
     "params": {"model": "claude-haiku-5-5", "max_tokens": 200,
                "messages": [{"role": "user", "content": t}]}}
    for i, t in enumerate(tickets)
])
print(batch.id, batch.processing_status)  # in_progress

Operational notes

  • Results come back out of order — always join on custom_id.
  • Batches not finished within 24 hours expire; retry failed requests in the next batch.
  • Prompt caching stacks with the batch discount, but cache hits are best-effort since requests run concurrently.
  • Download results within 29 days; after that only the status remains.