Preface¶
When running sessions in DeepSeek Harness (DSH), tokens are scattered across local session logs. While the official settings page displays the account balance, it is difficult to glance at the conversation interface and immediately correlate “how much was used today and roughly how much it cost.” Checking the platform usage page or digging through logs manually creates significant interruption costs.
Below is an introduction to the community plugin dsh-usage-widget (maintainer ZeroOT-Liu): It centrally displays the balance, today’s and this month’s token consumption, and estimated costs based on the price list in the bottom left of the desktop sidebar (above Settings). The plugin belongs to the “Client” category and currently has 1 GitHub star; links to the repository and directory page are at the end of the article.
What is this¶
dsh-usage-widget is a zero-dependency plugin for DSH (MIT, package version 1.3.0). The host side registers a summary API and performs trust validation, while the client side renders the widget in the footer via sidebar.footer.action; it does not touch account credentials. The balance is fetched via the official account service ctx.deepseekAccount.getBalance, originating from the same source as “Settings → Account”.
Usage and cost data comes from assistant/message events containing data.usage found in local $DSH_HOME/sessions/**/session.*.jsonl.zstd files; costs are calculated based on the price list and peak/off-peak time rules in cordis.patch.yml and are not official billing.
Core Functions¶
Collapse and Expand¶
When collapsed, it defaults to three lines: Balance, Today, and Month. The first line example format is Balance ¥5.83 · Bonus ¥9.56 (recharge in primary color, bonus in muted color). The second line starts with a time period badge (Peak ×2 or Off-peak). When the sidebar collapses to a 56px narrow bar, only icons are shown, with full values available in the hover tooltip.
Hovering or clicking expands the view: Balance, Current Period (including countdown to switch), Today’s Details (input cache hit/miss, output, reasoning tokens) grouped by model, Monthly Totals, Current Session Details, Update time, and a Refresh button.
Monthly and Time-based Pricing¶
Monthly totals include tokens, cost, request count, active days, and session count. Peak hours are Beijing time Monday to Friday, 9:00–12:00 and 14:00–18:00, with unit prices calculated according to the configured peakMultiplier (default 2); all other times (including weekends) are charged at off-peak rates. China public holidays are not included in the rules and are charged at peak rates.
Data and Performance¶
Session logs are multi-frame Zstandard containers; the plugin reads incrementally by frame boundaries, skipping incomplete tail frames to avoid double counting. The README records: On a local machine with 15 session files and approx. 20,000 lines, the first scan takes about 0.3 seconds, and subsequent reads are incremental only.
Models without configured unit prices will still have tokens counted but are not included in the cost; the expanded panel will note “Price not configured, cost not counted”.
Installation and Activation¶
Installation from GitHub Release is recommended (no need to clone the repository):
dsh plugin --profile desktop add "https://github.com/ZeroOT-Liu/dsh-usage-widget/releases/latest/download/dsh-usage-widget.tgz"
Or install from the repository:
dsh plugin --profile desktop add "github:ZeroOT-Liu/dsh-usage-widget"
Both methods write dsh-usage-widget into the profile’s dsh.profile.bundles (~/.dsh/profiles/<profile>/package.json), making it effective for all sessions in that profile and persistent across restarts. Once installed, refresh the page (Ctrl+R) to allow the browser to load the new module manifest.
Uninstall:
dsh plugin --profile desktop remove dsh-usage-widget
If UNABLE_TO_VERIFY_LEAF_SIGNATURE / fetch failed occurs during installation (common with TLS interception proxies), you can allow Node to use the system certificate store:
NODE_OPTIONS="--use-system-ca" dsh plugin --profile desktop add "https://github.com/ZeroOT-Liu/dsh-usage-widget/releases/latest/download/dsh-usage-widget.tgz"
Configuration Points¶
Configuration is written in the same lines as cordis.patch.yml; price units are “Yuan / Million tokens”. Enter the off-peak price; peak prices are calculated by the peakMultiplier.
| Field | Default | Description |
|---|---|---|
currency |
CNY |
Currency for cost display |
refreshSeconds |
30 |
Widget polling interval |
balanceRefreshSeconds |
180 |
Balance cache duration |
peakMultiplier |
2 |
Peak unit price multiplier |
keepDays |
45 |
Log aggregation retention days |
sessionsDir |
Auto | Default $DSH_HOME/sessions, falls back to ~/.dsh/sessions |
showMonth |
true |
Whether to show “Month” line in collapsed state |
showWindow |
true |
Whether to show time period badge and panel period line |
models |
DeepSeek Official Prices | Model → { cacheHit, cacheMiss, output } |
aliases |
See file | Map historical/dated model names to pricing keys |
allowHosts |
[] |
Hostnames allowed to access summary route besides loopback |
If official prices change, you need to update models manually; otherwise, costs will differ from platform billing.
Typical Usage¶
- Install via the commands above in the
desktopprofile and refresh the page. - After logging into the DeepSeek account, the first line of the footer shows the balance; if not logged in, the balance shows “Not Logged In”, but usage and costs are still tracked.
- For daily conversation, the three collapsed lines are sufficient; expand the panel when you need to verify model breakdowns or the current session, or click refresh to immediately re-read logs.
- If the profile does not bundle the official account plugin (
@deepseek-ai/dsh-deepseek-account-platform), the balance area shows “Account Service Unavailable”, but usage and costs function normally.
For local development, you can use link: to point to the working directory. Changes take effect after a page refresh without reinstalling:
dsh plugin --profile desktop add "link:/absolute/path/to/dsh-usage-widget"
Use Cases and Notes¶
Who it is for: Developers who run sessions in DSH Desktop long-term and want to real-time compare balance and today/month usage in the sidebar.
Environment: DeepSeek Harness Desktop version (desktop profile, verified in README at 0.2.0-rc.2). Can also be installed in web profile, provided the official account plugin is bundled. Host requires Node ≥ 22.15 (DSH runtime is Node 24). The widget relies on the profile’s sessions and uiSession to determine the current session.
Security: The summary route /api/dsh-usage-widget/summary validates Host (loopback and allowHosts) itself, rejects cross-site Origins, and allows only GET/HEAD. The plugin runs with the permissions of the current dsh process; it is recommended to read the source code and MIT license before installing.
Known Limitations:
- Costs are reference values calculated from the price list; the platform usage page takes precedence.
- “Today” is divided by the host machine’s local timezone.
- Logs are written in batches, so the display may lag by one batch (usually a few seconds); clicking refresh forces an immediate re-read.
- If
keepDaysis less than 32, early month data may be cleaned up, and the panel will prompt that early data for this month may be incomplete.
Conclusion¶
dsh-usage-widget aggregates account balance and local session logs into the sidebar footer, reducing the need to switch back and forth between settings, logs, and the platform. The DeepSeek Harness ecosystem emphasizes “Everything is a plugin”; the community directory is an independent site and has no official affiliation with DeepSeek or High-Flyer.
- Directory Page: https://www.skillhub.cn/plugins/ZeroOT-Liu/dsh-usage-widget
- GitHub: https://github.com/ZeroOT-Liu/dsh-usage-widget