Smith::LLM::Usage
Inherits JSON::Serializable < Struct < Value < Object
Constructors
new(pull : JSON::PullParser)
Sourcenew(prompt_tokens : Int32 = 0, completion_tokens : Int32 = 0, total_tokens : Int32 = 0, cache_creation_tokens : Int32 = 0, cache_read_tokens : Int32 = 0)
Sourcenew(*, __pull_for_json_serializable pull : JSON::PullParser)
SourceInstance methods
+(other : Usage) : Usage
Sourcebilled_prompt_tokens
How big the prompt actually was. Anthropic reports the cached part
separately, so prompt_tokens alone is the uncached remainder — a few
hundred tokens on a cache hit, which is not the size of anything. Callers
measuring context usage want this; callers pricing a request do not,
because the parts are billed at different rates.
cache_creation_tokens
Anthropic prompt caching. Defaulted here as well as in the constructor, so sessions saved before these fields existed still deserialize.
cache_read_tokens
Sourcecompletion_tokens
Sourceprompt_tokens
Sourcetotal_tokens
Source