balance-display
Persistent DeepSeek account balance indicator in the sidebar footer
AI Analysis
核心用途是在 DSH 侧边栏实时显示 DeepSeek 官方账户余额。适合需要随时监控 API 余额、防止因欠费导致服务中断的 DSH 用户。
Install
This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗
README
Read the full README ↗balance-display
A persistent DeepSeek Harness (DSH) plugin that shows your DeepSeek account balance in the sidebar footer, with a configurable balance popover, a dedicated settings page, and low-balance alert notifications.
Features
- ¥ icon button in the sidebar footer, styled to match the native Settings button:
- Wide sidebar → pill with label ("¥ Balance")
- Collapsed rail → circular icon, like Settings
- Click → a popover appears to the right showing your remaining balance
- Total / granted / topped-up balance rows
- Availability status and a manual refresh button
- Rendered on the frame-wide overlay, never covered by the conversation column
- Settings page (Settings → "余额显示" / "Balance display"):
- Choose which balance rows appear (inline switches)
- Reorder rows with ↑ / ↓ buttons
- Configurable auto-refresh interval (hours / minutes / seconds, min 10 s, integers only)
- Low-balance alert thresholds (multiple values supported)
- Draft model with Apply / Cancel / Reset actions
- Configuration is persisted in
~/.dsh/settings.yaml
- Alert notifications: when the balance drops below a configured threshold, a toast appears in the bottom-right corner (persists until closed). Multiple thresholds are supported; when several fire at once, only the lowest is shown, and a newer alert replaces the old one. The toast re-alerts after the balance rises back above the threshold and falls again. A Test alert button lets you preview the toast without waiting for a real drop.
- Auto-refresh at the configured interval; the ¥ icon turns red while the balance fetch fails
How it works
- Host half (
lib/index.js):- Registers a
balance-displaysettings namespace (fields, refresh interval, alert thresholds) GET /api/balanceproxieshttps://api.deepseek.com/user/balanceusing theDEEPSEEK_API_KEYcredential (resolved per request via the credentials service — the key never leaves the host)GET/POST /api/balance/settingsread/write the durable configuration (the plugin owns this same-origin surface because the api-proxy settings RPC only exposes allow-listed namespaces)
- Registers a
- Client half (
lib/client.js): a hand-writtenwindow.__ModuleLoader__bundle that registers the sidebar footer action, the frame overlay popover, the alert toast stack, and the settings section. All UI styling uses the theme's--dsw-*tokens.
Installation
-
Copy the package into your DSH profile's node_modules:
cp -r balance-display ~/.dsh/profiles/node_modules/ -
Register the plugin row in your profile composition (
~/.dsh/profiles/web/cordis.patch.yml):- insert: - id: balance-display name: 'balance-display' -
Make sure a
DEEPSEEK_API_KEYcredential is configured (the Models settings page or~/.dsh/.credentials.yaml). -
Restart
dsh weband refresh the page.
Requirements
- DeepSeek Harness (DSH) with a web profile (
dsh web) - Node.js with a global
fetch(Node 18+) - A valid
DEEPSEEK_API_KEY
License
MIT