Usage class tracks token consumption for AI requests.
Definition
Fields
Input tokens explicitly reported as cache misses. This is not inferred for providers that do not report it.
Usage
From generate_text
From stream_text
Multi-Step Usage
When using tools,result.usage contains the final model step’s usage.
Each model call’s usage is available on its corresponding step: