TokenUsage class

Token usage statistics for an API call.

Constructors

TokenUsage({required int inputTokens, required int outputTokens, int? cacheCreationInputTokens, int? cacheReadInputTokens})
const
TokenUsage.fromJson(Map<String, dynamic> json)
Deserialize from an API JSON response.
factory

Properties

cacheCreationInputTokens → int?
Tokens used to create a new cache entry (Anthropic prompt caching).
final
cacheReadInputTokens → int?
Tokens read from an existing cache entry (Anthropic prompt caching).
final
hashCode → int
The hash code for this object.
no setterinherited
inputTokens → int
Number of input tokens consumed.
final
outputTokens → int
Number of output tokens generated.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalTokens → int
Total tokens (input + output).
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited