# 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…

- URL: https://docs.mentoragent.net/api/novior-mentoragent-core/mentortokenusage
- Verified with: MentorAgent 1.2.0
- Last updated: 2026-10-27
- Packages: Novior.MentorAgent

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

Namespace: `Novior.MentorAgent.Core`. Package: `Novior.MentorAgent`.

`public sealed class MentorTokenUsage`

```shell
dotnet add package Novior.MentorAgent
```

## Constructors

`public MentorTokenUsage()`

## Properties

### `LastInputTokens`

`public long LastInputTokens { get; }`

Input tokens of the most recent recorded model call.

### `LastOutputTokens`

`public long LastOutputTokens { get; }`

Output tokens of the most recent recorded model call.

### `RequestCount`

`public long RequestCount { get; }`

Number of model round-trips recorded.

### `TotalInputTokens`

`public long TotalInputTokens { get; }`

Cumulative input (prompt) tokens since process start.

### `TotalOutputTokens`

`public long TotalOutputTokens { get; }`

Cumulative output (completion) tokens since process start.

### `TotalTokens`

`public long TotalTokens { get; }`

Cumulative total tokens since process start.

## Methods

### `Record`

`public void Record(long inputTokens, long outputTokens)`

Records one model round-trip's token usage.

### `Reset`

`public void Reset()`

Resets all counters (e.g. when starting a fresh measurement run).

### `Seed`

`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.

---

- Previous: [MentorStructuredService class](https://docs.mentoragent.net/api/novior-mentoragent-core/mentorstructuredservice.md)
- Next: [NullMetricsStore class](https://docs.mentoragent.net/api/novior-mentoragent-core/nullmetricsstore.md)
