UsageMetadata

@Serializable
data class UsageMetadata(val promptTokenCount: Int? = null, val candidatesTokenCount: Int? = null, val totalTokenCount: Int? = null, val thoughtsTokenCount: Int? = null, val toolUsePromptTokenCount: Int? = null, val cachedContentTokenCount: Int? = null, val promptTokensDetails: List<ModalityTokenCount>? = null, val candidatesTokensDetails: List<ModalityTokenCount>? = null)

Usage metadata for a generate content request.

Constructors

Link copied to clipboard
constructor(promptTokenCount: Int? = null, candidatesTokenCount: Int? = null, totalTokenCount: Int? = null, thoughtsTokenCount: Int? = null, toolUsePromptTokenCount: Int? = null, cachedContentTokenCount: Int? = null, promptTokensDetails: List<ModalityTokenCount>? = null, candidatesTokensDetails: List<ModalityTokenCount>? = null)

Properties

Link copied to clipboard

The number of tokens served from the cached content (cache read).

Link copied to clipboard

The number of tokens in the candidates.

Link copied to clipboard

A per-modality breakdown of the candidates token count.

Link copied to clipboard
val promptTokenCount: Int? = null

The number of tokens in the prompt.

Link copied to clipboard

A per-modality breakdown of the prompt token count.

Link copied to clipboard
val thoughtsTokenCount: Int? = null

The number of tokens that were part of the model's "thoughts" output, for thinking models.

Link copied to clipboard

The number of tokens in tool-execution results provided back to the model as input.

Link copied to clipboard
val totalTokenCount: Int? = null

The total number of tokens.