Endpoints supported in batches
On this page
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 takes precedence over Chat Completions, a legacy endpoint at xAI. Sources: Batch API · REST reference · Batch pricing.
Seven endpoints, one workflow
The Batch API is not limited to text generation. It accepts seven endpoints covering text, images, and video, and you can mix them in a single batch to build complete multimodal pipelines in one operation.
Text endpoints
/v1/responses — The Responses API, the one xAI recommends. It gives you access to server-side tools (web search, X search, code execution, MCP), function calling, and structured outputs, and it gets new features first.
/v1/chat/completions — The original completion endpoint, in OpenAI’s format. xAI keeps it as a legacy endpoint: it is still useful for existing code written against it, but a new pipeline is better off starting with Responses.
On eligible models, the 20% batch discount applies to both endpoints, across all token types.
Image endpoints
/v1/images/generations — Generates images from a prompt. The parameters you will use are aspect_ratio (for example "16:9"), resolution ("1k", "1.5k", or "2k"), n for the number of images, and response_format ("url" or "b64_json").
/v1/images/edits — Edits an existing image, specified by an image object that contains a url (a public address or base64-encoded data) or the file_id of an uploaded file. Useful for running transformations in series across a visual catalog.
Images are billed at the standard rate, with no batch discount: here the value of batching is operational, not financial.
Video endpoints
/v1/videos/generations (or /v1/videos) — Generates videos from a prompt, from 1 to 15 seconds long (duration, 8 by default), at 480p, 720p, or 1080p.
/v1/videos/edits — Edits an existing video, passed in a video object (the URL of an .mp4 file or a file_id).
/v1/videos/extensions — Extends a video with a new segment of 2 to 10 seconds.
As with images, video pricing stays at the standard rate in batch mode. Image and video results come back as signed URLs that expire after one hour.
Mixing endpoints in a batch
In a JSONL file, each line names its endpoint in the url field:
{"custom_id": "text-1", "method": "POST", "url": "/v1/responses", "body": {"model": "grok-4.3", "input": [{"role": "user", "content": "Summarize this article: ..."}]}}
{"custom_id": "img-1", "method": "POST", "url": "/v1/images/generations", "body": {"model": "grok-imagine-image-2.0", "prompt": "Minimalist logo for a neighborhood bookstore"}}
You could generate your product descriptions and their visuals in the same batch this way.
Choosing the right endpoint
- Responses: the default choice, essential as soon as you need server-side tools, structured outputs, or the newest features
- Chat Completions: continuity for code already written in the Chat Completions format, and nothing more
- Images and video: for producing visuals in series, keeping in mind that they get no discount
Key takeaways
- Seven endpoints are accepted: two for text, two for images, three for video
- Responses is the recommended endpoint; Chat Completions is a legacy endpoint at xAI
- Only tokens on eligible text models get the 20% discount
- The
urlfield of each JSONL line determines the target endpoint, and endpoints can be mixed within a batch - Image and video results are signed URLs valid for one hour