DeepSeek Harness (DSH)’s plugin ecosystem allows feature integration into the client sidebar. For developers who frequently call the DeepSeek API, real-time monitoring of account balances is crucial. dsh-deepseek-balance-badge aims to solve this by embedding balance information at the bottom of the DSH Web GUI sidebar.
This plugin is maintained by chenjingchun and is released under the MIT license. Its core value lies in integrating balance checks into the workflow while preserving security and configurability.
Core Functions¶
- Persistent Sidebar Badge: Displays the DeepSeek account balance at the bottom of the Web GUI sidebar. The badge supports a collapsed state (36px circle) and an expanded state (showing the balance value).
- Details Popover: Clicking the badge opens a details popover showing the total balance, granted balance, and topped-up balance. The popover includes a manual refresh button.
- Automatic Refresh and Settings: The plugin supports periodic automatic refreshes. The refresh interval (
pollSeconds) and the host cache window (cacheTtlSeconds) can be adjusted via the card under “Settings → Plugins → Plugin Configuration.” - Security Mechanism: The API key never enters the browser. The browser only accesses a same-origin host route, while the key remains in the host process. This avoids failures caused by direct browser calls when
api.deepseek.comdoes not return CORS headers. - Multi-currency Support: Supports displaying balances in different currencies on separate lines.
Installation and Activation¶
Install the plugin using the DSH CLI:
dsh plugin --profile web add dsh-deepseek-balance-badge
After installation, refresh the page. The host half must be restarted once after the first installation to take effect.
Configuration¶
Configuration consists of two layers:
- User Layer: Located under the
dsh-deepseek-balance:section in~/.dsh/settings.yaml. Users can modify it directly in “Settings → Plugins → Plugin Configuration” or edit the YAML file. - Composition Layer: Located in the
config:entry of this plugin within the profile’scordis.patch.yml. This is deployment configuration, including fields likeapiKeyRefandbaseUrlthat are not directly exposed to users.
When both layers define the same key, the user layer takes precedence. If configuration changes do not take effect, first check whether defaults have been overridden in the card.
# Profile's cordis.patch.yml (composition layer example)
- id: dsh-deepseek-balance
config:
pollSeconds: 300 # Automatic refresh interval (seconds)
apiKeyRef: DEEPSEEK_API_KEY
baseUrl: https://api.deepseek.com
cacheTtlSeconds: 10 # Host result cache window
The card only exposes pollSeconds and cacheTtlSeconds. No restart is required after configuration changes; the host re-parses immediately.
Usage¶
- View Balance: A balance badge persists at the bottom of the sidebar. Click to expand details.
- Manual Refresh: Click the “Refresh” button in the popover. This sends the
?force=1parameter to bypass host cache and force a pull of the latest data from upstream. - Adjust Interval: Modify the polling interval in “Settings → Plugins → Plugin Configuration”. The setting applies immediately to the next poll.
- Background Behavior: The plugin skips polling when the page is not visible to save power. When the page returns to the foreground and data is expired, it immediately fetches updates.
Behavior Details¶
- Single-flight Mechanism: Concurrent host polling shares a single upstream call to prevent refresh storms.
- Error Handling: On upstream errors, the plugin retains the last successful data and displays error codes and reasons in the popover without clearing the UI.
- UI Alignment: The badge is left-aligned, using a CSS technique to eliminate a 4px footer bleed so it shares the same left edge with the settings row below.
Development and Limitations¶
- Host Changes Require Restart: DSH does not support hot-loading of host-side code. Changes to
src/hostfiles require an application restart. - Client Build: The client bundle is hand-written and does not use a bundler.
- Dependency Management: Dependencies such as
node_modules/@deepseek-ai/*point to the DSH-installed junction and are for local testing only; they are not included in installed copies.
Directory and Source Code¶
This plugin is currently distributed only through the awesome-dsh-plugin curated list. To be listed in a built-in marketplace or store, a PR must be submitted to that list repository.
- Plugin Directory: https://www.skillhub.cn/plugins/chenjingchun/dsh-deepseek-balance-badge
- Source Repository: https://github.com/chenjingchun/dsh-deepseek-balance-badge