Autobot::Providers::TokenUsage
Inherits JSON::Serializable < Struct < Value < Object
Token usage from an LLM API response.
Includes optional cache token fields reported by providers that support prompt caching (e.g. Anthropic).
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
cache_creation_tokens
Sourcecache_read_tokens
Sourcecached?
Sourcecompletion_tokens
Sourceprompt_tokens
Sourcetotal_tokens
Sourcezero?
Source