DeepSeek Harness Plugin

Choi-Peng/dsh-deepseek-balance

Stars ★ 1 Category Usage & Billing Added 2026-08-17 npm @choi-p/dsh-deepseek-balance

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.

balance-display

[!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.yml or use Settings → Plugins → Balance Monitor; both apply without restarting dsh web.
  • Hides automatically when the sidebar is collapsed (rail mode).
  • Reads the API key from the DEEPSEEK_API_KEY environment 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

  1. Install the plugin into the web profile:
dsh plugin --profile web add "github:Choi-Peng/dsh-deepseek-balance"
  1. 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.ymlSave/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:

  1. DEEPSEEK_API_KEY environment variable
  2. ~/.api_keys file — the line export 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

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →