ModalityTokenCount Stay organized with collections Save and categorize content based on your preferences.
Represents a breakdown of token usage by modality.
This message is used in [CountTokensResponse][google.cloud.aiplatform.master.CountTokensResponse] andGenerateContentResponse.UsageMetadata to provide a detailed view of how many tokens are used by each modality (e.g., text, image, video) in a request. This is particularly useful for multimodal models, allowing you to track and manage token consumption for billing and quota purposes.
modalityenum (Modality)The modality that this token count applies to.
tokenCountintegerThe number of tokens counted for this modality.
| JSON representation |
|---|
{"modality":enum ( |
Modality
The modality of aPart of aContent message. A modality is the type of media, such as an image or a video. It is used to categorize the content of aPart for token counting purposes.
| Enums | |
|---|---|
MODALITY_UNSPECIFIED | When a modality is not specified, it is treated asTEXT. |
TEXT | ThePart contains plain text. |
IMAGE | ThePart contains an image. |
VIDEO | ThePart contains a video. |
AUDIO | ThePart contains audio. |
DOCUMENT | ThePart contains a document, such as a PDF. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-17 UTC.