struct

GameLoop::UsageTotals

Inherits Struct < Value < Object

Accumulated token usage across all API calls in a single turn. The Tool Runner may make several requests (one per tool hop), so we sum them with #add. cache_read / cache_creation make prompt-caching effectiveness visible. NOTE: Anthropic's input_tokens excludes cached tokens; the cache fields are reported separately, so cache_hit_percent uses all three.

Constructors

new(input : Int32 = 0, output : Int32 = 0, cache_creation : Int32 = 0, cache_read : Int32 = 0, thinking : Int32 = 0)
Source

Instance methods

add(usage : Anthropic::Usage) : Nil
Source
add(other : UsageTotals) : Nil

Merge another turn's totals into this one (used to accumulate usage across the whole autopilot run).

Source
cache_creation
Source
cache_read
Source
input
Source
output
Source
thinking
Source