Usage class final
Token accounting for one assistant response, reported inline by providers.
Ported from pi's Usage.
Constructors
Properties
- cacheRead → int
-
Tokens read from the prompt cache.
final
- cacheWrite → int
-
Tokens written to the prompt cache.
final
- cacheWrite1h → int?
-
Subset of cacheWrite written with 1h retention. Only Anthropic reports
this split.
final
- cost → UsageCost
-
Cost breakdown in USD.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- input → int
-
Input (prompt) tokens.
final
- output → int
-
Output (completion) tokens.
final
- reasoning → int?
-
Reasoning/thinking tokens, when the provider reports them. This is a
subset of output: output already includes these tokens. Set by
providers that expose a reasoning breakdown;
nullotherwise.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalTokens → int
-
Total tokens as reported by the provider.
final
Methods
-
copyWith(
{int? input, int? output, int? cacheRead, int? cacheWrite, int? cacheWrite1h, int? reasoning, int? totalTokens, UsageCost? cost}) → Usage -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Serializes to a JSON map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited