Batches
OpenAI's Batch API at the API root, with HIPS's additions an OpenAI client ignores: windows longer than 24h, the hips object and signed webhooks. How to use it, the price and the limits are on Batch jobs; times on these routes are Unix seconds.
Note
Files and batches are built and not offered in production yet: every route on this page answers 404 route_not_available until they are switched on.
/v1/batchesnot offeredOpenAI's Batch API. Not offered in production yet: 404 route_not_available.
/v1/batches/{batch_id}not offeredThe Batch object. Not offered in production yet.
/v1/batches/{batch_id}/cancelnot offeredCancels a batch. Not offered in production yet.
/v1/batchesnot offeredThe batches the credential reaches, newest first. Not offered in production yet.
Create
{"input_file_id": "file_...", "endpoint": "/v1/chat/completions", "completion_window": "72h", "metadata": {"run": "nightly-summaries"}}Parts list: POST /v1/batches
input_file_idRequiredA file of the workspace with purpose
batch, within the credential's reach; unknown is a 404file_not_found.endpointRequired/v1/chat/completions, the one endpoint a batch takes as built, equal to the file'surl. Any other is a 400unsupported_value.completion_windowAcceptedA whole number of hours or days from
24hto7d(24h,36h,3d,7d),24hwhen absent, one price for every window. Anything else is a 400invalid_value.metadataAcceptedOpenAI's: up to 16 pairs, keys up to 64 characters, values up to 512.
output_expires_afterAccepted{"anchor": "created_at", "seconds"}, for the output and error files. 30 days by default.RequirementsHeadersx-hips-pool,x-hips-regionandx-hips-fallbackover the key's defaults set the requirements of every line, frozen on the batch. A batch is priced in market mode:x-hips-pricing-mode: stableis a 400unsupported_value.
The gateway answers at once with the Batch object in validating, the quote bound; a model sold without batch is a 400 batch_not_offered, and a model the catalog does not know a 404 model_not_found. Takes idempotency-key.
Batch object
{ "id": "batch_...", "object": "batch", "endpoint": "/v1/chat/completions", "model": "<pinned id>", "errors": null, "input_file_id": "file_...", "completion_window": "72h", "status": "in_progress", "output_file_id": null, "error_file_id": null, "created_at": 1792576800, "in_progress_at": 1792576860, "expires_at": 1792836000, "finalizing_at": null, "completed_at": null, "failed_at": null, "expired_at": null, "cancelling_at": null, "cancelled_at": null, "request_counts": {"total": 2, "completed": 1, "failed": 0}, "usage": {"input_tokens": 0, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 0, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 0}, "metadata": {"run": "nightly-summaries"}, "hips": {"quote": "quote_...", "requirements": {"pool": "certified", "pricing_mode": "market", "region": null, "fallback": false}, "batch_discount_percent": 50, "max_charge_micros": 0, "held_micros": 0, "cost_micros": 0, "task_units": null, "request_counts": {"expired": 0, "cancelled": 0}}}Parts list: The Batch object
modelThe pinned id every line runs on: an id or alias in the lines resolves at creation and does not move during the window.
statusvalidating,failed,in_progress,finalizing,completed,expired,cancelling,cancelled, each with its time (Batch jobs says what each means).request_countstotal,completed(lines answered 2xx) andfailed(every line in the error file, expired and cancelled ones included).usageOpenAI's, summed over the finished lines.
errorsSet only in
failed:{"object": "list", "data": [{"code", "message", "param", "line"}]}, the validation codes of Batch jobs.hipsThe bound
quote, the frozenrequirements,batch_discount_percent(50),max_charge_microscomputed at validation,held_microsstill held against the balance,cost_microsof the lines finished so far,task_units, and the expired and cancelled lines amongfailed.
Parts list: Cancel and list
POST /v1/batches/{batch_id}/cancelNo body. A batch in
validatingorin_progressenterscancelling; one already cancelling or ended answers unchanged. Takesidempotency-key.GET /v1/batchesNewest first,
afterandlimit; OpenAI's list withfirst_id,last_idandhas_more. Afullkey lists the workspace's batches; aninference_onlykey and a person's token those they created.
Output and error lines
| Line kind | Where | Shape |
|---|---|---|
| Answered 2xx | Output file | id (batch_req_...), custom_id, response with status_code, request_id and body, error: null |
| Answered with an error status | Error file | The same response, its body the error envelope; not charged |
| Never answered | Error file | response: null, error with code (batch_expired, batch_cancelled, attempt_failed) and message; not charged |
- Line kind
- Answered 2xx
- Where
- Output file
- Shape
id(batch_req_...),custom_id,responsewithstatus_code,request_idandbody,error: null
- Line kind
- Answered with an error status
- Where
- Error file
- Shape
- The same
response, itsbodythe error envelope; not charged
- Line kind
- Never answered
- Where
- Error file
- Shape
response: null,errorwithcode(batch_expired,batch_cancelled,attempt_failed) andmessage; not charged
| Status | Type | Code | Situation | Retry |
|---|---|---|---|---|
| 400 | invalid_request_error | missing_required_parameter | A required field or header is absent; param names it | No |
| 400 | invalid_request_error | invalid_value | A value is out of range or malformed: stop with more than 16 entries, a prompt_cache_key over 512 characters, a string holding a lone surrogate escape, a router name with an empty or unknown suffix, both max_tokens names with different values | No |
| 400 | invalid_request_error | unsupported_value | n other than 1, stream_options without stream, a message role, part, item or tool type not accepted, a hosted tool that is not served | No |
| 400 | invalid_request_error | file_too_large, invalid_file_format, batch_not_offered | A batch input file over 200 MB; one that is not UTF-8 JSON Lines of objects, is empty, holds more than 50,000 lines, or names more than one model, one url or a router (the message names the first line at fault); a batch of a model sold without batch. Batches and files are not offered in production yet | No |
| 403 | permission_error | guardrail_unsupported | A content moderation guardrail applies to text it does not scan yet: a batch, or a task request with text; the guardrail named, uncharged | No |
| 404 | not_found_error | model_not_found | Unknown catalog id, alias, pinned id or dep_; another workspace's dep_; a name starting with hips-router that is not one of the four routers | No |
| 404 | not_found_error | upload_not_found, file_not_found, batch_not_found | An id in the path, or input_file_id, that is unknown, deleted, expired, another workspace's, or out of the credential's reach. Batches and files are not offered in production yet | No |
| 404 | not_found_error | route_not_available | A route that is built and not offered on this gateway: uploads, files and batches in production, and POST /v1/messages/count_tokens | No |
| 429 | rate_limit_error | rate_limit_exceeded | A rate limit; param is requests, tokens, uploads, batches (batches created per hour) or knowledge_search; Retry-After | Yes, after Retry-After |
| 429 | rate_limit_error | concurrency_limit_exceeded | Too many open batches; param is batches; Retry-After | Yes, after Retry-After |
- Status
- 400
- Type
invalid_request_error- Code
missing_required_parameter- Situation
- A required field or header is absent;
paramnames it - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
invalid_value- Situation
- A value is out of range or malformed:
stopwith more than 16 entries, aprompt_cache_keyover 512 characters, a string holding a lone surrogate escape, a router name with an empty or unknown suffix, bothmax_tokensnames with different values - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
unsupported_value- Situation
nother than 1,stream_optionswithoutstream, a message role, part, item or tool type not accepted, a hosted tool that is not served- Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
file_too_large,invalid_file_format,batch_not_offered- Situation
- A batch input file over 200 MB; one that is not UTF-8 JSON Lines of objects, is empty, holds more than 50,000 lines, or names more than one model, one
urlor a router (the message names the first line at fault); a batch of a model sold without batch. Batches and files are not offered in production yet - Retry
- No
- Status
- 403
- Type
permission_error- Code
guardrail_unsupported- Situation
- A content moderation guardrail applies to text it does not scan yet: a batch, or a task request with text; the guardrail named, uncharged
- Retry
- No
- Status
- 404
- Type
not_found_error- Code
model_not_found- Situation
- Unknown catalog id, alias, pinned id or
dep_; another workspace'sdep_; a name starting withhips-routerthat is not one of the four routers - Retry
- No
- Status
- 404
- Type
not_found_error- Code
upload_not_found,file_not_found,batch_not_found- Situation
- An id in the path, or
input_file_id, that is unknown, deleted, expired, another workspace's, or out of the credential's reach. Batches and files are not offered in production yet - Retry
- No
- Status
- 404
- Type
not_found_error- Code
route_not_available- Situation
- A route that is built and not offered on this gateway: uploads, files and batches in production, and
POST /v1/messages/count_tokens - Retry
- No
- Status
- 429
- Type
rate_limit_error- Code
rate_limit_exceeded- Situation
- A rate limit;
paramisrequests,tokens,uploads,batches(batches created per hour) orknowledge_search;Retry-After - Retry
- Yes, after
Retry-After
- Status
- 429
- Type
rate_limit_error- Code
concurrency_limit_exceeded- Situation
- Too many open batches;
paramisbatches;Retry-After - Retry
- Yes, after
Retry-After
Related sheets
- Sheet
- 17 of 19
- Detail
- L
- Updated
- 2026-11-11