A balance and usage visualization plugin for DeepSeek Harness: monitors multi-account balances, provides low balance alerts, enables one-click recharge, includes Miyu-style usage statistics, and offers a third-party plugin management panel.
- Language
- JavaScript
- License
- MIT
- Branch
- main
Install
$ dsh plugin --profile web add dsh-balance-pluginRun the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial
Install via your agent
Install the DeepSeek Harness plugin Francis-Xavier-code/dsh-balance-plugin for me: review the repository at https://github.com/yxxbc/dsh-balance-plugin first, then run the install command and verify the plugin loads successfully.
Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.
One-Line Positioning
Equip DeepSeek Harness with a set of financial and statistical dashboards: monitor multi-account DeepSeek API balances, low balance alerts, one-click jump to official recharge page, and replicate Miyu WebUI's usage statistics view, plus a third-party plugin management panel.
Core Features
- Monitor DeepSeek API multi-account balances (CNY / USD dual currency pools) and trigger independent low balance alerts by currency with configurable thresholds (default ¥10 / $2, balance bar turns red, console prints warning)
- One-click access to DeepSeek official recharge page
platform.deepseek.com/top_upand usage details pageplatform.deepseek.com/usage - Provide Miyu-style usage statistics page: 1 day / 7 days / 30 days / all-time toggle, statistical tiles, GitHub contribution-style usage calendar, three-segment stacked trend bar chart, model consumption ring chart with details table, last 50 call records
- Real-time performance metrics bar: rounds, steps, LLM duration, tool call duration, first token average latency, tok/s, cache hit rate
- Third-party plugin management: list all non-
@deepseek-aiplugins under web profile (package name, Bundle rev, dependencies, local path), one-click "Open Directory" on macOS to locate source code - Register model tool
query_api_quota, enabling LLM to directly query DeepSeek balance and provide recharge reminders
Technical Implementation
- Language: JavaScript (Node.js + browser-side ES Module / CommonJS bundle)
- Key Dependencies:
@deepseek-ai/dshhost (cordis context injectiontimer / webServer / clientModules / credentials / sessionQuery / tools / shell / slots), browser-sidereact(reused from host bundle viarequire('react')),curlcommand line (called via hostshellservice),window.__ModuleLoader__browser bundle loader - Architecture Pattern: Standard DSH dual-sided (host + client) plugin; host process registers private RPC route via
ctx.webServer.registerasPOST /bmon/api/<name>, client calls viafetch; balance polling triggered byctx.interval; usage statistics aggregated in real-time viactx.on('session/event')+sessionQuery.readSessionscans 90 days of history at startup - Entry Files:
lib/index.js(host),lib/client.js(browser, loaded via/plugins/dsh-balance-plugin/client.js), inserted into web profile viacordis.patch.yml; repository roothost.js/client.jsare dynamic version-equivalent copies
Use Cases
Users who frequently call official DeepSeek Harness APIs: want to see remaining balance at a glance on the main interface to avoid being blocked by low balance; want to view token consumption trends over the past week/month, model breakdown, and cache hit rate; want to conveniently see which third-party web plugins are installed and locate their source code. Ordinary light users only care about the balance bar and alerts, while power users will use the usage statistics and model tools.
Prerequisites & Compatibility
| Dependency | Minimum Version | Description |
|---|---|---|
| DeepSeek Harness | Not declared | Plugin injects via cordis timer / webServer / clientModules / credentials / sessionQuery / tools / shell / slots, requires host version to provide these services (lib/index.js:5) |
| Node.js | Not declared | package.json does not declare engines; any host Node works |
| Platform | Cross-platform (macOS) | Balance query, usage statistics, browser panel are cross-platform; "Open Directory" for third-party plugins uses macOS open -R command, only available on macOS (lib/index.js:535) |
| Native Modules | None | No npm native dependencies; balance query via host shell calling curl, no additional native modules |
Installation
dsh plugin --profile web add github:Francis-Xavier-code/dsh-balance-plugin
After installation, restart DSH. Three icon buttons appear on the right side of the input box toolbar, indicating the plugin is active. Optionally use DSH_PROFILE=<name> to switch to other profiles.
Configuration Options
| Config | Type | Description | Default |
|---|---|---|---|
| Account List | List | "+ Add Account" allows adding multiple accounts, each with name and API Key; empty Key submission means keep unchanged, "Clear" button can clear configured Key | Empty (on first startup, automatically reads DSH credentials DEEPSEEK_API_KEY to generate an "Auto-read·DSH Credentials" account) |
| API Key Reference | String | Fill plaintext Key directly, or fill $env:ENV_VAR_NAME (e.g., $env:DEEPSEEK_API_KEY), expanded from environment variable before plugin calls | Plaintext |
| CNY Alert Threshold | Number | Triggers low balance alert and marks red when total balance of that currency falls below this value | 10 |
| USD Alert Threshold | Number | Same as above | 2 |
| Refresh Interval | Option | Balance polling interval, select from dropdown; immediately triggers one refresh after submission | 300000 (5 minutes, options: 30 seconds / 1 minute / 15 minutes / 30 minutes) |
FAQ
Q: Is the plugin still there after restart?
A: Yes. Static plugins are persistently installed and remain effective after restart; manually configured account Keys via panel will reset, but the auto-read DEEPSEEK_API_KEY account automatically restores at startup (lib/index.js:144).
Q: Can't see entry buttons at bottom of sidebar?
A: The bottom slot of DSH sidebar is fully occupied by the official Cordis panel plugin. This plugin's entry is fixed to the right side of the input box toolbar (💰 Wallet / 📊 Usage / 🧩 Third-party Plugins) and the persistent balance bar below the input box, not relying on sidebar slots (lib/client.js:799-816).
Q: Will API Key be leaked?
A: No. Keys are only stored in the local plugin process's memory object, the interface only shows masked values (... last 4 digits), no credentials in source code or documentation, curl calls are forwarded via Host shell and not written to logs (lib/index.js:33-53).
Q: What to do if balance query fails?
A: Check the error message on the panel's account row: unconfigured Key shows "API Key not configured"; using $env: reference but variable missing shows "Environment variable xxx not set"; invalid Key passes through DeepSeek's returned 401 / error message (lib/index.js:43-91).
Q: Why can't I see usage statistics beyond 90 days?
A: The plugin scans recent 90 days of session events at startup, deduplicating by seq, but reads maximum 60 sessions at once (lib/index.js:345). If session count exceeds, earlier portions are skipped; "First token average latency" only统计数据 from real-time captured streaming data after plugin runs.
Q: Why can't I use dsh plugin add dsh-balance-plugin?
A: There exists a package with the same name by another person on npm ([email protected]), bare package name will install the wrong version. Installation command must use github: source pointing to this repository (README.md:163).
Q: How to uninstall?
A: One-liner: curl -fsSL https://raw.githubusercontent.com/Francis-Xavier-code/dsh-balance-plugin/main/uninstall.sh | bash; Manual: dsh plugin --profile web rm dsh-balance-plugin and clean up the plugin's - insert block in ~/.dsh/cordis.patch.yml, restart to take effect.
Q: Can "Open Directory" in third-party plugins panel work on Windows?
A: No. This feature executes open -R <path> via Host shell (lib/index.js:535), which is a macOS Finder-specific command; Windows / Linux have no open, clicks will fail, list display itself still works normally.
Difficulty Level
Beginner — After installation, it comes with an "Auto-read·DSH Credentials" account by default, the balance bar immediately starts refreshing, no additional configuration needed; adding accounts or adjusting thresholds is just a few clicks in the panel.
Known Issues & Limitations
- Third-party plugin "Open Directory" uses macOS
open -Rcommand, unavailable on Windows / Linux (lib/index.js:535). - Startup historical scan reads maximum 60 sessions (lib/index.js:345), users with more than 60 sessions within 90 days may see less historical usage than expected.
- "First token average latency" only统计数据 from real-time captured streaming data after plugin runs, sessions before plugin installation cannot contribute (README.md:161).
- Balance query depends on DeepSeek official API
api.deepseek.com/user/balanceand localcurlcommand; offline environments have no balance query capability. - Browser-side client.js is 53 KB itself, injected stylesheet is about 100 lines of CSS, both enter the page bundle with the plugin (lib/client.js:37-137).
💰 DeepSeek Balance Monitor & Usage Stats
A DeepSeek Harness (DSH) plugin — balance monitoring · official top-up link · Miyu-style usage statistics · third-party plugin manager
✨ Features · 🖼 Screenshots · 📥 Install · ⚙️ Configuration · 🎮 Usage · 🗑 Uninstall · 🏗 Architecture · ❓ FAQ
✨ Features
| Module | Capability |
|---|---|
| Balance monitoring | Monitors DeepSeek API balance (CNY / USD dual balance pool) with parallel multi-account queries; auto-reads the DSH credential DEEPSEEK_API_KEY — no manual entry needed |
| Low-balance alerts | Independent CNY / USD thresholds (default ¥10 / $2, configurable); the balance bar turns red when below threshold |
| One-click top-up | Jumps straight to the official DeepSeek top-up page platform.deepseek.com/top_up, plus a usage-details page link |
| Usage statistics | 1:1 recreation of the Miyu WebUI usage page: stat tiles / GitHub-contribution-style usage calendar / three-segment stacked trend bar chart / model consumption donut chart with detail table / recent 50 call records |
| Performance metrics | Turns · steps · LLM duration · tool-call duration · avg first-token latency · tok/s · cache hit rate |
| Third-party plugin manager | Lists unofficial (non-@deepseek-ai) web plugins: package name / local path / Bundle rev / dependencies, with a one-click "Open Directory" to locate source code |
| Model tool | Registers the query_api_quota tool — just ask "How much DeepSeek balance is left?" and get a balance summary |
Charts use Miyu's chart / heat palettes (blue / gold / rose / purple + blue-purple heat scale) and auto-adapt to dark / light themes.
🖼 Screenshots
| Screenshot | Description |
|---|---|
![]() | Three icon entries on the right of the input toolbar (💰 Wallet / 📊 Usage / 🧩 Plugins) plus a persistent balance bar below |
![]() | Balance monitoring panel: balance table, low-balance alerts, account config, thresholds & refresh interval, top-up entry |
![]() | Usage page top: range switcher, stat tiles, live performance metric bar, GitHub-style usage calendar |
![]() | Usage page bottom: trend bar chart, model consumption details, call record details |
![]() | Third-party plugin manager: stat badges, plugin list, "Open Directory" action |
📥 Install
Prerequisites
- DeepSeek Harness installed and running
- (Optional) DeepSeek API Key — get one at platform.deepseek.com; if
DEEPSEEK_API_KEYis already configured on this machine, the plugin auto-reads it at startup — no manual input required
One-click install (recommended)
# Installs automatically (install deps → write compose patch → prompt restart)
curl -fsSL https://raw.githubusercontent.com/Francis-Xavier-code/dsh-balance-plugin/main/install.sh | bash
Restart DeepSeek Harness after installation — three icon buttons appear on the right of the input box. Use DSH_PROFILE=<name> to target another profile.
Manual install (equivalent)
# 1. Install the dependency (use the github: source, not the bare package name — a third party owns a same-named package on npm)
dsh plugin --profile web add github:Francis-Xavier-code/dsh-balance-plugin
# 2. Append the plugin line to ~/.dsh/cordis.patch.yml (skip if already present)
- insert:
- id: dsh-balance-plugin
name: 'dsh-balance-plugin'
# 3. Restart DeepSeek Harness
⚙️ Configuration
Click the wallet icon (💰) on the right of the input toolbar to open the "Balance Monitor" panel:
| Setting | Description |
|---|---|
| Account list | Click "+ Add Account" to add; each account can have a name and API Key |
| API Key input | Enter the plaintext Key, or reference an environment variable like $env:DEEPSEEK_API_KEY; leaving an existing Key empty keeps it unchanged |
| Auto-read account | At startup, if the DSH credential DEEPSEEK_API_KEY is detected, an "Auto-read · DSH credential" account is created automatically |
| CNY / USD alert thresholds | Triggers a low-balance alert when the balance of the corresponding currency drops below the threshold (default ¥10 / $2) |
| Refresh interval | 30 seconds ~ 30 minutes (default 5 minutes); "Save Config" triggers an immediate refresh |
🔒 Key security: API Keys are kept only in the plugin process memory on your machine and are never uploaded to any third party; the UI only shows masked values.
🎮 Usage
| Entry | Location | Description |
|---|---|---|
| 💰 Wallet icon | Right of the input toolbar | Opens the balance monitor panel (config / balance / top-up) |
| 📊 Bar-chart icon | Right of the input toolbar | Opens the usage statistics panel |
| 🧩 Four-grid icon | Right of the input toolbar | Opens the third-party plugin manager panel |
| Persistent balance bar | Below the input box | Real-time balance summary, ↻ refresh, top-up link; turns fully red on low balance |
query_api_quota tool | Model calls | Just ask "How much DeepSeek balance is left?" |
All panels are centered overlays: click the backdrop or "✕ Close" to exit.
🗑 Uninstall
# One-click uninstall (removes dependency + cleans the compose patch)
curl -fsSL https://raw.githubusercontent.com/Francis-Xavier-code/dsh-balance-plugin/main/uninstall.sh | bash
Manual equivalent:
dsh plugin --profile web rm dsh-balance-plugin
# and remove the corresponding two lines from ~/.dsh/cordis.patch.yml
Restart DeepSeek Harness after uninstalling.
🏗 Architecture
Host (Node.js process)
├─ Balance query: shell runs curl → api.deepseek.com/user/balance (Bearer auth)
├─ Usage aggregation: real-time session/event listening + 90-day history scan (deduped by seq)
├─ Third-party plugins: clientModules.graph() + clientPath() + open -R to locate
├─ RPC routes: /bmon/api/get-state · refresh · recharge · set-config ·
│ get-usage · list-plugins · open-plugin-dir
└─ Model tool: query_api_quota
Client (browser)
├─ Entry: 3 SVG icon buttons on the right of the input toolbar
├─ Overlays: self-rendered fixed panels inside the component (no overlay slot dependency)
└─ Charts: Miyu chart/heat palettes, dark/light adaptive
❓ FAQ
Q: Will the plugin still be there after a restart?
A: Yes — static plugins are installed persistently and survive restarts. Manually configured account keys reset (the auto-read DEEPSEEK_API_KEY account needs no reconfiguration and restores automatically after restart).
Q: I can't see the entry button at the bottom of the sidebar? A: The DSH sidebar bottom slot is exclusively occupied by the official Cordis panel plugin. This plugin's entry is fixed on the right of the input toolbar and does not depend on that slot.
Q: Will my Key leak? A: No. Keys are kept only in the plugin process memory on your machine and the UI only shows masked values; neither the source code nor the README contains any secrets.
Q: Balance query fails?
A: Check the error hint in the panel: no Key configured (API Key not configured), missing environment variable (Environment variable xxx not set), invalid Key (401 error message), and handle accordingly.
Q: No historical usage data? A: The plugin scans session events from the last 90 days at startup; "avg first token" only counts streaming data captured in real time after the plugin is running.
Q: Why not use dsh plugin add dsh-balance-plugin?
A: A third party owns a same-named package on npm ([email protected]), so the bare name would install the wrong one. Use the one-click script or the github: source (see Install).
💬 QQ Community
📄 License
Read the usage guide →
Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.
Listing badge
[](https://deepseek-plugin.org/plugins/Francis-Xavier-code/dsh-balance-plugin)Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.




