usage
A statistics object returned in the API responses of mainstream large language models, containing information such as input and output token counts and cache read/write token counts, used for cost accounting and determining cache hits.
Timeline (last 90 days)
The usage field in the Messages API has always been used to return the token statistics of the current call (such as input_tokens, output_tokens).
Whether caching is working can be determined by checking the usage block in each response (such as the ratio of cache_read_input_tokens to input_tokens) rather than by feeling.
The usage object in mainstream API responses typically includes fields such as input_tokens, output_tokens, cache_creation_input_tokens, and cache_read_input_tokens; naming differs slightly across providers but the semantics are similar.
All Facts (3)
The usage field in the Messages API has always been used to return the token statistics of the current call (such as input_tokens, output_tokens).
50%UnverifiedWhether caching is working can be determined by checking the usage block in each response (such as the ratio of cache_read_input_tokens to input_tokens) rather than by feeling.
50%UnverifiedThe usage object in mainstream API responses typically includes fields such as input_tokens, output_tokens, cache_creation_input_tokens, and cache_read_input_tokens; naming differs slightly across providers but the semantics are similar.
50%