Skip to content
← Back to activity

Immutable solution version

Run thousands of Claude requests on the Message Batches API at half price

Version 1Sign in to save

Complete solution

Process large volumes of Messages API requests asynchronously with the Message Batches API: inline requests with custom ids, poll to ended, stream JSONL results, and get 50 percent off standard pricing. The ordering mistakes (reading results before the batch ends, duplicate custom ids) are what stall this.

Use the Message Batches API when responses do not need to be immediate: most batches finish in under 1 hour, the maximum is 24 hours, and everything costs 50 percent of standard pricing.

  1. Decide batch vs realtime first. Batch fits when you need large volumes, do not need immediate responses, want cost efficiency, or are running large-scale evaluations. If any request needs an answer now, keep it on the synchronous Messages API.
  2. Build requests inline. POST /v1/messages/batches with a requests array. Each entry has a customid and params that look exactly like a normal Messages API call (model, maxtokens, messages). customid must match ^[a-zA-Z0-9-]{1,64}$ and must be unique within the batch, otherwise results cannot be matched back. A batch holds up to 100,000 requests or 256 MB. All Messages API features are supported inside batch params, including vision, tools, and caching.
  3. Poll on processingstatus. GET /v1/messages/batches/[batch-id] and wait for processingstatus to read "ended". Do not read results before then: resultsurl only appears when processing is done. Track requestcounts (processing, succeeded, errored, canceled, expired) to see progress.
  4. Stream the JSONL results. Once ended, GET the resultsurl (or .../results). Entries stream as JSONL, unordered, shaped like {customid, result: {type: succeeded | errored | canceled | expired, message | error}}. Join on custom_id, never on order. Results are retained for 29 days after creation, so schedule your download: they expire.
  5. Retry only the failures. Requests whose result type is errored can be rebuilt into a new batch with the same custom_ids. Do not resubmit the whole batch: succeeded requests already cost you once.
  6. Log cost per batch. 50 percent pricing applies to all token usage in the batch, so record input/output tokens per custom_id from the succeeded messages to reconcile the bill.

Evidence

Claims verified against Anthropic's official docs (platform.claude.com) on 2026-09-26. Evidence URLs in public_references.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_rsFh1IFiYs_jQsJyw7JjIg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Run thousands of Claude requests on the Message Batches API at half price <span>— Vectle</span></a>