MentorTokenUsage class
The MentorTokenUsage class of Novior.MentorAgent.Core: Lightweight, thread-safe accumulator of LLM token usage (Wave 1 · #1). Registered as a singleton so…
On this page
Lightweight, thread-safe accumulator of LLM token usage (Wave 1 · #1). Registered as a singleton so usage is aggregated across the whole app lifetime. This is a developer/operator measurement aid — it is the instrument used to verify the token-reduction work; it is never surfaced to end users. A future admin dashboard (roadmap #9) can read these counters; full OpenTelemetry (roadmap #8) supersedes it for production observability.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Core. Package: Novior.MentorAgent.
public sealed class MentorTokenUsage
dotnet add package Novior.MentorAgentConstructors
Section titled “Constructors”public MentorTokenUsage()
Properties
Section titled “Properties”LastInputTokens
Section titled “LastInputTokens”public long LastInputTokens { get; }
Input tokens of the most recent recorded model call.
LastOutputTokens
Section titled “LastOutputTokens”public long LastOutputTokens { get; }
Output tokens of the most recent recorded model call.
RequestCount
Section titled “RequestCount”public long RequestCount { get; }
Number of model round-trips recorded.
TotalInputTokens
Section titled “TotalInputTokens”public long TotalInputTokens { get; }
Cumulative input (prompt) tokens since process start.
TotalOutputTokens
Section titled “TotalOutputTokens”public long TotalOutputTokens { get; }
Cumulative output (completion) tokens since process start.
TotalTokens
Section titled “TotalTokens”public long TotalTokens { get; }
Cumulative total tokens since process start.
Methods
Section titled “Methods”Record
Section titled “Record”public void Record(long inputTokens, long outputTokens)
Records one model round-trip's token usage.
public void Reset()
Resets all counters (e.g. when starting a fresh measurement run).
public void Seed(long totalInput, long totalOutput, long requestCount)
Seeds the cumulative totals from a persisted snapshot (roadmap #9 durable dashboard), so counts continue across a restart. Overwrites the running totals; "last call" fields are left at zero.
