Interface UsageMetadata

Usage metadata about response(s).

interface UsageMetadata {
    cachedContentTokenCount?: number;
    cacheTokensDetails?: ModalityTokenCount[];
    promptTokenCount?: number;
    promptTokensDetails?: ModalityTokenCount[];
    responseTokenCount?: number;
    responseTokensDetails?: ModalityTokenCount[];
    thoughtsTokenCount?: number;
    toolUsePromptTokenCount?: number;
    toolUsePromptTokensDetails?: ModalityTokenCount[];
    totalTokenCount?: number;
    trafficType?: TrafficType;
}

Properties

cachedContentTokenCount?: number

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

cacheTokensDetails?: ModalityTokenCount[]

List of modalities that were processed in the cache input.

promptTokenCount?: number

Number of tokens in the prompt. When cached_content is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.

promptTokensDetails?: ModalityTokenCount[]

List of modalities that were processed in the request input.

responseTokenCount?: number

Total number of tokens across all the generated response candidates.

responseTokensDetails?: ModalityTokenCount[]

List of modalities that were returned in the response.

thoughtsTokenCount?: number

Number of tokens of thoughts for thinking models.

toolUsePromptTokenCount?: number

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

toolUsePromptTokensDetails?: ModalityTokenCount[]

List of modalities that were processed in the tool-use prompt.

totalTokenCount?: number

Total token count for prompt, response candidates, and tool-use prompts(if present).

trafficType?: TrafficType

Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota.