struct Gemini::GenerateContentResponse::UsageMetadata

Overview

Metadata on the generation request's token usage.

API Reference

Included Modules

Defined in:

gemini/response.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

Instance Method Detail

def cached_content_token_count : Int32 | Nil #

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


def candidates_token_count : Int32 | Nil #

Total number of tokens across all the generated response candidates.


def prompt_token_count : Int32 #

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.


def total_token_count : Int32 #

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