UsageMetadata class final

Usage metadata about the content generation request and response. This message provides a detailed breakdown of token usage and other relevant metrics.

Constructors

UsageMetadata({int promptTokenCount = 0, int candidatesTokenCount = 0, int totalTokenCount = 0, int toolUsePromptTokenCount = 0, int thoughtsTokenCount = 0, int cachedContentTokenCount = 0, List<ModalityTokenCount> promptTokensDetails = const [], List<ModalityTokenCount> cacheTokensDetails = const [], List<ModalityTokenCount> candidatesTokensDetails = const [], List<ModalityTokenCount> toolUsePromptTokensDetails = const [], UsageMetadata_TrafficType trafficType = UsageMetadata_TrafficType.$default})
UsageMetadata.fromJson(Object? j)
factory

Properties

cachedContentTokenCount → int
Output only. The number of tokens in the cached content that was used for this request.
final
cacheTokensDetails → List<ModalityTokenCount>
Output only. A detailed breakdown of the token count for each modality in the cached content.
final
candidatesTokenCount → int
The total number of tokens in the generated candidates.
final
candidatesTokensDetails → List<ModalityTokenCount>
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
final
hashCode → int
The hash code for this object.
no setterinherited
promptTokenCount → int
The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When cached_content is set, this also includes the number of tokens in the cached content.
final
promptTokensDetails → List<ModalityTokenCount>
Output only. A detailed breakdown of the token count for each modality in the prompt.
final
qualifiedName → String
The fully qualified name of this message, i.e., google.protobuf.Duration or google.rpc.ErrorInfo.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
thoughtsTokenCount → int
Output only. The number of tokens that were part of the model's generated "thoughts" output, if applicable.
final
toolUsePromptTokenCount → int
Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable.
final
toolUsePromptTokensDetails → List<ModalityTokenCount>
Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input.
final
totalTokenCount → int
The total number of tokens for the entire request. This is the sum of prompt_token_count, candidates_token_count, tool_use_prompt_token_count, and thoughts_token_count.
final
trafficType → UsageMetadata_TrafficType
Output only. The traffic type for this request.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Object
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

fullyQualifiedName → const String