Skip to main content
POST
Create Openai Batch
When called with an API key, the key needs the batch scope (about scopes).

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

xi-api-key
string | null
x-api-key
string | null

Body

application/json
input_file_id
string
required

The ID of an uploaded file that contains requests for the new batch.

endpoint
enum<string>
required

The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions, /v1/embeddings are supported.

Available options:
/v1/chat/completions,
/v1/completions,
/v1/embeddings
completion_window
string
required

The time frame within which the batch should be processed. Currently only 24h is supported.

Allowed value: "24h"
metadata
Metadata · object | null

Optional metadata to be stored with the batch.

output_expires_after
BatchOutputExpiresAfter · object | null

The expiration policy for the output and/or error file generated for the batch.

Response

Successful Response

id
string
required

The batch ID.

endpoint
string
required

The API endpoint used for the batch.

input_file_id
string
required

The ID of the input file for the batch.

completion_window
string
required

The time frame within which the batch should be processed.

status
string
required

The current status of the batch.

created_at
integer
required

The Unix timestamp of when the batch was created.

expires_at
integer
required

The Unix timestamp of when the batch will expire.

object
string
default:batch

The object type, which is always batch.

Allowed value: "batch"
errors
BatchErrors · object | null

Errors that occurred during the batch.

output_file_id
string | null

The ID of the output file.

error_file_id
string | null

The ID of the error file.

in_progress_at
integer | null

The Unix timestamp of when the batch started processing.

finalizing_at
integer | null

The Unix timestamp of when the batch started finalizing.

completed_at
integer | null

The Unix timestamp of when the batch completed.

failed_at
integer | null

The Unix timestamp of when the batch failed.

expired_at
integer | null

The Unix timestamp of when the batch expired.

cancelling_at
integer | null

The Unix timestamp of when the batch started cancelling.

cancelled_at
integer | null

The Unix timestamp of when the batch was cancelled.

request_counts
BatchRequestCounts · object | null

Request counts for the batch.

metadata
Metadata · object | null

Metadata associated with the batch.

model
string | null

The model used for the batch.

usage
BatchUsage · object | null

Token usage accumulated for the batch.