UsageMetadata

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, val toolUsePromptTokensDetails: List<ModalityTokenCount>? = null, val trafficType: String? = 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, toolUsePromptTokensDetails: List<ModalityTokenCount>? = null, trafficType: String? = 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

The number of tokens in the prompt.

Link copied to clipboard

A per-modality breakdown of the prompt token count.

Link copied to clipboard

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

A per-modality breakdown of the tool-use prompt token count.

Link copied to clipboard

The total number of tokens.

Link copied to clipboard

The traffic type for the request (e.g. "ON_DEMAND", "PROVISIONED_THROUGHPUT").