class

OpenAI::Batch

Inherits JSON::Serializable < Reference < Object

Constructors

new(id : String = "", object : BatchObject = BatchObject::Batch, endpoint : String = "", model : String | Nil = nil, errors : BatchErrors | Nil = nil, input_file_id : String = "", completion_window : String = "", status : BatchStatus = BatchStatus::Validating, output_file_id : String | Nil = nil, error_file_id : String | Nil = nil, created_at : Int64 = 0, in_progress_at : Int64 | Nil = nil, expires_at : Int64 | Nil = nil, finalizing_at : Int64 | Nil = nil, completed_at : Int64 | Nil = nil, failed_at : Int64 | Nil = nil, expired_at : Int64 | Nil = nil, cancelling_at : Int64 | Nil = nil, cancelled_at : Int64 | Nil = nil, request_counts : BatchRequestCounts | Nil = nil, usage : BatchUsage | Nil = nil, metadata : Metadata | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

cancelled_at

The Unix timestamp (in seconds) for when the batch was cancelled.

Source
cancelled_at=(cancelled_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch was cancelled.

Source
cancelling_at

The Unix timestamp (in seconds) for when the batch started cancelling.

Source
cancelling_at=(cancelling_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch started cancelling.

Source
completed_at

The Unix timestamp (in seconds) for when the batch was completed.

Source
completed_at=(completed_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch was completed.

Source
completion_window

The time frame within which the batch should be processed.

Source
completion_window=(completion_window : String)

The time frame within which the batch should be processed.

Source
created_at

The Unix timestamp (in seconds) for when the batch was created.

Source
created_at=(created_at : Int64)

The Unix timestamp (in seconds) for when the batch was created.

Source
endpoint

The OpenAI API endpoint used by the batch.

Source
endpoint=(endpoint : String)

The OpenAI API endpoint used by the batch.

Source
error_file_id

The ID of the file containing the outputs of requests with errors.

Source
error_file_id=(error_file_id : String | Nil)

The ID of the file containing the outputs of requests with errors.

Source
errors
Source
errors=(errors : BatchErrors | Nil)
Source
expired_at

The Unix timestamp (in seconds) for when the batch expired.

Source
expired_at=(expired_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch expired.

Source
expires_at

The Unix timestamp (in seconds) for when the batch will expire.

Source
expires_at=(expires_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch will expire.

Source
failed_at

The Unix timestamp (in seconds) for when the batch failed.

Source
failed_at=(failed_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch failed.

Source
finalizing_at

The Unix timestamp (in seconds) for when the batch started finalizing.

Source
finalizing_at=(finalizing_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch started finalizing.

Source
id=(id : String)
Source
in_progress_at

The Unix timestamp (in seconds) for when the batch started processing.

Source
in_progress_at=(in_progress_at : Int64 | Nil)

The Unix timestamp (in seconds) for when the batch started processing.

Source
input_file_id

The ID of the input file for the batch.

Source
input_file_id=(input_file_id : String)

The ID of the input file for the batch.

Source
metadata
Source
metadata=(metadata : Metadata | Nil)
Source
model

Model ID used to process the batch, like gpt-5-2025-08-07. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Source
model=(model : String | Nil)

Model ID used to process the batch, like gpt-5-2025-08-07. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.

Source
object

The object type, which is always batch.

Source
object=(object : BatchObject)

The object type, which is always batch.

Source
output_file_id

The ID of the file containing the outputs of successfully executed requests.

Source
output_file_id=(output_file_id : String | Nil)

The ID of the file containing the outputs of successfully executed requests.

Source
request_counts
Source
request_counts=(request_counts : BatchRequestCounts | Nil)
Source
status

The current status of the batch.

Source
status=(status : BatchStatus)

The current status of the batch.

Source
usage

Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. Only populated on batches created after September 7, 2025.

Source
usage=(usage : BatchUsage | Nil)

Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. Only populated on batches created after September 7, 2025.

Source