Anthropic batch API: cut Claude costs by 50%
Use the Anthropic batch API to cut Claude costs by 50%. Process thousands of requests asynchronously and automate your batch workflows.
On this page
- What is the Anthropic batch API and when should you use it?
- How do you structure batch requests for the Anthropic API?
- How do you automate batch API workflows on CodeWords?
- What are the cost savings compared to synchronous requests?
- How do you handle errors and retries in batch processing?
- What are the best use cases for batch processing with Claude?
- FAQs
- From cost center to competitive advantage
If you're running more than a few hundred Claude requests per day, you're overpaying. Anthropic's batch API processes up to 100,000 requests in a single call at half the per-token cost of standard synchronous requests. That's not a marginal optimization — it's the difference between a $2,000/month AI bill and a $1,000 one. According to Anthropic's pricing documentation (2025), batch processing delivers a designed 50% discount on both input and output tokens across all Claude models. On CodeWords, you can orchestrate batch jobs through a single conversation with Cody — no queue infrastructure, no polling scripts, no babysitting.
TL;DR: - Anthropic's batch API processes up to 100,000 requests per batch at 50% token cost, and unfinished requests expire after 24 hours - CodeWords automates the full lifecycle: file preparation, submission, polling, and result parsing — all serverless - Best use cases: content generation, data extraction, classification, and evaluation pipelines
What is the Anthropic batch API and when should you use it?
The Anthropic batch API accepts a JSONL file of message requests and processes them asynchronously. Each request in the batch is independent — it gets its own system prompt, messages array, and model parameters. Unfinished requests expire after 24 hours, though most batches complete in under an hour for moderate volumes.
You should reach for batch processing when your workload meets three criteria: latency tolerance (you don't need responses in real-time), volume (50+ requests in a burst), and cost sensitivity. Think content pipelines, dataset labeling, bulk summarization, or evaluation harnesses.
The Anthropic API reference specifies the batch endpoint accepts standard Messages API parameters per request, meaning you get full access to tool use, system prompts, and multi-turn conversations — just without the streaming.
How do you structure batch requests for the Anthropic API?
Each batch requires a JSONL file where every line is a JSON object with a custom_id and a params object. The custom_id lets you correlate results back to your inputs. The params object mirrors the standard Messages API schema.
Here's the structure:
{"custom_id": "request-001", "params": {"model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [{"role": "user", "content": "Summarize this article..."}]}}
{"custom_id": "request-002", "params": {"model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [{"role": "user", "content": "Extract entities from..."}]}}
Note: Anthropic retired Claude Sonnet 4 on Anthropic-operated platforms on June 15, 2026, and recommends Claude Sonnet 4.6 as its replacement. Amazon Bedrock and Google Cloud set their own retirement schedules.
Key constraints: maximum 100,000 requests per batch, maximum 256 MB file size, and each request counts against your standard rate limits during processing. Anthropic's documentation confirms unfinished requests expire after 24 hours, with most completing faster depending on queue depth.
How do you automate batch API workflows on CodeWords?
On CodeWords, batch processing becomes a conversation. Tell Cody: "Process these 500 product descriptions through Claude Sonnet, extract features, and save results to Google Sheets." The platform handles file preparation, API submission, status polling, and result parsing — all running in serverless microservices that scale automatically.
A typical CodeWords batch workflow:
- Data ingestion — Pull source data from Airtable, Google Sheets, or a database via 3,000+ integrations
- Request formatting — Transform each record into the JSONL schema with appropriate prompts
- Batch submission — Submit to Anthropic's batch endpoint with error handling
- Polling and retrieval — Monitor batch status, retrieve results on completion
- Output routing — Parse responses, validate, and write to your destination
The ephemeral sandbox architecture means you're not provisioning servers or managing job queues. Each batch run executes in isolation, processes its results, and tears down — zero maintenance overhead.
What are the cost savings compared to synchronous requests?
The math is straightforward. Claude Sonnet 4 charges $3 per million input tokens and $15 per million output tokens for synchronous requests. Batch processing cuts those to $1.50 and $7.50 respectively — according to Anthropic's 2025 pricing page.
For a content pipeline processing 1,000 articles at ~2,000 tokens input and ~1,000 tokens output each:
- Synchronous cost: $6 input + $15 output = $21 per run
- Batch cost: $3 input + $7.50 output = $10.50 per run
At daily execution, that's $3,832 annual savings on a single pipeline. Multiply across evaluation suites, data enrichment jobs, and classification tasks — the compound effect is significant.
A 2025 survey by Retool found that 64% of teams running production AI spend over $1,000/month on API costs. Batch processing is the lowest-effort cost optimization available.
How do you handle errors and retries in batch processing?
Batch results include per-request status codes. Some requests will fail — rate limits, malformed inputs, or context length violations. Your automation needs to handle partial failures gracefully.
On CodeWords, you can build retry logic directly into your workflow:
- Parse the results file, separating successes from failures
- Inspect failure reasons (available in the
errorfield of each result) - Reformat failed requests into a new batch
- Resubmit with exponential backoff
The platform's state persistence via Redis means your workflow tracks progress across retries without losing context. If your batch partially completes, you restart from the failure point — not from scratch.
Common failure modes to handle: overloaded (retry after delay), invalid_request (fix and retry), and rate_limited (reduce batch size or wait).
What are the best use cases for batch processing with Claude?
The highest-ROI applications share a pattern: high volume, tolerance for minutes-to-hours latency, and structured outputs.
Content operations: Generate meta descriptions, rewrite product copy, or produce blog content at scale. A batch of 500 SEO descriptions runs in minutes and costs ~$5.
Data extraction and enrichment: Pull structured data from unstructured text — names, dates, sentiment, categories. Feed results into Airtable or your CRM automatically.
Evaluation and testing: Run prompt variants against test datasets. Compare model versions. Score outputs against rubrics. The Anthropic cookbook provides examples of batch evaluation patterns.
Classification pipelines: Label support tickets, categorize feedback, or tag content. Batch processing makes classification at 100,000+ items economically viable.
Research workflows: CodeWords' deep research pattern can use batch processing to parallelize source analysis across dozens of documents simultaneously.
FAQs
What's the maximum batch size for the Anthropic batch API? Each batch supports up to 100,000 requests with a maximum file size of 256 MB. For larger workloads, split into multiple batches and process sequentially or in parallel.
How long do Anthropic batch requests take to complete? Most batches finish within one hour. Processing can take up to 24 hours, depending on the batch size, current demand, and request volume.
Can you use tool use (function calling) in batch requests? Yes. Each request in a batch supports the full Messages API feature set, including tool definitions, system prompts, and multi-turn conversations.
Does CodeWords support other batch APIs besides Anthropic? CodeWords provides LLM access to OpenAI, Anthropic, and Google Gemini without API key setup. You can build batch workflows across any provider.
From cost center to competitive advantage
The Anthropic batch API isn't just about saving tokens — it's about making AI operations economically sustainable at scale. Under the Claude Sonnet 4 example above, processing 100,000 requests with about 2,000 input tokens and 1,000 output tokens per request costs about $1,050 in batch mode instead of $2,100 synchronously. That unlocks use cases that were previously budget-prohibitive: exhaustive testing, full-catalog enrichment, daily content refreshes.
The implication for operators building production AI systems: batch-first architecture should be your default for any non-real-time workload. The teams that systematize this — automating the preparation, submission, and routing of batch results — will compound cost advantages over those manually managing API calls.
Start building batch workflows on CodeWords — describe what you need to Cody, and ship your first batch pipeline in minutes, not days.