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. 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.
Features
- Displays your current DeepSeek account balance at the bottom of the left sidebar, above Settings, auto-refreshing every 60 seconds.
- Supports both CNY and USD display, with configurable thresholds for color warnings.
- Config hot reload — edit
cordis.patch.ymlor use Settings → Plugins → Balance Monitor; both apply without restartingdsh web. - 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 |
Registers /deepseek-balance (proxies the DeepSeek Get User Balance API) and /deepseek-balance/settings (GET effective config; POST saves/resets settings back into this plugin's row in the profile's cordis.patch.yml; if the row is absent at startup, a default row is written) |
| Client | lib/client.js |
Registers the balance readout in the sidebar.footer.action slot (60 s poll) and an editable Balance Monitor card in Settings → Plugins |
Browser (Client half) --fetch /deepseek-balance--> Host HTTP route --> api.deepseek.com/user/balance
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
- Install the plugin into the web profile:
dsh plugin --profile web add "github:Choi-Peng/dsh-deepseek-balance"
- Mount the plugin row in the profile's patch layer:
# ~/.dsh/profiles/web/cordis.patch.yml
- insert:
- id: deepseek-balance
name: '@choi-p/dsh-deepseek-balance'
config:
displayCurrency: cny
warningThresholdCny: 0
warningThresholdUsd: 0
Uninstalling
First remove the row from cordis.patch.yml (applies live), then:
dsh plugin --profile web remove @choi-p/dsh-deepseek-balance
Configuration
The plugin settings are layered, and all layers apply live, without restarting dsh web:
| Layer | Source | How it applies |
|---|---|---|
| Defaults | hard-coded in the plugin (cny, both thresholds 0) |
— |
| Primary | the deepseek-balance row config in the profile's cordis.patch.yml — Save/Reset from Settings → Plugins → Balance Monitor rewrites that row directly (only the row's config block is replaced; comments, !!js expressions, and other rows in the file are preserved verbatim; a full-file rewrite is used only when the row text is unrecognizable); at startup, if the profile patch has no row for this plugin yet, a default row is appended |
dsh web watches the patch layer (HMR); writing the file restarts this fiber with the new config, no restart needed |
The card exposes
displayCurrency (select) and both warning thresholds (number inputs), with
Save / Reset-to-defaults; after saving, the sidebar readout refreshes
immediately (it also re-polls every 60 s).
The API key is resolved in this order:
DEEPSEEK_API_KEYenvironment variable~/.api_keysfile — the lineexport DEEPSEEK_API_KEY="sk-..."
The balance API returns both CNY and USD balances when present; the plugin prefers CNY and falls back to USD.
Development
# Validate the host half imports cleanly:
node --input-type=module -e "import('@choi-p/dsh-deepseek-balance').then(m => console.log(m.name, m.inject))"
# Syntax-check the client bundle:
node -e "new Function(require('fs').readFileSync('lib/client.js', 'utf8'))"
License
MIT
Links
More in this category
Han-1413141/dsh-cost-meter★ 71
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
Ychris12138/dsh-usage-stats★ 60
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
zh667/TokenLedger★ 23
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.
feibi-mochi/deepseek-harness-control-center★ 21
DeepSeek Harness control center for official balance monitoring, per-session costs and tokens, third-party token totals, completion alerts, official recharge, flexible layouts, and agent-assisted session controls.
SenmuuuuW/dsh-whale-report★ 20
DeepTrace — deterministic agent reports from session logs (daily/weekly/monthly/yearly/custom): cost & token breakdown, 8 insight rules, collaboration review, live provider balance, PDF/PNG/HTML export; read-only, never rewrites history.
Ghost011118/dsh-balance-meter★ 16
DeepSeek account balance and session cost in the composer dock, with auto-fetched official pricing and peak/off-peak support.