Introduction¶
When working with DeepSeek Harness (DSH), you often need to quickly check your account balance and today’s token usage. Frequently switching to “Settings → Account & Balance” or opening a browser to view the official usage page can interrupt your workflow. The plugin described below provides a persistent entry point at the bottom of the sidebar, keeping balance and usage metrics right at your fingertips and reducing unnecessary navigation.
Plugin Purpose¶
kasshuang/dsh-plugin-balance-usage is a DSH sidebar plugin that adds an entry at the bottom of the left sidebar, displaying your account balance and today’s token usage. Expanding the panel reveals cumulative usage, a 14-day trend, grouping and collapsibility by provider/model, a “primary” setting, and in-app access to the official usage page.
Core Features¶
Persistent Sidebar Entry¶
- Wide bar shows “balance + today’s usage”; collapsed narrow rail shows an icon + status dot
- Auto-refresh: every 30 seconds when closed, every 15 seconds when open; instantly refreshes when the window returns to the foreground — no manual click needed
Account Balance¶
- Sourced from the DeepSeek platform account API (same source as “Settings → Account & Balance”)
- Distinguishes between purchased balance and gifted balance
Token Usage¶
- Reads local session logs (
~/.dsh/sessions/**/session.v4.jsonl.zstd) to aggregate today’s / cumulative / input / output / cache-read tokens and a 14-day bar chart
Multi-Provider / Multi-Model¶
- Grouped by
provider → model, collapsible - Click the star icon to set a model as the “primary” one; the sidebar numbers follow the primary (defaults to the most recently used model if not set)
Official Usage Details¶
- Desktop: opens the official
platform.deepseek.com/usagepage in a tab within the main content area, reusing the host’s injected session state — no re-login required, no browser redirect - Web: falls back to opening in a new tab
Theme & Language¶
- Follows the active theme and language, using
--dsw-alias-*theme variables - Supports light / dark / system-follow modes
- UI text switches between English and Chinese with the interface language; includes keyboard accessibility (Esc to close, focus returns to the entry, Tab cycling)
Installation & Activation¶
In DSH, go to “Plugins → Add Plugin → Install npm package” and enter:
dsh-plugin-balance-usage
After installation, the entry appears immediately at the bottom of the sidebar (client-side plugins are hot-loaded; refresh the page if necessary).
If DSH has already added an index source, you can install directly from “Plugins → Discover”:
https://cdn.jsdelivr.net/gh/kasshuang/dsh-plugin-balance-usage@main/market/index.json
Typical Usage¶
- After installing the plugin, a balance and usage entry appears at the bottom of the left sidebar.
- Click the entry to view your balance (distinguishing purchased vs. gifted) and today’s token usage.
- Open the panel to see cumulative usage, input/output/cache-read breakdowns, and the 14-day trend.
- In multi-model scenarios, group and collapse by
provider → model, click the star to set the “primary,” and the sidebar numbers will follow it. - Click the button at the bottom of the panel to open the official usage page — in-app on desktop, in a new tab on web.
Use Cases & Notes¶
- Ideal for DSH users who need to continuously monitor their DeepSeek account balance and token usage.
- Usage statistics are based on local session logs and may differ from platform billing (the platform counts all client and API calls).
- Historical usage depends on local session logs; switching machines or cleaning
~/.dsh/sessionswill reset statistics to zero. - The in-app usage page is only available on the desktop version (browsers lack the
dshPlatformbridge, so it falls back to an external link). - The plugin runs with the current DSH process permissions — review the source code and license before installing.
Conclusion¶
This plugin uses a persistent sidebar entry and an expandable panel to keep balance and usage metrics at a glance, reducing the need to switch between settings and a browser. Directory page and source code:
- Directory page: https://www.skillhub.cn/plugins/kasshuang/dsh-plugin-balance-usage
- GitHub: https://github.com/kasshuang/dsh-plugin-balance-usage