Introduction¶
When developing agents in DSH Web, a single task may trigger multiple LLM calls. If you need to monitor token usage, individually browsing request records is inconvenient, and comparing by API, model, and date is difficult.
zerro-223/dsh-token-usage is a DeepSeek Harness Web UI plugin designed to capture the usage of every LLM call, opening a statistical panel in the sidebar that displays Token consumption, estimated costs, trend charts, and daily usage heatmaps.
What is this¶
dsh-token-usage is a Token usage statistics plugin for DeepSeek Harness Web UI. It is maintained by zerro-223, has the npm package name @zerro223/dsh-token-usage, version 1.1.1, and license MIT.
The plugin captures usage for every LLM call in llm/stream and displays statistics and charts by API (provider), model, and date.
Core Features¶
The plugin adds a “Token Usage” entry at the bottom of the DeepSeek Harness Web UI sidebar, opening the statistical panel. Main capabilities include:
- Display Token consumption by API (provider), model, and date.
- Monitor
llm/streamwaterfall events, capturing the usage chunk of every model call, including input, output, cache read, cache write, and reasoning tokens. - Persist to
~/.dsh/storages/token-stats/usage.jsonl. - Display statistical cards for Total Tokens, Request Count, Input, Output, Total Cache Hit Rate, and Estimated Cost.
- Estimate costs based on model unit prices, automatically sync from
modelradar.cn, and support manual overrides. - Provide double-axis trend charts for input, output, cache hits, and costs.
- Provide a daily usage heatmap for the past year.
- Provide a model summary table, API/Model filtering, and the last 30 requests.
- Support exporting to JSONL, JSON, and CSV, and clearing all history.
- Auto-refresh every 15 seconds; pause background polling when the tab is hidden.
- Adapt to dark/light themes.
Installation and Usage¶
Environment Requirements¶
The plugin requires Node >=18 and declares the following peer dependencies:
{
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@deepseek-ai/cordis": "^4.0.1",
"@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6",
"react": "^18.0.0"
}
}
npm Installation (Recommended)¶
First, install the plugin:
dsh plugin --profile web add @zerro223/dsh-token-usage
After installation, restart DSH Web, then open the “Token Usage” entry at the bottom of the DSH Web UI sidebar.
Local Source Installation¶
If installing from local source code, perform these two steps first:
- Copy the
@zerro223/dsh-token-usagepackage directory to the profile’snode_modules. - Append the
token-usageentry to the profile’scordis.patch.yml:
token-usage
After completion, restart DSH Web.
Local Directory / Git Repository Installation¶
You can also install directly from a local directory or a GitHub repository:
dsh plugin --profile web add file:D:/path/to/dsh-token-usage
Or:
dsh plugin --profile web add github:zerro-223/dsh-token-usage
Typical Usage¶
First, restart DSH Web, open the “Token Usage” entry at the bottom of the sidebar, and then follow the steps below.
- Switch API, model, and date range in the panel to view statistical cards and charts.
- When saving data is needed, use the export menu to export JSONL, JSON, or CSV; if historical data is no longer needed, you can execute Clear All History.
- Read aggregated data via the API:
/token-stats/api/overview
/token-stats/api/heatmap
/token-stats/api/overview returns series, totals, cacheHitRate, filterOptions; /token-stats/api/heatmap returns heatmap data.
The complete list of interfaces is as follows:
/token-stats/api/overview
/token-stats/api/heatmap
/token-stats/api/export
/token-stats/api/clear
Data Storage and Limitations¶
The data file is located at:
~/.dsh/storages/token-stats/usage.jsonl
Storage behavior is as follows:
- Memory retains the last 500,000 records.
- When the file exceeds 128MB, it is automatically compressed, retaining the last 500,000 records.
- Multiple profiles share the same storage file; during compression, the latest records are merged.
- The plugin depends on the
webServerservice; recording and statistics are only activated in profiles that have a web service (e.g.,web). - Retry/duplicate requests are recorded for every actual call reaching the provider.
- Uninstalling the plugin will not delete historical data; re-enabling it can resume statistics, except for Clear All History.
Pricing and Cost Estimation¶
The plugin estimates costs based on model unit prices. Prices are automatically synced from modelradar.cn; models from CNY sources will be marked “Auto·Source CNY”. Manual prices take precedence over automatic prices.
Security and Applicable Scenarios¶
DSH’s philosophy is “Everything is a plugin”. The community directory is an independent site with no official affiliation to DeepSeek/FH, so do not treat it as an official app store.
This plugin runs with the permissions of the current dsh process. You should check the source code and license before installing. The license is MIT, and the source code repository can be found via the GitHub link.
Suitable for the following scenarios:
- Developers who need to view token usage for every LLM call in DSH Web UI.
- Users who need to compare call volume and estimated costs by API (provider), model, and date.
- Users who need to export JSONL, JSON, CSV, or retain usage history long-term.
Conclusion¶
The value of dsh-token-usage lies in aggregating scattered usage chunks from llm/stream into a statistical panel viewable by API, model, and date, while supporting export and cost estimation.
GitHub:
https://github.com/zerro-223/dsh-token-usage
Since the verified materials did not provide a directory page address, this article does not list a directory page link.