dsh-plugin-balance-float: Display DeepSeek API Balance in the Corner of the DSH Web Interface

Preface

When using DeepSeek Harness (DSH) to run the Web GUI, conversation and page state consume the screen, but checking the balance requires looking elsewhere. DeepSeek’s /user/balance requires a Bearer key, direct browser connections are blocked by CORS, and embedding the Key into the frontend is inappropriate. The following introduces the community plugin dsh-plugin-balance-float (repository Yochor-Debug/dsh-float): it injects a draggable floating capsule into every index.html of the Harness Web, fetching the balance via a same-origin proxy without occupying session context.

What is this

dsh-plugin-balance-float (npm package name, current version 1.1.1, MIT) is maintained by Yochor-Debug and targets developers who have enabled the DSH Web profile. It displays the remaining balance and peak/off-peak billing hints in a corner of the page. Clicking expands details, and double-clicking or clicking the button inside the panel refreshes immediately. The Host side provides a GET /x-balance-float proxy; the browser only accesses a same-origin path, and keys do not appear in any response.

Core Features

Display & Interaction

  • Appears and disappears with the page: Injected by the Host into every rendered index.html, not bound to a specific session, and does not consume conversation context.
  • Collapsed: Balance + status dot (Green / Amber / Red indicating Healthy / Low / Exhausted). A small label on the side indicates whether the current hour is billed at Peak or Off-peak; a ▼ hint indicates it can be expanded. No popover on hover; details only open upon clicking.
  • Expanded: Total amount, gifted and topped-up balances, and last refresh time; click the capsule again or click the blank area to close.
  • Double-click (works whether collapsed or expanded) refreshes immediately, with the ↻ icon rotating as feedback; the ↻ in the expanded panel works the same.
  • Auto-polls every 5 seconds; pauses when the tab is hidden and refreshes once on the first frame when it becomes visible again.
  • Draggable, limited to the viewport, position saved to localStorage, follows the system light/dark theme.
  • The component resides in a closed shadow root, outside the SPA’s React tree, and does not interfere with the main application styles.

Peak / Off-peak Label

According to DeepSeek’s official pricing documentation: Peak hours are UTC Monday to Friday 01:00–04:00 and 06:00–10:00 (approx. 09:00–12:00 and 14:00–18:00 Beijing Time on weekdays); all other times are off-peak, and weekends are off-peak all day. The browser calculates based on UTC, independent of the machine’s timezone, and recalculates every 5 seconds during refreshes. Mainland China public holidays are not modeled: If a statutory holiday falls on a workday, the label may still show “Peak,” while billing is actually at off-peak rates; this is explained in the tooltip.

How Host Reads Keys

Resolves in order for every request (no long-term caching):

  1. Environment variable DEEPSEEK_API_KEY
  2. Harness credential service ctx.credentials.resolve('DEEPSEEK_API_KEY')
  3. Fallback to read $DSH_HOME/.credentials.yaml

Installation & Enablement

Environment Requirements: DeepSeek Harness >= 0.1.5-rc.2 (profile bundle mechanism), Node.js >= 18, and a DeepSeek API Key configured locally (environment variable or refs.DEEPSEEK_API_KEY in $DSH_HOME/.credentials.yaml).

Installation (commands from the official README):

dsh plugin --profile web add dsh-plugin-balance-float

After installation, you must restart dsh web before refreshing the page. A running dsh synthesizes the profile list once at startup; newly installed plugins are not automatically loaded by already-started processes.

Uninstallation:

dsh plugin --profile web remove dsh-plugin-balance-float

It can be enabled or disabled like other global plugins in Settings → Plugins → Plugin List → Global Plugins.

Typical Usage

  1. Install and restart dsh web as described above, open the Web GUI, and the balance capsule should appear in the corner.
  2. Single click to view total amount, itemized balances, and refresh time; double-click the capsule or click the panel ↻ to force a refresh.
  3. Drag it to a position that doesn’t block operations; the position will be remembered.
  4. When developing the plugin package itself, you can use the verification scripts in the repository (requires a running local Web service to test peak/off-peak boundaries):
node tools/verify-package.mjs
node tools/verify-tariff.mjs http://127.0.0.1:3931/

The Host re-reads lib/client.js every time it renders the index; if installed from GitHub/npm, modifying the widget requires publishing and reinstalling; for link: installations, simply modify the workspace and refresh the page.

Use Cases & Notes

Suitable for: Those who debug or run agents in the DSH Web GUI for long periods, want to see the balance and current peak/off-peak status at a glance, but do not want to expose the API Key to the browser.

Notes:

  • The plugin runs with the current dsh process permissions. Please review the source code and MIT license yourself before installation.
  • Balance data comes from the DeepSeek interface and is subject to its caching and reporting latency; for multi-currency accounts, only the first currency returned by DeepSeek is displayed.
  • The community directory SkillHub Plugin Page has no official affiliation with DeepSeek or High-Flyer; the DSH ecosystem is “everything is a plugin,” this package is a patch on the Web profile, not a built-in feature of the official app store.

Conclusion

dsh-plugin-balance-float uses a Host proxy + floating UI to place DeepSeek balance and peak/off-peak hints in the corner of the Web GUI. Click to expand, double-click to refresh, without touching the session context. If needed, obtain package information and documentation from the SkillHub directory page or the GitHub repository (including README.zh.md).

  • Directory Page: https://www.skillhub.cn/plugins/Yochor-Debug/dsh-float
  • GitHub: https://github.com/Yochor-Debug/dsh-float
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye