Usage

Statistics on the interaction request's token usage.

Fields
totalInputTokens integer

Number of tokens in the prompt (context).

inputTokensByModality[] object (ModalityTokens)

A breakdown of input token usage by modality.

totalCachedTokens integer

Number of tokens in the cached part of the prompt (the cached content).

cachedTokensByModality[] object (ModalityTokens)

A breakdown of cached token usage by modality.

totalOutputTokens integer

Total number of tokens across all the generated responses.

outputTokensByModality[] object (ModalityTokens)

A breakdown of output token usage by modality.

totalToolUseTokens integer

Number of tokens present in tool-use prompt(s).

toolUseTokensByModality[] object (ModalityTokens)

A breakdown of tool-use token usage by modality.

totalThoughtTokens integer

Number of tokens of thoughts for thinking models.

totalTokens integer

Total token count for the interaction request (prompt + responses + other internal tokens).

groundingToolCount[] object (GroundingToolCount)

Grounding tool count.

JSON representation
{
  "totalInputTokens": integer,
  "inputTokensByModality": [
    {
      object (ModalityTokens)
    }
  ],
  "totalCachedTokens": integer,
  "cachedTokensByModality": [
    {
      object (ModalityTokens)
    }
  ],
  "totalOutputTokens": integer,
  "outputTokensByModality": [
    {
      object (ModalityTokens)
    }
  ],
  "totalToolUseTokens": integer,
  "toolUseTokensByModality": [
    {
      object (ModalityTokens)
    }
  ],
  "totalThoughtTokens": integer,
  "totalTokens": integer,
  "groundingToolCount": [
    {
      object (GroundingToolCount)
    }
  ]
}

ModalityTokens

The token count for a single response modality.

Fields
modality enum (ResponseModality)

The modality associated with the token count.

tokens integer

Number of tokens for the modality.

JSON representation
{
  "modality": enum (ResponseModality),
  "tokens": integer
}

ResponseModality

The modality of the response.

Enums
RESPONSE_MODALITY_UNSPECIFIED Default value. This value is unused.
TEXT Indicates the model should return text.
IMAGE Indicates the model should return images.
AUDIO Indicates the model should return audio.
VIDEO Indicates the model should return video.
DOCUMENT Indicates the model should return documents.

GroundingToolCount

The number of grounding tool counts.

Fields
type enum (Type)

The grounding tool type associated with the count.

count integer

The number of grounding tool counts.

JSON representation
{
  "type": enum (Type),
  "count": integer
}

Type

The type of grounding tool.

Enums
TYPE_UNSPECIFIED Default value. This value is unused.
GOOGLE_MAPS Grounding with Google Maps.
RETRIEVAL Grounding with customer's data, for example, VertexAISearch.