# ctx.tokenMeter `TokenMeterService` — provided by `@deepseek-ai/dsh-token-meter`. Replay owner for one service-wide estimator and isolated per-session folds. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/llm/token-meter/src/index.ts#L106) ### ctx.tokenMeter.contextWindow ```ts website-api readonly contextWindow: number ``` Provider context-window capacity used by pressure consumers. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/llm/token-meter/src/index.ts#L112) ### ctx.tokenMeter.measure(session, requestHeader?) ```ts website-api measure(session: Session, requestHeader?: EpochHeader): TokenMeasurement ``` Measure current request pressure and surface through the durable tail. Provider usage is reused only when the latest successful call's canonical request envelope matches `requestHeader` and its total is no lower than that call's full heuristic anchor; otherwise the complete envelope and surface are heuristically repriced. `requestHeader` affects request pressure only; surface fields always describe the current session surface. Every call clones those positional nodes, so measurement is O(surface). - `session` — session to replay through its current durable tail. - `requestHeader` — optional effective request envelope replacing the latest logged header. **Returns** a detached deeply immutable pressure and surface measurement. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/llm/token-meter/src/index.ts#L143) ### ctx.tokenMeter.estimateMessage(message) ```ts website-api estimateMessage(message: Message): number ``` Heuristically price one model-visible message. - `message` — message to price without mutation. **Returns** content and role-framing tokens under the fixed service heuristic. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/llm/token-meter/src/index.ts#L181)