Breakdown of the completion token usage OpenAI returns for a chat completion, distinguishing tokens spent on reasoning, audio and predicted-output handling from the total completion tokens. Nested inside CompletionsUsage as the completion_tokens_details field of an OpenAI chat completion response.


Properties

PropertyReturnsDescription
acceptedPredictionTokensIntegerNumber of tokens from a supplied predicted output that appeared in the model's completion and so were accepted, reducing the effective cost of the request.
audioTokensIntegerNumber of completion tokens generated as audio output.
reasoningTokensIntegerNumber of completion tokens the model spent on internal reasoning before producing its visible output.
rejectedPredictionTokensIntegerNumber of tokens from a supplied predicted output that did not appear in the model's completion and were rejected, and so were still billed as completion tokens.

Methods

getReasoningTokens()

Returns: Integer

Number of completion tokens the model spent on internal reasoning before producing its visible output.

getAudioTokens()

Returns: Integer

Number of completion tokens generated as audio output.

getAcceptedPredictionTokens()

Returns: Integer

Number of tokens from a supplied predicted output that appeared in the model's completion and so were accepted, reducing the effective cost of the request.

getRejectedPredictionTokens()

Returns: Integer

Number of tokens from a supplied predicted output that did not appear in the model's completion and were rejected, and so were still billed as completion tokens.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.