AI glossary · Tokens and cost
What is a batch API?
Also called: Message Batches API, batch processing, batch mode
Definition
A batch API is an asynchronous way to send many model requests as one job, which the provider works through when it has capacity, typically within 24 hours, at half the normal per-token price on OpenAI, Anthropic and Google.
Explained
How does a batch API work?
Instead of calling the API once per request and waiting, you submit a list of requests (a JSONL file with one request per line on OpenAI and Google, a JSON list in the request body on Anthropic), with your own custom_id on each. You poll the job and download the results when it ends. Results can come back in any order, which is why each one carries your ID.
OpenAI, Anthropic and Google all charge 50% of the standard price for batched work. OpenAI completes batches within 24 hours and Google targets 24 hours; Anthropic says most batches finish in under an hour and expire after 24. Size limits differ: up to 50,000 requests or 200 MB per batch on OpenAI, 100,000 requests or 256 MB on Anthropic.
Batches run on their own rate limits, separate from the real-time API, so a big overnight job doesn’t eat your live traffic’s headroom. Anthropic notes that the batch and prompt caching discounts can stack, though cache hits in a batch are best effort.
Example
10,000 support tickets labelled overnight
A team tags 10,000 support tickets each night: 1,500 input tokens per ticket (instructions plus the ticket) and a 200-token JSON label back. Nobody reads the labels before morning, so the job can wait.
On Gemini 3.8 Flash, the real-time price is $0.825 input and $4.125 output per million tokens; the batch price is $0.375 and $1.875. The nightly job costs $20.63 in real time and $9.38 as a batch, 55% less, or $337.50 saved over 30 nights. The batch API calculator runs the same sum for your workload.
| Real-time API | Batch API | |
|---|---|---|
| Input tokens | 15,000,000 | 15,000,000 |
| Output tokens | 2,000,000 | 2,000,000 |
| Results arrive | Seconds | Within 24 hours |
| Cost | $20.63 | $9.38 |
Prices from our daily data, 2026-11-28.
Cost and quality
How much does a batch API save?
For work that doesn’t need an answer in seconds, such as evaluations, classification, data extraction, embeddings or nightly reports, a batch API is the simplest way to halve the bill without changing the model or the prompt.
The price is latency and some extra code: you can’t stream, and you must handle failed and expired requests. Anything a person is waiting for still belongs on the real-time API.
Don’t mix up
Batch API vs parallel requests: what’s the difference?
- Batch API vs parallel requests
- Firing many requests at once from your own code still uses the real-time API at full price and counts against your normal rate limits. A batch API is a separate endpoint with its own limits and the discount.
- Batch API vs several questions in one prompt
- Packing ten questions into one prompt is a single request: it saves repeating the instructions but risks mixed-up answers. A batch keeps every request separate and gives each its own result.
FAQ
Questions people ask
Does Gemini have a batch API?
Yes. The Gemini API has a Batch API that processes large volumes of requests asynchronously at 50% of the standard price, with a target turnaround of 24 hours, though most jobs finish sooner. Google’s docs describe it for generateContent requests and also for embeddings. Small batches can go inline; larger ones go in a JSONL file where each line carries a key you choose, so you can match each result to its request.
What is the difference between a bulk API and a batch API?
In general API design, a bulk API applies one operation to many records in a single call, such as inserting a thousand rows, and answers straight away. A batch API for LLMs groups many separate model requests into a job that runs later. You get the results within hours rather than seconds, at a discount, and each request keeps its own result.
Go deeper
Try it and read more
- Free toolBatch API Savings CalculatorCompare batch and real-time API costs.
- Free toolLLM API Cost CalculatorEstimate per-request, daily and monthly API costs.
- Guide · 12 min readThe cheapest LLM APIs right now, ranked from daily price dataThe cheapest LLM APIs ranked by blended price from daily data, the cheapest for tools, vision and long context, free tiers, and how to cut cost per task.
- Guide · 12 min readHow to calculate LLM API costs: the formula, worked examples and the trapsHow to calculate LLM API cost per request and per month: the token formula, worked examples for chatbots, RAG and agents, plus caching, batch and reasoning.
Related