Preface¶
The core design philosophy of DeepSeek Harness is “Everything is a Plugin”. When using local large models, it is easy to incur unexpected costs if usage is not monitored. The dsh-token-usage plugin reads local session logs to provide a visualization statistics panel on the settings page, helping developers track token consumption across models and providers.
What is this¶
This is a DeepSeek Harness client plugin maintained by Gnatnaituy, released under the MIT License.
It does not rely on third-party billing interfaces but directly reads Harness’s own session logs. Once installed, it adds a new Token Usage page to the Settings, displaying total usage, a GitHub-style usage calendar, and per-model usage grouped by provider.
Core Features¶
The plugin primarily provides three types of data views:
-
Total Usage
- Aggregated tokens across all model providers and all models.
- Time dimensions: Today / Last 7 days / Last 30 days / All Time.
- Itemized statistics: Input, Output, Cache Read, Cache Write, Reasoning.
-
Usage Calendar
- A heatmap in the style of GitHub’s contribution graph, with one cell per day.
- Hover to view daily token details and request counts.
- Color scheme adapts to the current theme (dark/light auto-adaptation).
-
Model Usage Grouped by Provider
- One table per provider.
- Lists the usage and percentage for each model today, in the last 7 days, and in the last 30 days.
Installation and Activation¶
Install using the official installation script:
node tools/install-into-profile.mjs # Install
node tools/install-into-profile.mjs --dry-run # Preview what will be done
node tools/install-into-profile.mjs --uninstall # Uninstall
After running the script, wait a moment, refresh the browser page, and open Settings → Token Usage to view the data.
Typical Usage¶
- View Usage: After installation, refresh the page and enter the Token Usage section on the settings page to view summary data.
- Temporarily Disable: If you wish to disable the plugin without uninstalling it, add the following configuration to the profile’s
cordis.patch.ymlfile:
- id: token-usage
name: dsh-token-usage
disabled: true
Notes¶
- Data Permissions: The plugin only reads session logs in
<home>/sessionsand writes only to its own plugin directory; it never deletes or rewrites any user data. - Statistical Criteria: The aggregation criteria are consistent with DSH persistent logs. Only
assistant/messageevents where the provider reports usage are counted;assistant/attemptand retry events do not carry usage and are not double-counted. - Provider Display: When provider directory information is missing, the provider ID is displayed in a titleized format; records with unknown attribution are classified as “Unlabeled”.
- Development and Debugging: After modifying host semi-code such as
lib/index.js, you must restart DSH Desktop because module hot-reloading is disabled by default.
Summary¶
The dsh-token-usage plugin achieves non-intrusive usage statistics by reading local logs, making it suitable for developers who need fine-grained control over local model invocation costs. It does not perform calculations itself but reuses Harness’s routing and data sources, ensuring consistency in statistical criteria.