Introduction¶
When using the DeepSeek API within DSH Web, checking the remaining balance, configuring low balance alerts, or opening the recharge portal typically requires extra steps. dsh-balance-display is a DSH client plugin that places the balance display at the bottom of the Web GUI sidebar and supports balance trends, low balance warnings, and one-click recharge.
What is This¶
dsh-balance-display is maintained by zhangjianyu1006156, licensed under MIT, and categorized as a client plugin. It targets the DSH Web scenario, displaying the remaining DeepSeek API balance at the bottom of the sidebar and providing a “Balance Display” configuration entry in the settings page.
Core Features¶
Balance Capsule¶
- Display balance at the bottom of the sidebar.
- Click to refresh.
- Display the recharge/gift split on hover.
Low Balance Warning¶
- When the balance falls below the threshold, the dot turns red and a hover warning is displayed.
- Configurable browser notifications; using browser notifications requires granting notification permissions.
- The default low balance warning threshold is
¥5.
Precision and Trends¶
- Display 4 decimal places when the balance is less than
¥1. - The settings page displays a sparkline trend chart and provides today/last 7 days consumption statistics.
- Balance history and preferences are stored in browser
localStoragewith the key prefixdsh.balanceDisplay.*; the host side does not perceive or store this data.
Recharge and Retry¶
- Both the capsule and settings page allow one-click access to
platform.deepseek.com/usage. - On consecutive failures, the refresh interval increments automatically.
- Pauses refreshing when switching tabs and refreshes immediately upon returning.
Themes and Collaboration¶
- Supports light, dark, and follow system.
- Chinese/English interface switches in real-time following dsh language settings.
- Can declare the plugin in system prompts for agents to remind users to recharge when the balance is too low.
Installation and Usage¶
The installation command is as follows:
dsh plugin --profile web add dsh-balance-display
For local development mode, you can use:
dsh plugin --profile web add link:/path/to/dsh-balance-display
Restart dsh web after installation. A balance capsule will appear at the bottom of the sidebar, and a “Balance Display” tab will appear in the settings page.
Typical Configuration¶
In the “Balance Display” tab of the settings page, you can configure:
- Sidebar display balance badge.
- Auto-refresh interval; default is 10 minutes.
- Low balance warning threshold; default is
¥5. - Browser notification when balance is insufficient.
- Agent collaboration, i.e., declaring the plugin in system prompts.
Security and Runtime Boundaries¶
- API keys are handled entirely on the host side; the browser side only fetches masked balance JSON from the local loopback route.
dsh webdefaults to binding only127.0.0.1, routes are only GET (balance) and GET/POST (announce config), without CORS headers.- The plugin runs with the permissions of the current
dshprocess; you should check the source code and license before installing. - Browser notifications require browser notification permission authorization.
Compatibility and Environment¶
- Compatible with the desktop packaged version (embedded dsh
rc.5) and the official website npm versiondsh web(rc.6). package.jsonrequiresnode >=22.19.
Testing¶
To test the host side, run:
node /tmp/test-balance-host.mjs
To test the client side, run:
node /tmp/test-balance-client3.mjs
Use Cases¶
Suitable for developers who frequently use the DeepSeek API via DSH Web and wish to view balance, configure low balance alerts, check recent consumption, and quickly jump to recharge without leaving the Web interface.
Links¶
Directory page: zhangjianyu1006156/dsh-balance-display