Introduction¶
The bottom bar of DSH’s input box already displays context usage and token speed, but without checking the billing page, you don’t know how much money is remaining in the current account. To confirm the balance, you have to switch to the recharge page or open another web page. The h2fe1/dsh-deepseek-account-balance plugin is designed for this specific action: it takes the current logged-in DeepSeek account balance and places it as a very small tag to the right of the context usage in the bottom bar of the input box. The plugin does not register routes, does not read keys, does not initiate inference requests, and belongs to the client-side category.
What is this¶
The plugin is maintained by h2fe1, repository address h2fe1/dsh-deepseek-account-balance, license MIT, version 0.1.1. The problem it solves is: seeing the balance with minimal cost within the conversation interface without leaving the current dialogue.
The effect is an extra segment at the end of the bottom bar row:
[1 轮 114 步 · 216 tok/s] [12M tok · 缓存命中 99%] ◔ 19% 余额 ¥61.48
Implementation Logic¶
The plugin does not fetch tokens itself, nor does it request third-party interfaces. It directly utilizes the client-side read-only methods exposed by DSH’s deepseek-account service:
| Method | Purpose |
|---|---|
account.getState() |
Determine if logged in (credential-stored / signed-out) |
account.getBalance(client) |
Fetch normal_wallets (recharge balance) and bonus_wallets (bonus balance) |
The request is sent from the Host carrying login credentials to the Platform. The page cannot obtain the token, and no new Host routes are added. The entire process is read-only: no inference requests are initiated, and the account, quota, or subscription is not modified.
Installation and Enablement¶
In the DSH Web GUI, open Plugins → Add Plugin → Install Third-Party Plugin, and fill in the repository address:
https://github.com/h2fe1/dsh-deepseek-account-balance
Or install using Agent or CLI:
dsh plugin --profile <你的 profile> add github:h2fe1/dsh-deepseek-account-balance
After installation, enter any conversation, and the balance tag will appear to the right of the context usage at the bottom of the input box. It refreshes automatically every 60 seconds when the page is visible, and also refreshes when switching back to the page. Requires Node ^22.19.0 || >=24.0.0, DSH >=0.2.0-rc.2.
Local Development¶
git clone https://github.com/h2fe1/dsh-deepseek-account-balance.git
dsh plugin --profile <你的 profile> add link:$PWD/dsh-deepseek-account-balance
The source code structure is straightforward:
index.jsis the Host half, keeping only the Loader line, not registering routes.client.jsis the Browser half, responsible for rendering the balance tag inconversation.composer.dock, reading account Remote, and formatting for display.locale/*.jsoncontains the title and description in the plugin list.
Display Rules and Refresh¶
- Logged in: Display
Balance ¥61.48; if there is bonus quota, only showBonus ¥x.xxin the tooltip. - Not logged in: Display
Balance —, tooltip guides to ‘Settings → Account’ to log in. - Query failed: Retain the last amount and mark it red, hover to see specific error, click tag to retry.
- Clicking the entire tag immediately refreshes. Account switching or logging out will reflect on the next refresh.
- Amount displayed according to Platform’s two-decimal rule; less than one cent shows
<¥0.01(negative shows-¥0.01), multi-currency connected by+. - Font size, color consistent with other items in that row (12px, tertiary, normal weight).
- Language follows DSH’s interface language (Chinese / English).
- Only appears when there is a conversation and context usage is displayed; welcome page does not occupy space.
Configuration and Use Cases¶
The plugin has no configuration items, does not read any keys, and does not require filling in account information. It relies on the DeepSeek account already logged in within DSH, so it is suitable for users who use DSH for daily conversation and want to casually see their balance; for scenarios requiring multi-account switching or precise billing, you still need to go to the billing page to verify.
The plugin runs with the permissions of the current dsh process. It is recommended to read the source code once before installation and confirm the license. The repository provides CI (test workflow), and local self-checks can also be done using the following commands:
node --test test/*.test.mjs
node --check index.js && node --check client.js
Conclusion¶
The value of this plugin lies in turning “checking balance” from a jump into a glance at the bottom bar, with low intrusiveness and simple update logic. It belongs to the client-side category in the community plugins directory and has no official affiliation with DeepSeek / HF.
Directory page: https://www.skillhub.cn/plugins/h2fe1/dsh-deepseek-account-balance
GitHub: https://github.com/h2fe1/dsh-deepseek-account-balance