Preface¶
The plugin philosophy of DSH is “everything is a plugin.” If you want to directly view the daily token usage and further check usage over the past 7 days, 30 days, the 30-day model stacked chart, model rankings, and session statistics during your daily use or debugging of DeepSeek Harness (DSH), you can use zhangzheng25/dsh-token-monitor.
This article will introduce its positioning, core features, installation, and usage.
What is This¶
zhangzheng25/dsh-token-monitor is a DeepSeek Harness plugin maintained by zhangzheng25, licensed under MIT.
It places a “Daily Usage” card at the bottom of the DSH sidebar (next to the settings icon), displaying the total tokens used today. Clicking the card opens a statistics window showing token usage for today / the past 7 days / the past 30 days, a 30-day model stacked usage chart, model usage rankings, and session statistics.
Core Features¶
- The sidebar “Daily Usage” card displays the total tokens used today in real-time, and clicking it opens a full statistics window.
- Tracks total token usage for today / the past 7 days / the past 30 days.
- Displays a 30-day model stacked usage chart.
- Shows model usage rankings, fixed to a 30-day window.
- Counts top-level conversations for today / the past 7 days / the past 30 days, with subtext showing the number of model requests for the corresponding period.
- Automatically polls and refreshes every 30 seconds, supports idempotent re-scanning, and allows manual clicks on “Refresh” and “Backfill History.”
- Data is persisted to
$DSH_HOME/plugins/token-monitor/data.json, bucketed by day and model, retained for 181 days. - Historical usage is backfilled idempotently through session logs, allowing statistics from before the plugin was installed, with repeated runs not causing duplicate counts.
Installation and Activation¶
The plugin requires Node.js >=20. Before installation, it is recommended to review the source code, license, and AI-assisted generation disclaimer on the GitHub repository.
Install from the repository:
dsh plugin --profile web add github:zhangzheng25/dsh-token-monitor
Install from a local directory. The following command uses an example path from the README; replace it with the actual path:
dsh plugin --profile web add E:\path\to\dsh-token-monitor
After installation, DSH needs to be restarted. Upon startup, a “Daily Usage” card will appear at the bottom of the sidebar (next to the settings icon).
Typical Usage¶
After installing and restarting DSH:
- View the “Daily Usage” card at the bottom of the sidebar (next to the settings icon).
- Click the card to open the statistics window.
- In the window, view token usage for today, the past 7 days, and the past 30 days, the 30-day model stacked chart, model usage rankings, and session statistics.
- If data is not updated, click “Refresh.”
- To include usage statistics from before the plugin was installed, click “Backfill History.”
The statistics window supports closing with Esc, ✕, or clicking the mask, and locks background scrolling when open.
If you only need to perform syntax checks, you can run:
node --check src/index.js && node --check client/bundle.js
Data and Limitations¶
- Session logs are the only data source.
sessionQueryis live-preferred, capable of reading both active in-memory sessions and logged data.- Session counts only include top-level sessions (i.e.,
delegationDepth === 0), excluding internal sessions of sub-agents. - Data is persisted to
$DSH_HOME/plugins/token-monitor/data.json. - Data is bucketed by day and model, retained for 181 days.
- Backfilling history is an idempotent re-scan; repeated runs do not cause duplicate counts, and dirty data in old buckets auto-heals.
- The page polls and refreshes every 30 seconds.
Suitable Scenarios and Notes¶
This plugin is suitable for users who need to view DSH’s daily token usage, the 30-day model distribution, and session statistics. It is also useful for checking the plugin’s provided statistics window when inspecting DSH plugin behavior locally.
Usage Notes:
- The plugin runs with the current
dshprocess permissions; review the source code and license before installation. - The project license is MIT.
- The project README states: This project is generated with AI assistance, for learning and technical exchange only, and does not constitute any form of commercial guarantee or support commitment.
- DSH must be restarted after installation.
client/bundle.jsis a handcrafted web bundle, requiring no build steps.
References¶
- GitHub:
https://github.com/zhangzheng25/dsh-token-monitor - Directory Page Clue (not verified in the materials provided):
https://www.skillhub.cn/plugins/zhangzheng25/dsh-token-monitor