pub struct Usage {
pub prompt_tokens: u64,
pub completion_tokens: u64,
pub cached_read_tokens: u64,
pub cache_write_tokens: u64,
pub reasoning_tokens: Option<u64>,
}Fields§
§prompt_tokens: u64Cache-INCLUSIVE prompt count (OpenAI convention): fresh + cached_read +
cache_write. Translators normalize to this at the boundary so
fresh = prompt_tokens - cached_read - cache_write holds uniformly
(billing and rate-limit math rely on it). Anthropic’s wire reports
input_tokens cache-exclusive — both Anthropic translators add the
cache classes in, and the Anthropic client surface subtracts them back.
completion_tokens: u64§cached_read_tokens: u64Provider-side prompt-cache reads (tokens reused from KV cache)
cache_write_tokens: u64Tokens written to the prompt cache this turn (Anthropic cache_creation, which bills above the plain input rate)
reasoning_tokens: Option<u64>Reasoning/CoT tokens inside completion_tokens, when the provider
reports them (OpenAI completion_tokens_details.reasoning_tokens,
Responses output_tokens_details, Gemini thoughtsTokenCount).