ai.events.Usage

class in the ai package.

Reference version

Signature

class ai.events.Usage

Source:<builtin>/ai/ns_events/events.bamlbytes 2698–3202

Fields

input_tokens

int

output_tokens

int

cached_input_tokens

int | null

reasoning_tokens

int | null

cache_write_input_tokens

int | null

Tokens written to the provider's prompt cache, billed above the input rate. Null when the provider reports none.

uncached_input_tokens

int | null

Input tokens billed at the full rate: input_tokens without cache reads and writes, whichever way the provider counts them. Null when the provider cannot tell.