Concepts
Usage convention
Token counts follow OTel GenAI and the AI SDK, and a missing count is absent, not 0.
Counts
Usage follows OTel GenAI and the AI SDK.
inputTokensincludes cache reads and writes.outputTokensincludes reasoning.- A count the log does not record is absent, not 0.
Absence and cost
The same absence rule shows up in price totals. A model without a price has no cost (undefined, not 0), and a summary's costUsd is absent when nothing in it was priced. See Cost.
Incremental scans
scanUsage with a kept state yields only what was written since. A caller that keeps a state also keeps its own totals beside it, uses one state per window with the same since, and runs its scans one at a time: two concurrent scans from one state both yield the new records. The scan itself is on Token usage.