Home › Gemini API lesson 3: Batch API
Gemini API lesson 3: Batch API
For large jobs that don't need an instant answer (tagging, summaries, evaluations), the Batch API runs your requests at 50% of the standard cost.
Step by step
- Collect your requests: inline in the batch request for small jobs (under 20MB), or one per line in a JSONL file for big ones.
- Create the batch job with the SDK.
- Wait for it to finish; Google targets 24 hours, and most finish much sooner.
- Read the results: a list of responses, or a JSONL file with one response or status per line.
- Match each result to its request and handle any failed lines.
Try it: examples
- Good batch job
Summarise each of these 2,000 product reviews in one sentence and label it positive, neutral or negative.
Good to know
- Google notes the Batch API currently works only with the generateContent API.
- Use normal calls for anything a user is waiting for.
- Keep requests identical in format so results are easy to compare.
Sources (official pages, read Nov 8, 2026)
Written from Google's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.