pythonshiyi/dsh-plugin-balance
Balance display plug-in (DeepSeek Harness web UI): Live account balance in session header | Live account balance for DeepSeek Harness web UI
dsh-plugin-balance shows a live provider account balance in the DeepSeek Harness web UI session header. A balance pill sits on the right of the session header (a real, keyboard-focusable button) and auto-refreshes every intervalSeconds (default 60), with click-to-refresh. Hovering reveals total, topped-up balance, granted balance, account availability, refresh cadence, last-update time and any recent refresh error, and a stale-while-revalidate rule keeps the last good value on screen (dimmed) instead of flashing red when a refresh fails. curl runs with -f so HTTP 401/402/429/5xx exit non-zero and the tooltip shows the real cause. It is localized (zh/en) and formats amounts with thousand separators. The node half serves GET /dsh-balance on the harness web server (same-origin, no CORS).
Install
cd ~/.dsh/profiles && npm install https://github.com/pythonshiyi/dsh-plugin-balanceIMPORTANT DISCREPANCY: the bare npm name dsh-plugin-balance on the public registry resolves to a DIFFERENT repository (github.com/Andrew111888/dsh-plugin-balance, BSD-3-Clause with an unrelated README), not this one, so the README's Option A (npm install dsh-plugin-balance) would install the wrong package -- use the GitHub URL form above into your profile's ~/.dsh/profiles directory instead, then register the row (id: plugin-balance, name: dsh-plugin-balance) in the profile patch (e.g. ~/.dsh/profiles/web/cordis.patch.yml) and restart dsh --profile web, then refresh the page.
Compatibility
DeepSeek Harness web profile (dsh --profile web); curl on PATH (>= 7.55 for headerViaFile); an API key configured in the Models page (credentials service) or as the DEEPSEEK_API_KEY environment variable. Targets DeepSeek-compatible providers that expose GET /user/balance; a custom gateway without that endpoint shows the failure reason (with HTTP status) in the tooltip. Developed against DSH 0.1.0-rc.6.
Details
- Repo: pythonshiyi/dsh-plugin-balance
- Category: Web UI Enhancements
- Stars: 1
- Version: source / GitHub install (no registry package back-links to this repo); MIT
- Last push: 2026-08-15
- First seen: 2026-08-14
Recent updates
The README documents the row config block (ttlMs, failTtlMs, timeoutMs, baseURL, apiKeyEnv, balancePath, headerViaFile, preferEnv, intervalSeconds) and the credential/provider-precedence rules (credentials service first, then DEEPSEEK_API_KEY; provider facts: row config > llm-deepseek settings namespace > defaults), plus a security note that the Authorization header travels in a short-lived curl argv by default (a headerViaFile hardened variant uses a temp file).
FAQ
- How do I install dsh-plugin-balance?
- Use the README's Option B: cd ~/.dsh/profiles && npm install https://github.com/pythonshiyi/dsh-plugin-balance, then register the plugin-balance row in your profile patch and restart. The README's Option A (npm install dsh-plugin-balance) is NOT safe -- on the public registry that name belongs to a different repository.
- I see 'Balance--'. What does that mean?
- Per the README it is the initial error state when no fetch has ever succeeded; hover for the reason (missing credential, HTTP 401/402/429/5xx, a curl exit code, or a parse failure on a gateway without a balance endpoint). A failed refresh after a success keeps the last value dimmed.
- How fresh is the balance?
- The browser polls every intervalSeconds (default 60s); the node half caches successes for ttlMs (default 55s) and failures for failTtlMs (default 10s), with concurrent requests single-flighted so the provider API is not hammered.
Alternatives
crazywoola/dsh-balance · LemCAE/dsh-balance · FengHuoLinShan/dsh-plugin-llm-balance