This page walks through a complete batch from start to finish in bothDocumentation Index
Fetch the complete documentation index at: https://docs.zerogpu.ai/llms.txt
Use this file to discover all available pages before exploring further.
curl
and the Python openai SDK. By the end you’ll have submitted 3 chat
completions through the Batch API and read the results.
Prerequisites
| Credential | Where to find it |
|---|---|
API key (x-api-key) | ZeroGPU dashboard → API Keys |
Project ID (x-project-id) | ZeroGPU dashboard → Projects |
401.
Base URLs
| Environment | URL |
|---|---|
| Production | https://api.zerogpu.ai |
| Staging | https://staging.api.zerogpu.ai |
| Development | https://dev.api.zerogpu.ai |
POST /v1/files,GET /v1/files,GET /v1/files/{id},GET /v1/files/{id}/content,DELETE /v1/files/{id}POST /v1/batches,GET /v1/batches,GET /v1/batches/{batch_id}
1. Build the input JSONL
Every batch is driven by a JSONL file where each line is one inference request:| Field | Required | Description |
|---|---|---|
custom_id | Yes | Your identifier for the request. Must be unique within the batch. Echoed back in the output so you can match results to inputs. |
method | Yes | Must be "POST". |
url | Yes | Must be /v1/chat/completions, the only supported batch endpoint. All lines in a batch must share the same url. |
body | Yes | The JSON body you would send to that endpoint synchronously. "stream": true is rejected, batches are non-streaming. |
2. Upload the file
Send the JSONL toPOST /v1/files with purpose=batch. The response
contains the file_id you’ll reference when creating the batch.
3. Create the batch
Submit the batch with the file ID, the target endpoint, and a 24-hour completion window. The response returns immediately withstatus: "in_progress", actual processing is asynchronous.
Validation runs at create timeThe server streams the entire input JSONL and validates every line before
responding. If anything is wrong, duplicate
custom_id, line
over 1 MB, stream: true, mismatched url, you’ll
get a 400 with the offending line. Once the response
returns, the batch is durably committed.4. Poll until complete
PollGET /v1/batches/{batch_id} until status is completed, expired,
or failed. A 30-second interval is a reasonable default.
status is completed, the response contains output_file_id (and,
if any line failed, error_file_id).
5. Download the results
Stream the output and error files viaGET /v1/files/{file_id}/content.
custom_id):
Next steps
JSONL format →
Exact line schema for input, output, and error files.
Supported endpoints →
Body and response shape for
/v1/chat/completions.Batches API reference →
Status lifecycle, limits, full Batch object schema.
More examples →
Full Python script, plus a realistic IAB-classification batch.

