DeepSeek balance and per-session token usage in the session header, with a three-level balance alert and editable thresholds, one-click top-up links, a segmented token bar with cache-hit statistics, and a visibility-aware poller.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:kai-GitHubaccount/dsh-usage-panel
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 — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 简体中文
DeepSeek account balance and per-session token usage for the DSH (DeepSeek Harness) web GUI, rendered as a colored pill in the session header (top right).

Features
- Balance from the official
GET /user/balance(total / topped-up / granted). - Token usage from the host
tokenUsageprojection: uncached input, cache read, cache write, output, total, and cache-hit rate. - Three-level balance alert with user-editable thresholds: sufficient / warning / insufficient, recoloring the pill and the detail card.
- Recharge entry: top-up, usage detail, sign-in, and copy-link, with three open modes (new tab / same tab / copy link).
- Query efficiency: visibility-aware polling (paused on hidden tabs), exponential backoff on failure, a 30s host cache with single-flight, and manual refresh.
- Version tolerant: the host prefers
ctx.connection.fetchand falls back toctx.webServer; the browser tries the session-header seats in order.
Install
Option 1 - install it as a plugin package (recommended):
dsh plugin --profile web add dsh-usage-panel
Option 2 - local installer:
node install.mjs --home ~/.dsh --profile web
Restart dsh web (or let the live patch watcher apply it) and refresh the GUI.
Configuration (host)
apply(ctx, config) reads an optional config object from the patch row:
| Field | Default | Meaning |
|---|---|---|
routePath |
/api/usage-panel/balance |
route served by the host half |
cacheMs |
30000 |
upstream cache and single-flight window |
apiKeyEnv |
DEEPSEEK_API_KEY |
resolved via ctx.credentials, then env |
baseUrl |
https://api.deepseek.com |
provider base URL |
baseUrlEnv |
DEEPSEEK_BASE_URL |
env var overriding baseUrl |
Compatibility
- Host: Node >= 18, no imports, so it loads from any path. Prefers
ctx.connection.fetch.registerand falls back toctx.webServer.register. Key resolution usesctx.credentialswhen present. - Browser: requires only the seeded React module and the
slotsservice. Preferred seat isconversation.session.header.utilities, thenconversation.session.header.corner;sidebar.footer.actionis a delayed (4s) fallback, so the pill never pre-empts the header on a normal boot. Token usage needs the session-scopeduseProjectionhook; without it the balance still renders. - No platform-specific code, so it is machine independent.
Verify
node tools/verify.mjs --port 3080 --home ~/.dsh
Reports boot-graph presence, the HMR channel, and the served bundle features.
Uninstall
Remove the usage-panel insert row from the profile patch and delete <home>/plugins/dsh-usage-panel.
Author
Mysterious Mark
License
Links
More in this category
bowenliang123/dsh-context★ 4288
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 635
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 289
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 201
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 188
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 115
Personal center for DeepSeek Harness: cross-session usage statistics with per-provider and per-model breakdown (auto-discovers configured models), per-model cost estimation, global custom instructions, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.