TokenTracker class
Tracks token usage across requests and sessions.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- requestCount → int
-
Number of requests made.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalCompletionTokens → int
-
Total completion tokens used across all requests.
no setter
- totalCostUsd → double
-
Total estimated cost in USD.
no setter
- totalPromptTokens → int
-
Total prompt tokens used across all requests.
no setter
- totalTokens → int
-
Total tokens used (prompt + completion).
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
record(
AIUsage usage) → void - Records usage from a response.
-
reset(
) → void - Resets all tracked data.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited