Introduction¶
When using the DSH (DeepSeek Harness) Web GUI to interface with multiple model service providers, checking the balance is a frequent yet tedious task: logging into each provider’s console or manually invoking the balance API. With multiple accounts, this action must be repeated several times a day.
The dsh-balance introduced below consolidates this into the Web GUI: it places a draggable floating balance card in the bottom-right corner of the page, auto-refreshes every 60 seconds, supports the balance APIs of DeepSeek, SiliconFlow, Moonshot, and OpenRouter, and includes a master toggle in the plugin settings page.
What is this¶
dsh-balance is a client-side plugin for the DeepSeek Harness Web GUI (dsh-web-ui plugin ecosystem), located at the repository path Mystery-God/dsh-balance with an MIT license. The package.json reveals the package name as @linxin666/dsh-balance and version 0.1.2 (the package name differs from the repository owner; ownership is determined by the repository path), requires node ^22.19.0 || >=24.0.0, and has react ^18.2.0 as a peerDependency.
It solves a very specific problem: displaying the model account balance permanently in the Web GUI, while not exposing the API key to the browser.
Core Features¶
Floating Card¶
The floating card appears in the bottom-right corner of the page and is draggable. The content is divided into three sections:
- Total balance, displayed in large text;
- Recharge / Gift details and the update time;
- Three operation buttons:
⟳Manual Refresh,–Collapse to a small capsule,×Close. After closing, a¥capsule remains, ready to be recalled at any time.
Refresh & Cache¶
The plugin queries the balance automatically every 60 seconds. Query results are cached for 30 seconds on the host side to avoid frequent calls to provider APIs. If you need to see the latest value immediately, use the ⟳ on the card to manually refresh.
Master Toggle¶
There is a “Show Balance Float” master toggle in “Settings → Plugins → Model Balance Float”. Settings are persisted to ~/.dsh/balance/settings.json. The settings page and the floating window share the same in-memory store, so the toggle takes effect immediately without needing to restart.
Key Security¶
All balance queries are performed via fetch on the host side. There are two ways to provide the API key:
- Enter directly in the settings page and store it locally in
~/.dsh/balance/settings.json; the interface only returns a masked preview. - Parsed by the credentials service with the lookup order: Environment Variables →
~/.dsh/.credentials.yaml→.env.
In both cases, the key is never sent to the browser.
Multiple Service Providers¶
The plugin automatically identifies the provider based on the configured baseURL domain. The balance endpoints for each provider are as follows:
| Provider | Endpoint Path |
|---|---|
| DeepSeek | /user/balance |
| SiliconFlow | /v1/user/info |
| Moonshot | /v1/users/me/balance |
| OpenRouter | /api/v1/credits |
Requests to other domain names will explicitly indicate that they are not supported, without attempting guesswork compatibility.
Implementation & Security Fences¶
The plugin has zero runtime dependencies: the host side is pure Node.js, and the browser side is pure React. No build is required, and the lib/ directory is the release artifact. The API routes are protected by loopback and same-origin fences, ensuring that even if deployed in a LAN-exposed environment, these interfaces do not serve external traffic.
Installation & Enablement¶
Install to the web profile via the dsh CLI:
dsh plugin --profile web add github:Mystery-God/dsh-balance
Alternatively, you can install without going through the routing, by directly modifying the profile’s package.json, adding entries to deps and bundles, and then running pnpm install.
After installation, restart the dsh web UI and enter “Settings → Plugins → Model Balance Float” to complete the configuration: fill in the API key (or use the credentials service for parsing), turn on the “Show Balance Float” master toggle, and the floating card will appear in the bottom right corner.
How it Works¶
Three key files in the repository correspond to the three parts of the plugin:
lib/index.js — Host side: reads/writes ~/.dsh/balance/settings.json,
provides /api/dsh-balance/* routes (settings read/write, balance query),
and announces to the agent
lib/client.js — Browser side: settings page (settings.plugins.tab, master toggle + balance preview),
floating card (shell.overlay), 60s polling
cordis.patch.yml — bundle patch: injects the plugin row into the profile composition
This repository does not have TypeScript or a bundler: src/ is handwritten source code, and lib/ is the release artifact. lib/ needs to be committed because the dsh plugin market requires the entry file to exist when validating installation packages.
Development & Testing¶
After modifying the source code, build first, then test:
node scripts/build.mjs # copies src/ to lib/, no compilation step
node scripts/test.mjs # host route smoke test: mock balance interfaces, use temporary DSH_HOME
Use Cases & Notes¶
Suitable for: developers who are connected to one or more of DeepSeek, SiliconFlow, Moonshot, or OpenRouter in the DSH Web GUI, want to see their balance at any time, but do not want to expose the key to the browser.
A few notes:
- The plugin only supports the balance interfaces of the four providers listed above. Other domains will explicitly indicate that they are not supported; please confirm your provider is in the list before connecting.
- The plugin runs with the permissions of the current dsh process, allowing it to read/write files under
~/.dsh/and initiate network requests on the host side. It is recommended to check the source code and license before installing (this project is MIT). - The Node.js version must satisfy
^22.19.0 || >=24.0.0.
Conclusion¶
dsh-balance does just one thing, but does it thoroughly: keeping the balance permanently visible, refreshing on a schedule, not sending keys to the browser, and making settings take effect immediately. It is a typical small, complete client plugin under the DSH philosophy of “everything is a plugin.”
- Community Plugin Directory: https://www.skillhub.cn/plugins/Mystery-God/dsh-balance
- GitHub Repository: https://github.com/Mystery-God/dsh-balance
The directory page is an independent community site and has no official affiliation with DeepSeek or Moonshot AI.