DSH users often mount two accounts at the same time: one is the official DeepSeek account (billed by DeepSeek), and the other is a WorkBuddy account connected through dsh-workbuddy-connect (charged against App credits). The balances for the two accounts are located on different settings pages, so it is easy to discover only midway through a task that one side has insufficient balance.
dsh-dual-balance pins these two numbers at the bottom of the DSH sidebar and automatically refreshes them every 60 seconds, so you do not have to switch back and forth between two interfaces.
Plugin Introduction¶
Name: dsh-dual-balance
Maintainer: du460138504
Function: Displays both the official DeepSeek balance and WorkBuddy credits at the bottom of the DSH sidebar. It addresses the problem of insufficient balance monitoring when multiple accounts are used in parallel and balances are scattered across different accounts.
Core Features¶
- Dual-balance side-by-side display: The left side shows the official DeepSeek balance (with a split view when gift credits are included), and the right side shows the remaining WorkBuddy credits.
- Language follows settings: The interface text automatically switches between English and Chinese based on the DSH language setting.
- Hover to view details: Hovering over a balance block displays the full breakdown of top-ups/gift credits, the source of WorkBuddy credits, and other details.
- Graceful degradation: If WorkBuddy is not installed, not logged in, or the API call fails, the corresponding line shows “Not signed in” or “—”. The normal display of the other balance is not affected, and DSH does not fail to start.
- Official-format alignment: Amount display strictly follows the official rules, using two-decimal truncation instead of rounding.
Installation and Enablement¶
Before installing, ensure DeepSeek Harness is installed. It can still be used without installing dsh-workbuddy-connect, in which case only the DeepSeek balance is shown and the WorkBuddy line shows “—”.
Desktop profile:
dsh plugin --profile desktop add dsh-dual-balance
Web profile:
dsh plugin --profile web add dsh-dual-balance
You can also install directly from the GitHub source:
dsh plugin --profile desktop add git+https://github.com/du460138504/dsh-dual-balance.git
After installation, restart DSH, and the two balance lines will appear at the bottom of the sidebar.
Initial installation error
allowBuilds: If the error mentionsallowBuilds, edit thepnpm-workspace.yamlfile under the profile directory, add the corresponding configuration, and rerun the installation command.
Formatting Details¶
The plugin’s amount formatting is not a simple toFixed(2) call; it deliberately mimics the official rules:
- DeepSeek balance: Displayed with official two-decimal truncation (
roundDown). For example, a balance of0.148is displayed as0.14on the official page, and this plugin also displays¥0.14. Balances below one cent are displayed as<¥0.01, avoiding the misreading of¥0.00as fully consumed. - WorkBuddy credits: Also truncated to two decimals. Because the upstream data is already reported with two decimals, any extra digits are binary floating-point noise, so only truncation is used, never rounding, to avoid displaying credits that have not yet been issued.
Both use decimal string arithmetic to avoid binary floating-point rounding errors.
How It Works and Privacy¶
- Data sources:
- DeepSeek balance: Read through DSH’s
remote.account.getBalance, reusing the user’s already logged-in account; the plugin itself does not touch credentials. - WorkBuddy credits: Sends a
fetchrequest to the same-origin/plugins/dsh-workbuddy-connect/statusroute and readscredits.totalfrom the response.
- DeepSeek balance: Read through DSH’s
- Privacy and security: The plugin does not send telemetry, does not write files, and does not access any network addresses other than the two same-origin endpoints described above. The two numbers only flow between the local machine and DSH itself.
Development and Compatibility¶
- Build method: A pure ESM project with no build step.
lib/index.js(host) andlib/client.js(browser) are used directly as artifacts. - Development and debugging: Link a working copy into the profile:
dsh plugin --profile desktop add link:/绝对路径/dsh-dual-balance
Reload DSH for it to take effect.
- Dependency requirement: Requires DSH core 0.2.0-rc.2.
- Development note:
lib/client.jsmust preserve the outer protocolwindow.__ModuleLoader__.load({ id, factory }), which is the loading contract for DSH client modules.
Uninstall¶
dsh plugin --profile desktop remove dsh-dual-balance