class

OpenAI::BatchUsage

Inherits JSON::Serializable < Reference < Object

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.

Constructors

new(input_tokens : Int64 = 0, input_tokens_details : BatchUsageInputTokensDetails = BatchUsageInputTokensDetails.new, output_tokens : Int64 = 0, output_tokens_details : BatchUsageOutputTokensDetails = BatchUsageOutputTokensDetails.new, total_tokens : Int64 = 0)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

input_tokens

The number of input tokens.

Source
input_tokens=(input_tokens : Int64)

The number of input tokens.

Source
input_tokens_details

A detailed breakdown of the input tokens.

Source
input_tokens_details=(input_tokens_details : BatchUsageInputTokensDetails)

A detailed breakdown of the input tokens.

Source
output_tokens

The number of output tokens.

Source
output_tokens=(output_tokens : Int64)

The number of output tokens.

Source
output_tokens_details

A detailed breakdown of the output tokens.

Source
output_tokens_details=(output_tokens_details : BatchUsageOutputTokensDetails)

A detailed breakdown of the output tokens.

Source
total_tokens

The total number of tokens used.

Source
total_tokens=(total_tokens : Int64)

The total number of tokens used.

Source