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.
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 the deepseek-balance settings namespace (so the Settings → Plugins → Plugin configuration tab dispatches the card), plus /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.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
- 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