dsh-token-dog: DSH Local Token Usage Panel

dsh-token-dog is a DeepSeek Harness (DSH) client plugin developed by maintainer ccodeJava, adding a "Token Usage" panel to the Web GUI: it provides statistics on token consumption by session and by model, featuring a daily stacked bar chart and a calendar heatmap for the last 52 weeks. It does not maintain a separate ledger but directly reads Session logs from `ctx.sessionQuery`, so conversations prior to installation are also included in the statistics. The overview page consists of five sections: statistical cards, daily consumption charts, model usage and session rankings, and an active calendar. Clicking on a model row leads to a details page showing that model's daily curves and all sessions that consumed it. The top time interval switcher (7/30/90 days/All) applies simultaneously to the statistical cards, bar charts, rankings, and details pages. The color scheme offers 8 low-saturation preset colors and three levels of lightness (light/medium/dark), persisted to `localStorage`, with text following the host language. Since it is not published to npm, installation is performed by cloning the repository directory and loading it via the `plugin_manager` using the `link:` method via the Agent inside DSH, or via the command line `dsh plugin --profile desktop add link:/absolute/path/to/dsh-token-dog`. After installation, refresh the page and access it via the dog icon in the sidebar or Settings -> Token Usage. On the backend, only a read-only local loopback route `/token-dog/usage?tz=Asia/Shanghai` is registered. Data does not go over the network; requests with forwarded headers, cross-site, or non-loopback addresses return 403. The statistical methodology follows the principle that logs are the single source of truth: Total Tokens = Input + Cache Read + Cache Write + Output; Cache Hit Rate = Cache Read / (Cache Read + Input). Background calls that do not write logs, such as title generation and compression, are not counted. Discrepancies with billing figures are expected. The plugin runs with the permissions of the current DSH process; users should read the source code and confirm the MIT license before installation. The scan window covers sessions created or online within the last 400 days, capped at 600. For daily bar charts exceeding 120 days, only the last 120 days are drawn. Calendar heat intensity is graded by daily token quantiles. Data across different intervals is not directly comparable. Verified on DSH 0.2.1-rc.5 (Desktop, macOS) as noted in the README.

Read More