OpenAIUsage
@Serializable
Token usage statistics from an OpenAI chat completion response.
Example:
{
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30,
"prompt_tokens_details": { "cached_tokens": 4 },
"completion_tokens_details": { "reasoning_tokens": 5 }
}Content copied to clipboard
Constructors
Link copied to clipboard
constructor(promptTokens: Int, completionTokens: Int, totalTokens: Int, promptTokensDetails: OpenAIPromptTokensDetails? = null, completionTokensDetails: OpenAICompletionTokensDetails? = null)
Properties
Link copied to clipboard
Number of tokens in the completion.
Link copied to clipboard
@SerialName(value = "completion_tokens_details")
Breakdown of completion tokens (e.g. reasoning tokens). null when details are not included.
Link copied to clipboard
Number of tokens in the prompt.
Link copied to clipboard
Breakdown of prompt tokens (e.g. cached tokens). null when details are not included.
Link copied to clipboard
Total number of tokens (prompt + completion).