@Generated public final class UsageMetadata extends com.google.protobuf.GeneratedMessage implements UsageMetadataOrBuilder
Usage metadata about the content generation request and response. This message provides a detailed breakdown of token usage and other relevant metrics.Protobuf type
google.cloud.aiplatform.v1.UsageMetadata| Modifier and Type | Class and Description |
|---|---|
static class |
UsageMetadata.Builder
Usage metadata about the content generation request and response.
|
static class |
UsageMetadata.TrafficType
The type of traffic that this request was processed with, indicating which
quota gets consumed.
|
com.google.protobuf.GeneratedMessage.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessage.ExtendableBuilder<MessageT,BuilderT>>, com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessage.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessage.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessage.FieldAccessorTable, com.google.protobuf.GeneratedMessage.GeneratedExtension<ContainingT extends com.google.protobuf.Message,T>, com.google.protobuf.GeneratedMessage.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
CACHE_TOKENS_DETAILS_FIELD_NUMBER |
static int |
CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER |
static int |
CANDIDATES_TOKEN_COUNT_FIELD_NUMBER |
static int |
CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER |
static int |
PROMPT_TOKEN_COUNT_FIELD_NUMBER |
static int |
PROMPT_TOKENS_DETAILS_FIELD_NUMBER |
static int |
THOUGHTS_TOKEN_COUNT_FIELD_NUMBER |
static int |
TOOL_USE_PROMPT_TOKEN_COUNT_FIELD_NUMBER |
static int |
TOOL_USE_PROMPT_TOKENS_DETAILS_FIELD_NUMBER |
static int |
TOTAL_TOKEN_COUNT_FIELD_NUMBER |
static int |
TRAFFIC_TYPE_FIELD_NUMBER |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, newFileScopedGeneratedExtension, newInstance, newMessageScopedGeneratedExtension, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashFields, toStringaddAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int PROMPT_TOKEN_COUNT_FIELD_NUMBER
public static final int CANDIDATES_TOKEN_COUNT_FIELD_NUMBER
public static final int TOTAL_TOKEN_COUNT_FIELD_NUMBER
public static final int TOOL_USE_PROMPT_TOKEN_COUNT_FIELD_NUMBER
public static final int THOUGHTS_TOKEN_COUNT_FIELD_NUMBER
public static final int CACHED_CONTENT_TOKEN_COUNT_FIELD_NUMBER
public static final int PROMPT_TOKENS_DETAILS_FIELD_NUMBER
public static final int CACHE_TOKENS_DETAILS_FIELD_NUMBER
public static final int CANDIDATES_TOKENS_DETAILS_FIELD_NUMBER
public static final int TOOL_USE_PROMPT_TOKENS_DETAILS_FIELD_NUMBER
public static final int TRAFFIC_TYPE_FIELD_NUMBER
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessagepublic int getPromptTokenCount()
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.
int32 prompt_token_count = 1;getPromptTokenCount in interface UsageMetadataOrBuilderpublic int getCandidatesTokenCount()
The total number of tokens in the generated candidates.
int32 candidates_token_count = 2;getCandidatesTokenCount in interface UsageMetadataOrBuilderpublic int getTotalTokenCount()
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`.
int32 total_token_count = 3;getTotalTokenCount in interface UsageMetadataOrBuilderpublic int getToolUsePromptTokenCount()
Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable.
int32 tool_use_prompt_token_count = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];
getToolUsePromptTokenCount in interface UsageMetadataOrBuilderpublic int getThoughtsTokenCount()
Output only. The number of tokens that were part of the model's generated "thoughts" output, if applicable.
int32 thoughts_token_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];getThoughtsTokenCount in interface UsageMetadataOrBuilderpublic int getCachedContentTokenCount()
Output only. The number of tokens in the cached content that was used for this request.
int32 cached_content_token_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];getCachedContentTokenCount in interface UsageMetadataOrBuilderpublic List<ModalityTokenCount> getPromptTokensDetailsList()
Output only. A detailed breakdown of the token count for each modality in the prompt.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
getPromptTokensDetailsList in interface UsageMetadataOrBuilderpublic List<? extends ModalityTokenCountOrBuilder> getPromptTokensDetailsOrBuilderList()
Output only. A detailed breakdown of the token count for each modality in the prompt.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
getPromptTokensDetailsOrBuilderList in interface UsageMetadataOrBuilderpublic int getPromptTokensDetailsCount()
Output only. A detailed breakdown of the token count for each modality in the prompt.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
getPromptTokensDetailsCount in interface UsageMetadataOrBuilderpublic ModalityTokenCount getPromptTokensDetails(int index)
Output only. A detailed breakdown of the token count for each modality in the prompt.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
getPromptTokensDetails in interface UsageMetadataOrBuilderpublic ModalityTokenCountOrBuilder getPromptTokensDetailsOrBuilder(int index)
Output only. A detailed breakdown of the token count for each modality in the prompt.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount prompt_tokens_details = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
getPromptTokensDetailsOrBuilder in interface UsageMetadataOrBuilderpublic List<ModalityTokenCount> getCacheTokensDetailsList()
Output only. A detailed breakdown of the token count for each modality in the cached content.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCacheTokensDetailsList in interface UsageMetadataOrBuilderpublic List<? extends ModalityTokenCountOrBuilder> getCacheTokensDetailsOrBuilderList()
Output only. A detailed breakdown of the token count for each modality in the cached content.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCacheTokensDetailsOrBuilderList in interface UsageMetadataOrBuilderpublic int getCacheTokensDetailsCount()
Output only. A detailed breakdown of the token count for each modality in the cached content.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCacheTokensDetailsCount in interface UsageMetadataOrBuilderpublic ModalityTokenCount getCacheTokensDetails(int index)
Output only. A detailed breakdown of the token count for each modality in the cached content.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCacheTokensDetails in interface UsageMetadataOrBuilderpublic ModalityTokenCountOrBuilder getCacheTokensDetailsOrBuilder(int index)
Output only. A detailed breakdown of the token count for each modality in the cached content.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount cache_tokens_details = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCacheTokensDetailsOrBuilder in interface UsageMetadataOrBuilderpublic List<ModalityTokenCount> getCandidatesTokensDetailsList()
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCandidatesTokensDetailsList in interface UsageMetadataOrBuilderpublic List<? extends ModalityTokenCountOrBuilder> getCandidatesTokensDetailsOrBuilderList()
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCandidatesTokensDetailsOrBuilderList in interface UsageMetadataOrBuilderpublic int getCandidatesTokensDetailsCount()
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCandidatesTokensDetailsCount in interface UsageMetadataOrBuilderpublic ModalityTokenCount getCandidatesTokensDetails(int index)
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCandidatesTokensDetails in interface UsageMetadataOrBuilderpublic ModalityTokenCountOrBuilder getCandidatesTokensDetailsOrBuilder(int index)
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount candidates_tokens_details = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
getCandidatesTokensDetailsOrBuilder in interface UsageMetadataOrBuilderpublic List<ModalityTokenCount> getToolUsePromptTokensDetailsList()
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.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
getToolUsePromptTokensDetailsList in interface UsageMetadataOrBuilderpublic List<? extends ModalityTokenCountOrBuilder> getToolUsePromptTokensDetailsOrBuilderList()
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.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
getToolUsePromptTokensDetailsOrBuilderList in interface UsageMetadataOrBuilderpublic int getToolUsePromptTokensDetailsCount()
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.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
getToolUsePromptTokensDetailsCount in interface UsageMetadataOrBuilderpublic ModalityTokenCount getToolUsePromptTokensDetails(int index)
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.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
getToolUsePromptTokensDetails in interface UsageMetadataOrBuilderpublic ModalityTokenCountOrBuilder getToolUsePromptTokensDetailsOrBuilder(int index)
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.
repeated .google.cloud.aiplatform.v1.ModalityTokenCount tool_use_prompt_tokens_details = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
getToolUsePromptTokensDetailsOrBuilder in interface UsageMetadataOrBuilderpublic int getTrafficTypeValue()
Output only. The traffic type for this request.
.google.cloud.aiplatform.v1.UsageMetadata.TrafficType traffic_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
getTrafficTypeValue in interface UsageMetadataOrBuilderpublic UsageMetadata.TrafficType getTrafficType()
Output only. The traffic type for this request.
.google.cloud.aiplatform.v1.UsageMetadata.TrafficType traffic_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
getTrafficType in interface UsageMetadataOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessagepublic void writeTo(com.google.protobuf.CodedOutputStream output)
throws IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageIOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessagepublic boolean equals(Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static UsageMetadata parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static UsageMetadata parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static UsageMetadata parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static UsageMetadata parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static UsageMetadata parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static UsageMetadata parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static UsageMetadata parseFrom(InputStream input) throws IOException
IOExceptionpublic static UsageMetadata parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static UsageMetadata parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static UsageMetadata parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static UsageMetadata parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static UsageMetadata parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic UsageMetadata.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static UsageMetadata.Builder newBuilder()
public static UsageMetadata.Builder newBuilder(UsageMetadata prototype)
public UsageMetadata.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected UsageMetadata.Builder newBuilderForType(com.google.protobuf.AbstractMessage.BuilderParent parent)
newBuilderForType in class com.google.protobuf.AbstractMessagepublic static UsageMetadata getDefaultInstance()
public static com.google.protobuf.Parser<UsageMetadata> parser()
public com.google.protobuf.Parser<UsageMetadata> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessagepublic UsageMetadata getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilderCopyright © 2026 Google LLC. All rights reserved.