ResponseUsage

@Serializable
class ResponseUsage(val inputTokens: Int, val inputTokensDetails: InputTokensDetails? = null, val outputTokens: Int, val outputTokensDetails: OutputTokensDetails? = null, val totalTokens: Int)

Token usage statistics of a ModelResponse.

The Responses API counts tokens under different names than /chat/completions: input and output rather than prompt and completion, with the cache hit reported inside inputTokensDetails instead of as a sibling field.

Constructors

Link copied to clipboard
constructor(inputTokens: Int, inputTokensDetails: InputTokensDetails? = null, outputTokens: Int, outputTokensDetails: OutputTokensDetails? = null, totalTokens: Int)

Properties

Link copied to clipboard

Number of input tokens.

Link copied to clipboard

Breakdown of inputTokens, in particular the context cache hit.

Link copied to clipboard

Number of output tokens, reasoning tokens included.

Link copied to clipboard

Breakdown of outputTokens, in particular the reasoning tokens.

Link copied to clipboard

Total tokens billed for the request (inputTokens + outputTokens).

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String