struct

Smith::LLM::Usage

Inherits JSON::Serializable < Struct < Value < Object

Constructors

new(pull : JSON::PullParser)
Source
new(prompt_tokens : Int32 = 0, completion_tokens : Int32 = 0, total_tokens : Int32 = 0, cache_creation_tokens : Int32 = 0, cache_read_tokens : Int32 = 0)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

+(other : Usage) : Usage
Source
cache_creation_tokens

Anthropic prompt caching. Defaulted here as well as in the constructor, so sessions saved before these fields existed still deserialize.

Source
cache_read_tokens
Source
cached_tokens

Everything that went through the cache, written or read.

Source
completion_tokens
Source
prompt_tokens
Source
total_tokens
Source