Skip to main content
Every batch is driven by three JSONL files: This page is the canonical specification for all three line schemas.

Input JSONL

The input is a JSONL file (one JSON object per line, separated by \n). You upload it via POST /v1/files with purpose=batch, then reference its ID when you call POST /v1/batches.

Line schema

Validation rules

The service performs all of the following checks at POST /v1/batches time (not at upload time). Failure returns 400 with the offending line:
  • Each line must be valid JSON (not arrays, not primitives, must be an object).
  • custom_id non-empty string, unique across the whole batch.
  • method is case-insensitive; the upper-cased value must equal "POST".
  • url must be exactly /v1/chat/completions on every line in the file. Other ZeroGPU sync routes are rejected here.
  • body must be a non-empty object.
  • body.stream === true is rejected (streaming is not supported in batch mode).
  • Per-line size ≤ 1 MB.
  • Total file size ≤ 200 MB.
  • Total line count ≤ 50,000.
  • The file must contain at least one line.

Format details

  • Lines are separated by \n (LF). A trailing newline is allowed.
  • Blank lines are skipped.
  • UTF-8 encoding is required.
  • The url value matches the endpoint field on the create request exactly, no trailing slash, no query string, no protocol/host prefix.

Example, chat completions

See Supported endpoints for the /v1/chat/completions body schema.

Output JSONL

When a batch reaches status: "completed", the service writes the successful results to a file referenced by output_file_id on the Batch object. You download it via GET /v1/files/{file_id}/content. Only lines that received a 2xx response from the underlying endpoint appear in the output file. Failed lines go to the error file (see below). The order of lines in the output file is not guaranteed to match the order of lines in the input file, match results to inputs by custom_id.

Line schema

See Supported endpoints for the exact response.body shape (OpenAI chat.completion).

Example, chat completions output

Reading the output


Error JSONL

When a batch reaches status: "completed" (or expired) and at least one line failed, the service writes the failures to a file referenced by error_file_id. Successful lines go to the output file; the two are disjoint.

Line schema

Each error line carries an error.code (invalid_request_error, internal_error, batch_cancelled, and so on). The full list, what triggers each, and how to recover is in the Errors reference.

Example, error file

Reading the error file


Matching outputs and errors back to inputs

The output and error files together account for all lines in your input file, but their order is not preserved and they may be split across the two files. To reconstruct results for your dataset:
If a custom_id you submitted is missing from both files, the batch is not complete yet, re-check status and download again.
Always match by custom_idOutput and error lines are not guaranteed to appear in input order. Index your inputs by custom_id in your code and look results up by that key.

Next steps

Supported endpoints →

Body and response shape for /v1/chat/completions.

Quickstart →

Full end-to-end walkthrough in curl and Python.

Errors reference →

Every JSONL validation message and error code, with recovery guidance.