package message // Usage tracks token consumption for a single API turn. type Usage struct { InputTokens int64 `json:"input_tokens"` OutputTokens int64 `json:"output_tokens"` CacheReadTokens int64 `json:"cache_read_tokens,omitempty"` CacheCreationTokens int64 `json:"cache_creation_tokens,omitempty"` } func (u Usage) TotalTokens() int64 { return u.InputTokens + u.OutputTokens } func (u *Usage) Add(other Usage) { u.InputTokens += other.InputTokens u.OutputTokens += other.OutputTokens u.CacheReadTokens += other.CacheReadTokens u.CacheCreationTokens += other.CacheCreationTokens }