---
url: >-
  https://adk.nht.io/api/@nhtio/adk/dispatch_runner/interfaces/GenerationStats.md
description: >-
  Provider-agnostic generation accounting for a single completed generation,
  emitted via [`DispatchExecutorHelpers.reportGenerationStats`](https://adk.nht.io/api/@nhtio/adk/dispatch_runner/interfaces/DispatchExecutorHelpers#reportgenerationstats).
---

# Interface: GenerationStats

Defined in: [lib/types/dispatch\_runner.ts:250](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L250)

Provider-agnostic generation accounting for a single completed generation, emitted via
[DispatchExecutorHelpers.reportGenerationStats](DispatchExecutorHelpers.md#reportgenerationstats).

## Remarks

Every field is optional so each battery supplies only what its wire format reports — OpenAI
Chat Completions surfaces token counts (its `usage` block) but no wall-clock durations; Ollama's
native `/api/chat` surfaces both token counts and nanosecond durations on its terminal chunk.

Durations are carried in their **native nanosecond** unit (the `Ns` suffix is load-bearing) and
are never normalised here — normalising to milliseconds would be lossy and providers without
durations would gain meaningless zeros. `raw` preserves the full provider-native stats object
verbatim for forward-compatibility, so a subscriber can read a field this shape has not yet
promoted to a typed member.

## Extended by

* [`GenerationStatsEvent`](GenerationStatsEvent.md)

## Properties

| Property                                                           | Type                                                                                                               | Description                                                                                | Defined in                                                                                                                |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
|  `completionTokens?`         | `number`                                                                                                           | Tokens in the completion / output (OpenAI `usage.completion_tokens`, Ollama `eval_count`). | [lib/types/dispatch\_runner.ts:254](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L254) |
|  `evalDurationNs?`             | `number`                                                                                                           | Time spent generating the response in nanoseconds (Ollama `eval_duration`).                | [lib/types/dispatch\_runner.ts:264](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L264) |
|  `finishReason?`                 | `string`                                                                                                           | Why generation stopped (Ollama `done_reason`, OpenAI `finish_reason`).                     | [lib/types/dispatch\_runner.ts:266](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L266) |
|  `loadDurationNs?`             | `number`                                                                                                           | Time spent loading the model in nanoseconds (Ollama `load_duration`).                      | [lib/types/dispatch\_runner.ts:260](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L260) |
|  `model?`                               | `string`                                                                                                           | Model identifier the provider echoed back.                                                 | [lib/types/dispatch\_runner.ts:268](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L268) |
|  `promptEvalDurationNs?` | `number`                                                                                                           | Time spent evaluating the prompt in nanoseconds (Ollama `prompt_eval_duration`).           | [lib/types/dispatch\_runner.ts:262](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L262) |
|  `promptTokens?`                 | `number`                                                                                                           | Tokens in the prompt / input (OpenAI `usage.prompt_tokens`, Ollama `prompt_eval_count`).   | [lib/types/dispatch\_runner.ts:252](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L252) |
|  `provider?`                         | `string`                                                                                                           | Stable provider discriminator (e.g. `'ollama'`, `'openai_chat_completions'`).              | [lib/types/dispatch\_runner.ts:270](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L270) |
|  `raw?`                                   | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)<`string`, `unknown`> | Full provider-native stats object, verbatim, for forward-compatibility.                    | [lib/types/dispatch\_runner.ts:272](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L272) |
|  `totalDurationNs?`           | `number`                                                                                                           | Total wall-clock generation time in nanoseconds (Ollama `total_duration`).                 | [lib/types/dispatch\_runner.ts:258](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L258) |
|  `totalTokens?`                   | `number`                                                                                                           | Total tokens, when the provider reports a combined figure.                                 | [lib/types/dispatch\_runner.ts:256](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/lib/types/dispatch_runner.ts#L256) |
