Skip to content
dsh-market Browse plugins GitHub 中文

kai-GitHubaccount/dsh-usage-panel

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.

Stars ★ 0 Category Usage & Billing Listed 2026-09-22

Install

Inside DeepSeek Harness, with dsh-market

dsh plugin --profile web add dshmarket

Or from the command line

dsh plugin --profile web add github:kai-GitHubaccount/dsh-usage-panel

Installing runs third-party code with your own permissions — it can read your files, use your credentials and reach the network. Review the source first, and pin a commit (github:owner/repo#sha) when you can.

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).

Panel preview

Features

  • Balance from the official GET /user/balance (total / topped-up / granted).
  • Token usage from the host tokenUsage projection: 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.fetch and falls back to ctx.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.register and falls back to ctx.webServer.register. Key resolution uses ctx.credentials when present.
  • Browser: requires only the seeded React module and the slots service. Preferred seat is conversation.session.header.utilities, then conversation.session.header.corner; sidebar.footer.action is a delayed (4s) fallback, so the pill never pre-empts the header on a normal boot. Token usage needs the session-scoped useProjection hook; 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

MIT

Content from the project README on GitHub ↗

Comments

Comments live in GitHub Discussions. Sign in with GitHub to post or react.