Usage
Token usage statistics for a single chat or FIM request.
For streamed responses the ChatCompletionChunk.usage or FIMCompletion.usage field is populated only on the final usage-only chunk, which the API emits when streamOptions.includeUsage is set.
Constructors
Properties
Number of tokens in the generated completion.
Breakdown of how completionTokens was spent (e.g. reasoning tokens for deepseek-reasoner).
Number of prompt tokens served from the context cache, or null when caching does not apply. Legacy field; newer responses may report the same information under promptTokensDetails instead.
Number of prompt tokens not served from the context cache, or null when caching does not apply. Legacy field; see promptTokensDetails.
Number of tokens in the prompt. When context caching applies, this equals promptCacheHitTokens + promptCacheMissTokens.
Structured breakdown of promptTokens under the prompt_tokens_details key, matching the OpenAI-compatible shape. May be null for older API versions.
Total tokens billed for the request (prompt + completion).