Sign in

The batch file

The input file is JSONL: one JSON object on each line, as in OpenAI's Batch API.

An input line

JSON
{"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-oss-20b", "messages": [{"role": "user", "content": "Say hello."}], "max_tokens": 100}}
custom_id
A text of your own that is not empty. It must be different on every line.
method
Always POST.
url
Always /v1/chat/completions.
body
A chat completion request. It needs model and a messages list. Every line in a file uses the same model. max_tokens or max_completion_tokens, if you send it, is a whole number above 0.

An output line

The output file has one line for each request that worked. The error file has one line for each request that failed. Both files have the same fields, and exactly one of response and error is set. Use custom_id to match a result to your request.

JSON
{"id": "batch_req_…", "custom_id": "request-1", "response": {"status_code": 200, "request_id": "req_…", "body": {"id": "chatcmpl-…", "object": "chat.completion", "choices": [{"index": 0, "message": {"role": "assistant", "content": "Hello!"}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 9, "completion_tokens": 3, "total_tokens": 12}}}, "error": null}
id
The ID of the result, starting batch_req_.
custom_id
The value from your input line.
response
Set when the request worked: status_code, request_id and body, which is the chat completion.
error
Set when the request failed: a code and a message. The codes are on the Errors page.