dsh-token-stats

Token usage dashboard for the whole harness: billed tokens from every session are rolled up per session and turn (uncached input, cache read, cache write and output) with a peak/off-peak CNY cost estimate, and a "Token 用量" entry above Settings in the sidebar opens the dashboard at /token-stats, in a new tab on the web and in an in-app popup on the Desktop. The page recollects and repaints every 60 seconds while the tab is visible. Usage is read from the same session event stream dsh-token-meter consumes, accepting 0.1.x assistant/chunk and 0.2.x assistant/message and assistant/attempt, and counting an attempt repeated after an llm retry as its own billed call; cold history is seeded once from a persisted rollup file and afterwards only logs whose mtime or size changed are re-parsed. Host half and client half ship in the one package.

Overview

Token usage dashboard for the whole harness: billed tokens from every session are rolled up per session and turn (uncached input, cache read, cache write and output) with a peak/off-peak CNY cost estimate, and a "Token 用量" entry above Settings in the sidebar opens the dashboard at /token-stats, in a new tab on the web and in an in-app popup on the Desktop. The page recollects and repaints every 60 seconds while the tab is visible. Usage is read from the same session event stream dsh-token-meter consumes, accepting 0.1.x assistant/chunk and 0.2.x assistant/message and assistant/attempt, and counting an attempt repeated after an llm retry as its own billed call; cold history is seeded once from a persisted rollup file and afterwards only logs whose mtime or size changed are re-parsed. Host half and client half ship in the one package.

Installation

Install from GitHub

dsh plugin --profile web add github:ShallBay/dsh-token-stats

Installing from GitHub runs the project's build script, which pnpm blocks until you allowlist it — run the command once and pnpm prints the exact key to add under `allowBuilds` in ~/.dsh/profiles/web/pnpm-workspace.yaml.

Version compatibility

Compatibility is unconfirmed. Check the project documentation for supported versions.

Installation notes

  • May run terminal commands