Table of Contents

Class UsageMetadata

Namespace
GenerativeAI.Types
Assembly
GenerativeAI.dll

Metadata on the generation request's token usage.

public class UsageMetadata
Inheritance
UsageMetadata
Inherited Members
Extension Methods

Properties

CacheTokensDetails

Output only. List of modalities of the cached content in the request input.

[JsonPropertyName("cacheTokensDetails")]
public List<ModalityTokenCount>? CacheTokensDetails { get; set; }

Property Value

List<ModalityTokenCount>

CachedContentTokenCount

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

[JsonPropertyName("cachedContentTokenCount")]
public int CachedContentTokenCount { get; set; }

Property Value

int

CandidatesTokenCount

Total number of tokens across all the generated response candidates.

[JsonPropertyName("candidatesTokenCount")]
public int CandidatesTokenCount { get; set; }

Property Value

int

CandidatesTokensDetails

Output only. List of modalities that were returned in the response.

[JsonPropertyName("candidatesTokensDetails")]
public List<ModalityTokenCount>? CandidatesTokensDetails { get; set; }

Property Value

List<ModalityTokenCount>

PromptTokenCount

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

[JsonPropertyName("promptTokenCount")]
public int PromptTokenCount { get; set; }

Property Value

int

PromptTokensDetails

Output only. List of modalities that were processed in the request input.

[JsonPropertyName("promptTokensDetails")]
public List<ModalityTokenCount>? PromptTokensDetails { get; set; }

Property Value

List<ModalityTokenCount>

ResponseTokenCount

Output only. Total number of tokens across all the generated response candidates. This is an alias for CandidatesTokenCount used in newer API versions.

[JsonPropertyName("responseTokenCount")]
public int? ResponseTokenCount { get; set; }

Property Value

int?

ResponseTokensDetails

Output only. List of modalities that were returned in the response. This is an alias for CandidatesTokensDetails used in newer API versions.

[JsonPropertyName("responseTokensDetails")]
public List<ModalityTokenCount>? ResponseTokensDetails { get; set; }

Property Value

List<ModalityTokenCount>

ThoughtsTokenCount

Output only. Number of tokens of thoughts for thinking models.

[JsonPropertyName("thoughtsTokenCount")]
public int ThoughtsTokenCount { get; set; }

Property Value

int

ToolUsePromptTokenCount

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

[JsonPropertyName("toolUsePromptTokenCount")]
public int ToolUsePromptTokenCount { get; set; }

Property Value

int

ToolUsePromptTokensDetails

Output only. List of modalities that were processed for tool-use request inputs.

[JsonPropertyName("toolUsePromptTokensDetails")]
public List<ModalityTokenCount>? ToolUsePromptTokensDetails { get; set; }

Property Value

List<ModalityTokenCount>

TotalTokenCount

Total token count for the generation request (prompt + response candidates).

[JsonPropertyName("totalTokenCount")]
public int? TotalTokenCount { get; set; }

Property Value

int?

TrafficType

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

[JsonPropertyName("trafficType")]
public TrafficType? TrafficType { get; set; }

Property Value

TrafficType?

See Also