Table of Contents

Class GeminiUsageMetadata

Metadata on the generation request's token usage.

public class GeminiUsageMetadata : IAppendableData<GeminiUsageMetadata>
Inheritance
object
GeminiUsageMetadata
Implements
Extension Methods

Fields

CacheTokensDetails

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

public GeminiModalityTokenCount[] CacheTokensDetails

Field Value

GeminiModalityTokenCount[]

CachedContentTokenCount

Number of tokens in the cached part of the prompt, i.e. in the cached content.

public int CachedContentTokenCount

Field Value

int

CandidatesTokenCount

Total number of tokens across the generated candidates.

public int CandidatesTokenCount

Field Value

int

CandidatesTokensDetails

List of modalities that were returned in the response.

public GeminiModalityTokenCount[] CandidatesTokensDetails

Field Value

GeminiModalityTokenCount[]

PromptTokenCount

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

public int PromptTokenCount

Field Value

int

Remarks

Cached content is not supported in this package.

PromptTokensDetails

List of modalities that were processed in the request input.

public GeminiModalityTokenCount[] PromptTokensDetails

Field Value

GeminiModalityTokenCount[]

ThoughtsTokenCount

Number of tokens of thoughts for thinking models.

public int ThoughtsTokenCount

Field Value

int

ToolUsePromptTokenCount

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

public int ToolUsePromptTokenCount

Field Value

int

ToolUsePromptTokensDetails

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

public GeminiModalityTokenCount[] ToolUsePromptTokensDetails

Field Value

GeminiModalityTokenCount[]

TotalTokenCount

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

public int TotalTokenCount

Field Value

int

Methods

Append(GeminiUsageMetadata)

Appends the data to the current IAppendableData<T>.

public void Append(GeminiUsageMetadata data)

Parameters

data GeminiUsageMetadata

The data to append.