struct

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(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

cache_creation_tokens
Source
cache_read_tokens
Source
cached?
Source
completion_tokens
Source
prompt_tokens
Source
total_tokens
Source
zero?
Source