struct

Anthropic::Usage

Inherits JSON::Serializable < Struct < Value < Object

Token usage statistics for API requests

Tracks input and output tokens, as well as prompt caching statistics when applicable.

Constructors

new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

cache_creation

Breakdown of cached tokens by TTL

Source
cache_creation_input_tokens

Number of tokens written to the cache when creating a new entry

Source
cache_read_input_tokens

Number of tokens read from the cache

Source
fallback_credit

Outcome of the fallback_credit_token presented on this request.

Source
inference_geo

Geographic region where inference was performed

Source
input_tokens

Number of input tokens consumed

Source
iterations

Per-hop usage when a fallback chain ran. Each entry is either a declined (type: "message") or serving (type: "fallback_message") hop. Present only on responses that exercised server-side fallbacks.

Source
output_tokens

Number of output tokens generated

Source
output_tokens_details

Breakdown of output tokens by type (e.g. thinking)

Source
server_tool_use

Server tool usage statistics

Source
service_tier

Service tier used for the request

Source
speed

Inference speed mode ("standard" or "fast").

Source