Skip to main content
Lesson 1 of 12 · Batch API: Bulk Processing

Batch API concept

Lesson 1 of 12 Updated November 2, 2026 Developer
On this page
  1. Asynchronous bulk processing
  2. A 20% discount on eligible models
  3. Four-step workflow
  4. Supported endpoints
  5. When to use the Batch API
  6. Key takeaways

Updated November 2, 2026, based on xAI’s documentation: the batch discount is 20% on eligible text models (not 50%), the examples follow the REST API and the official xai-sdk (client.batch.*; xAI’s Batch API does not use OpenAI’s format, so the OpenAI SDK does not apply), and the Responses API comes before Chat Completions, a legacy endpoint at xAI. Sources: Batch API · REST reference · Batch pricing.

Asynchronous bulk processing

xAI’s Batch API lets you send thousands of requests in a single operation, then retrieve the results once processing finishes. Unlike synchronous calls, where you wait for each response, batch mode works asynchronously: you submit a batch, keep working, and come back for the results later.

This approach addresses a real need. When you need to summarize 10,000 articles, classify 50,000 support tickets, or write catalog descriptions, sending requests one at a time would be slow, expensive, and would run you into rate limits. Batch requests do not count toward those limits.

A 20% discount on eligible models

The economic advantage is real, but more modest than some sources suggest. xAI applies a 20% discount to batch requests for its eligible text models—as of November 2, 2026: grok-4.7, grok-4.6, grok-4.5, grok-4.3, and the three grok-4.20-0309 variants—across all token types: input, output, cache, and reasoning. Models not on this list get no discount, even when they accept batch.

Image and video generation run in batch, but at standard pricing. Not every model accepts batch: each model’s page says whether it does, and a request to an ineligible model is rejected with the message not supported for batch processing.

-20%
Tokens for eligible models
24h
Typical turnaround, not guaranteed
50K
Requests per file
200 MB
Max JSONL size

Four-step workflow

The Batch API follows a simple, predictable pattern:

  1. Create a named batch with POST /v1/batches
  2. Add requests, either through successive calls or all at once with a JSONL file
  3. Monitor progress using the batch counters
  4. Retrieve results as they become available or at the end

This workflow decouples submission from processing: you do not need to keep a connection open while Grok works. Most batches are processed in under 24 hours, but xAI does not guarantee it: turnaround varies with load and batch size.

Supported endpoints

The Batch API is not limited to text. A single batch can mix requests to:

  • /v1/responses — the Responses API, with server-side tools (web search, X search, code execution, MCP)
  • /v1/chat/completions — the Chat Completions API, a legacy endpoint at xAI
  • /v1/images/generations and /v1/images/edits — image generation and editing
  • /v1/videos/generations (or /v1/videos), /v1/videos/edits, and /v1/videos/extensions — video generation, editing, and extension

For example, you can write product descriptions and generate their visuals in the same batch.

When to use the Batch API

The Batch API is a good fit whenever the result can wait:

  • Bulk data processing: classification, extraction, and summarization of thousands of documents
  • Evaluations: run thousands of test prompts through a model
  • Data pipelines: database enrichment, moderation of a content backlog, and reports prepared overnight

If your use case requires an immediate response (chatbot, real-time assistant), the Batch API is not a fit: it serves workloads where a delay of a few hours is acceptable.

Key takeaways

  • The Batch API processes requests asynchronously, most in under 24 hours, with no guarantee
  • 20% discount on all tokens for eligible text models; images and videos at standard pricing
  • The workflow has four steps: create, add, monitor, retrieve
  • Text, images, and videos can coexist in the same batch
  • Batch requests do not count toward rate limits, but they are not suitable for real time