Skip to main content

dsh-balance-plugin

53Stars5Forks5Issues0Watchers

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.

Evidence4/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
MIT
Branch
main
dshdsh-plugindsh-pluginsdsharpplustokenwalletwebui

Install

cmdweb profile
$ dsh plugin --profile web add dsh-balance-plugin

Run 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_up and usage details page platform.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-ai plugins 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/dsh host (cordis context injection timer / webServer / clientModules / credentials / sessionQuery / tools / shell / slots), browser-side react (reused from host bundle via require('react')), curl command line (called via host shell service), window.__ModuleLoader__ browser bundle loader
  • Architecture Pattern: Standard DSH dual-sided (host + client) plugin; host process registers private RPC route via ctx.webServer.register as POST /bmon/api/<name>, client calls via fetch; balance polling triggered by ctx.interval; usage statistics aggregated in real-time via ctx.on('session/event') + sessionQuery.readSession scans 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 via cordis.patch.yml; repository root host.js / client.js are 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

DependencyMinimum VersionDescription
DeepSeek HarnessNot declaredPlugin injects via cordis timer / webServer / clientModules / credentials / sessionQuery / tools / shell / slots, requires host version to provide these services (lib/index.js:5)
Node.jsNot declaredpackage.json does not declare engines; any host Node works
PlatformCross-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 ModulesNoneNo 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

ConfigTypeDescriptionDefault
Account ListList"+ Add Account" allows adding multiple accounts, each with name and API Key; empty Key submission means keep unchanged, "Clear" button can clear configured KeyEmpty (on first startup, automatically reads DSH credentials DEEPSEEK_API_KEY to generate an "Auto-read·DSH Credentials" account)
API Key ReferenceStringFill plaintext Key directly, or fill $env:ENV_VAR_NAME (e.g., $env:DEEPSEEK_API_KEY), expanded from environment variable before plugin callsPlaintext
CNY Alert ThresholdNumberTriggers low balance alert and marks red when total balance of that currency falls below this value10
USD Alert ThresholdNumberSame as above2
Refresh IntervalOptionBalance polling interval, select from dropdown; immediately triggers one refresh after submission300000 (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 -R command, 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/balance and local curl command; 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).

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](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.

← Back to plugin directory