struct

Gemini::GenerateContentResponse::UsageMetadata

Inherits JSON::Serializable < Struct < Value < Object

Metadata on the generation request's token usage.

API Reference

Constructors

new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

cached_content_token_count

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

Source
candidates_token_count

Total number of tokens across all the generated response candidates.

Source
prompt_token_count

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.

Source
total_token_count

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

Source