Install
Inside DeepSeek Harness, with dsh-market
dsh plugin --profile web add dshmarket
Or from the command line
dsh plugin --profile web add @choi-p/dsh-deepseek-balance
Installing runs third-party code with your own permissions — it can read your files, use your credentials and reach the network. Review the source first, and pin a commit (github:owner/repo#sha) when you can.
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.1.1-rc.2 (fully supporting
0.1.1-rc.2as well as0.1.2-alpha.3~0.1.2-rc.1and later). The host provides the official two-seam configuration model (@deepseek-ai/dsh-settings) and modular client package injection (locale,ui-renderer,ui-sidebar,ui-settings-plugins).
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 — deployer defaults via
cordis.patch.yml(base layer, HMR), user settings via Settings → Plugins → Balance Monitor (persisted tosettings.yamlthrough the dsh settings service); 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 the deepseek-balance settings namespace on the official ctx.settings seam (the patch-row config becomes the base layer; the Settings → Plugins → Plugin configuration tab dispatches the card), plus /deepseek-balance (proxies the DeepSeek Get User Balance API) and /deepseek-balance/settings (a thin proxy over ctx.settings: GET effective settings + revision; POST saves/resets the user layer with optimistic-concurrency revisions, answering 409 on conflict) |
| 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.plugin.item keyed deepseek-balance (rendered in the Plugin configuration tab) |
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
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
The plugin settings follow the official dsh two-seam configuration model, and all layers apply live, without restarting dsh web (requires a dsh ≥ 0.1.1-rc.2 host, which ships @deepseek-ai/dsh-settings):
| Layer | Source | How it applies |
|---|---|---|
| Defaults | declared in the schema (cny, both thresholds 0) |
— |
| Base (deployer's static config) | the row config in the plugin bundle's own cordis.patch.yml (dsh.bundle.patch, applied automatically on install) |
dsh web watches the patch layer (HMR); editing it restarts this fiber with the new config |
| User (runtime settings) | Save/Reset from Settings → Plugins → Balance Monitor, persisted through ctx.settings into $DSH_HOME/settings.yaml; Reset clears the user layer and falls back to base |
hot-published by the settings service, applies immediately; this plugin never writes cordis.patch.yml |
The base-layer config (what the bundle ships):
- 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 card exposes
displayCurrency (select: CNY only / USD only / both) and both warning
thresholds (number inputs), with Save / Reset-to-defaults. Saves carry the
read revision for optimistic concurrency — if the settings changed elsewhere,
the card reloads the latest values and tells you. The sidebar readout re-polls
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 → Balance Monitor card: pick the displayed currency and set warning thresholds, then Save. All changes apply live without restarting
dsh web.
Development
# Validate the host half imports cleanly:
node --input-type=module -e "import('./lib/index.js').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
Comments
Comments live in GitHub Discussions. Sign in with GitHub to post or react.