Reupload
All AI ToolsExploreLocal AI?
← Back home

Skill · Anthropic Official Blog

Process 10K API Requests at 50% Cost

Process 10K API Requests at 50% Cost

Photo: Brecht Corbeel on Unsplash

Use Claude's Message Batches API to submit large volumes of requests asynchronously and cut processing costs by half. This technique is ideal for professionals handling bulk data enrichment, content generation, or overnight analysis jobs that don't require real-time responses. Package hundreds or thousands of independent tasks into a single batch for 50% cost savings with minimal code changes.

Claude's Message Batches API lets you group up to 10,000 independent requests and process them asynchronously for a flat 50% discount on input tokens. Instead of making sequential API calls that hit rate limits and time out, you submit a single batch, receive a batch ID, and retrieve results when processing completes-typically within an hour, guaranteed within 24 hours.

The implementation is straightforward. Create a list of request objects, each with a custom_id, model name, and messages array. Pass this list to the batches.create() endpoint using the Anthropic SDK. The API immediately returns a batch object with a status of 'queued'. Poll the batch status at regular intervals using batches.retrieve(batch_id) until processing_status becomes 'ended'.

For a practical example: a data enrichment team processing 5,000 customer records daily previously made individual API calls at $0.003 per 1K input tokens. By batching these requests, they now pay $0.0015 per 1K cached tokens-a 50% reduction. A marketing analytics firm used batches to generate product descriptions for 2,000 SKUs overnight, cutting their weekly processing bill from $400 to $200.

The batches API supports all standard Claude features including vision, tool use, extended thinking, and prompt caching. Stack batch processing with prompt caching for even greater savings: cached reads in a batch request earn both the 50% batch discount and the 90% cache discount, stacking multiplicatively. Results are stored for 29 days, giving you ample time to download and process them. This is particularly effective for workloads like bulk content moderation, overnight report generation, and large-scale data classification where a one-hour turnaround is acceptable.

Sources & credits

Original source: Anthropic Official Blog