Error response shape
All errors (other than CORS preflight) return JSON in the OpenAI-compatible envelope:messageis always present.typeis always present. Values mirror OpenAI’s vocabulary:invalid_request_error,authentication_error,rate_limit_exceeded,internal_error, plusinsufficient_quotaon429responses.codeis a machine-readable string (e.g.invalid_purpose,file_not_found,insufficient_quota).nullwhen not meaningful.paramnames the offending parameter ("model","messages","input_file_id", …) or isnull.lineis included for JSONL validation failures duringPOST /v1/batchesto point at the offending line (1-based).
x-request-id
response header (format req_<token>). Pass it along when reporting
issues to support so the call can be located in logs.
HTTP status codes
Quota errors return
429Catch 429 for both quota exhaustion (error.type:
“insufficient_quota”) and rate-limiting (error.type:
“rate_limit_exceeded”). This matches OpenAI’s behaviour and works
with the official SDK’s built-in retry logic.Common synchronous errors
401 Unauthorized, missing headers
x-api-key was not sent.
Fix: Send the required x-api-key header on every request. x-project-id
is optional, and only needed to scope the request to a specific project.
403 Forbidden, invalid credentials
x-project-id.
Fix: Verify the key, and verify the project UUID matches.
429 Insufficient Quota
Important: quota is checked at line-execution time. If your balance drops to zero during a batch, the remaining lines fail witherror.code: "insufficient_quota"in the error file (the JSONL line’serror.messageincludes the legacy[legacy:http_420]prefix for forensics). The batch as a whole still transitions tocompletedonce all lines have been accounted for.
404 Not Found, file or batch
404 is returned in all three cases.
Fix: Verify the ID and the x-project-id you’re sending.
Files API errors
Batches API. POST /v1/batches validation errors
When you create a batch, the service streams the entire input JSONL and
validates every line synchronously before returning a response. Any
failure returns 400 with the offending line (1-based, mirroring
OpenAI’s BatchError.line). The batch is also persisted with
status: "failed" and a populated errors list, so subsequent
GET /v1/batches/{id} calls can introspect what went wrong.
Validation errors carry
line in the JSON body so you can locate and
fix the offending line:
Errors that appear in the error_file_id JSONL
A line can fail after the batch was successfully created. Each failed
line is recorded in the error file with the line’s original custom_id and
an error object. These are the codes you’ll see:
The original ZeroGPU code is preserved as a
[legacy:<old_code>] prefix
on error.message for forensics. No error.details field is emitted -
the relevant upstream detail (if any) is folded into the message.
Recovering from failures
A batch that ends with some failures is stillstatus: "completed".
The pattern for handling this is:
- Read
output_file_idand write successful results to your data store. - Read
error_file_idand partition byerror.code:invalid_request_error,not_found_error,request_too_large: client-side issues, log, fix the input lines, and resubmit.internal_error,rate_limit_exceeded: transient, resubmit as-is.insufficient_quota,authentication_error: operational, fix the underlying issue first, then resubmit.batch_cancelled,batch_expired: the lines never ran; resubmit them in a fresh batch.
- Build a smaller JSONL containing only the lines you want to retry, upload, and create a new batch.
custom_id is preserved end-to-end, retries are easy to deduplicate
into your existing data store.
When to contact support
Reach out to ZeroGPU support if you see:- Persistent
500responses from any endpoint. Input file object missingon a file you just uploaded.- A batch stuck in
finalizingfor more than 10 minutes. - A batch that completes but is missing both
output_file_idanderror_file_idwhilerequest_counts.totalis non-zero.
Next steps
Objects & lifecycle →
The Batch object, status lifecycle, and every endpoint.
JSONL format →
Line schemas for input, output, and error files.
Quickstart →
First batch in under 10 minutes, auth, upload, create, download.

