DeepSeek account balance in the dsh web sidebar footer with live config hot reload and an editable Settings → Plugins card.
Install
# from npm (prebuilt)
dsh plugin --profile web add @choi-p/dsh-deepseek-balance
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Choi-Peng/dsh-deepseek-balance
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
A persistent DeepSeek Harness Cordis plugin that shows your DeepSeek account balance in the sidebar footer, right above the Settings button.
[!NOTE] AI-generated disclaimer: This plugin was generated by AI. It may contain errors, security issues, or behave unexpectedly. Please review the code and test it yourself before use; feel free to submit an issue or PR if you find any problems.
[!IMPORTANT] Compatibility: this release targets dsh ≥ 0.2.1-rc.1 (0.1.x stays on 0.5.x). The host derives the settings form from the entry's exported
Configschema through@deepseek-ai/dsh-settings, and the browser reaches the same seam throughctx.configForms(@deepseek-ai/dsh-client-ui-settings).
Features
- Displays your current DeepSeek account balance at the bottom of the left sidebar, above Settings, auto-refreshing every 60 seconds.
- Three display modes: CNY only, USD only, or both; per-currency warning thresholds color the readout red below the threshold and yellow below twice it (0 disables the warning).
- Live config — the values live in the plugin's own row in the profile
cordis.patch.yml, read and written by the dsh settings service; saves apply immediately, without restartingdsh weband without remounting the plugin. - The settings section is rendered directly on the plugin's own page (Settings → Plugins → Balance Monitor), the same way the CodeBuddy bridge plugin does it; the
deepseek-balancerow keeps its configure page. - Hides automatically when the sidebar is collapsed (rail mode).
- Reads the API key from the
DEEPSEEK_API_KEYenvironment variable.
Architecture
This is a dual-face Cordis plugin:
| Half | File | Role |
|---|---|---|
| Host | lib/index.js |
Exports the schemastery Config (three volatile fields) the settings seam projects into an editable form for this entry, plus /deepseek-balance (proxies the DeepSeek Get User Balance API) |
| Client | lib/client.js |
Registers the balance readout in the sidebar.footer.action slot (60 s poll), the settings section on the bundle page in plugins.bundle.config keyed by the package name, and the row's configuration page in plugins.row.config keyed @choi-p/dsh-deepseek-balance#deepseek-balance; reads and writes settings through ctx.configForms |
Browser (Client half) --fetch /deepseek-balance--> Host HTTP route --> api.deepseek.com/user/balance
Browser (Client half) --ctx.configForms--> remote.settings --> the plugin's row in the profile cordis.patch.yml
Since dsh 0.2 a plugin no longer registers a settings namespace of its own: the Config schema a Loader entry exports is projected into a form by the settings service, and writes land in the profile patch document. The browser half reads the same document through ctx.configForms and submits mutate operations, so the sidebar readout and the configuration page share one source of truth — a save reaches both with no plugin-owned HTTP settings proxy and no poll.
Installation
Via plugin-registry
Settings → Plugins → Install, and set the source to @choi-p/dsh-deepseek-balance or github:Choi-Peng/dsh-deepseek-balance.
Manual Installation
dsh plugin --profile web add "github:Choi-Peng/dsh-deepseek-balance"
The package ships its own cordis.patch.yml (dsh.bundle.patch in package.json), which dsh applies automatically when installing the plugin — no need to hand-edit the profile-level cordis.patch.yml. Restart dsh web for it to take effect (plugin discovery is cached per process).
Uninstalling
dsh plugin --profile web remove @choi-p/dsh-deepseek-balance
The bundle mount disappears with the plugin; if you ever wrote the row into the profile-level patch manually, remove it first.
Configuration
| Layer | Source | How it applies |
|---|---|---|
| Defaults | declared in the Config schema (cny, both thresholds 0) |
— |
| Base (bundle) | the row config in the plugin bundle's own cordis.patch.yml (dsh.bundle.patch, applied automatically on install) |
applies with the bundle |
| User (runtime settings) | Save/Reset from Settings → Plugins → Balance Monitor, written by the settings service into this plugin's row in the profile cordis.patch.yml; Reset clears the overrides and falls back to the bundle defaults |
applies immediately |
The effective value is schema defaults → bundle base → user layer, each layer overriding the previous.
The bundle's default config:
- insert:
- id: deepseek-balance
name: '@choi-p/dsh-deepseek-balance'
config:
displayCurrency: cny # cny = CNY only | usd = USD only | both (default: cny)
warningThresholdCny: 0 # CNY warning threshold (0 = disabled); red below it, yellow below 2×
warningThresholdUsd: 0 # USD warning threshold (0 = disabled); red below it, yellow below 2×
The page exposes
displayCurrency (CNY only / USD only / both) and both warning
thresholds (number inputs), with Save / Reset-to-defaults. Writes carry the
read revision for optimistic concurrency — if the settings changed elsewhere,
the page reloads the latest values and tells you. The sidebar readout re-polls
the balance every 60 s. Warning rule: balance ≤ threshold turns red, ≤ twice the threshold
turns yellow, and a threshold of 0 disables the warning.
The API key is read from the DEEPSEEK_API_KEY environment variable; it is held only by the host half and sent as a Bearer token, never exposed to the browser.
The balance API returns all of the account's currency balances (usually CNY and USD); the sidebar shows the currencies selected by displayCurrency.
Usage
- Start
dsh webwithDEEPSEEK_API_KEYset in the environment — the sidebar footer shows a balance readout above Settings, refreshed every 60 s. - Settings → Plugins → open the Balance Monitor (
@choi-p/dsh-deepseek-balance) package page: the plugin info carries a Balance Monitor settings section — pick the displayed currency, set the warning thresholds, and Save. Thedeepseek-balancerow → Configure opens the same form. Changes apply live without restartingdsh web.
Development
# Validate the host half imports cleanly (including the Config schema):
node --input-type=module -e "import('./lib/index.js').then(m => console.log(m.name, typeof m.Config.toJSON))"
# Syntax-check the client bundle:
node -e "new Function(require('fs').readFileSync('lib/client.js', 'utf8'))"
# Inspect how dsh validates this plugin's config:
dsh web --dump-config-schema | grep -A20 config
License
Links
More in this category
bowenliang123/dsh-context★ 5064
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 689
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 290
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 205
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 188
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
Mt-Youya/dsh-plugins#sessions-insight★ 146
Browse Claude Code, DSH and Codex session logs by working directory, with per-turn context composition, token usage, compaction markers and cost estimates.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.