DSH-DeepSeek-Balance: View Balance, Usage, and Peak-Valley Price Alerts in Harness Web

Preface

When running the web profile in DeepSeek Harness (DSH), model invocations consume platform account balance. Checking billing solely on the DeepSeek Open Platform webpage requires switching context; meanwhile, the Harness side lacks a unified view of balance and usage. The community plugin dsh-deepseek-balance (repository DSH-DeepSeek-Balance, maintained by OwlNjust) provides a floating widget at the bottom-right corner of the browser, polling the official API to display balance and periodic consumption, and marks peak-hour “Liang Wenfeng” and off-peak “Liang Wengu” windows according to the official pricing documentation. The following sections cover its positioning, capabilities, and installation usage.

What Is This

dsh-deepseek-balance is a networking-class plugin designed for the DeepSeek Harness web profile: zero npm runtime dependencies, integrated via the Harness plugin manager through GitHub packages or local linking. It displays a draggable “pill” summary at the bottom-right of the page, which expands to allow configuring the API key, selecting the statistical time window, and manual refresh; the server periodically pulls DeepSeek’s official balance / usage APIs, with state persisted in a local configuration file.

Core Features

All capabilities below are drawn from the repository README and package.json descriptions (current package version 0.2.0, MIT license).

Balance and Usage

  • Retrieves total balance and recharge balance via the official GET /user/balance, polling every 5 minutes by default.
  • Periodic consumption: supports today, 24 hours, 7 days, or a custom start date, broken down by model (/usage/cost).
  • Token usage: cache-hit input, cache-miss input, output, consistent with the platform console metrics (/usage/amount). You may optionally provide the platform userToken to obtain more precise cost and token statistics; when not configured, consumption estimates fall back to the balance snapshot method.

Peak/Off-Peak Price Alerts

  • Liang Wenfeng (peak hours): Monday to Friday in Beijing Time, 09:00–12:00 and 14:00–18:00, excluding statutory holidays, priced at base ×2.
  • Liang Wengu (off-peak hours): all other times, including weekends and statutory holidays throughout the day, priced at 50% of the base price.
  • The interface provides the current window and countdown; peak hours are highlighted, holidays are marked. Window rules follow DeepSeek official pricing documentation.

Interaction and UI

  • Right-click and hold the pill to drag its position; left-click to expand the panel; the panel includes a “Reset position (bottom-right)” option.
  • Language follows Harness or the browser; the panel header bar allows manual switching between Chinese/English with local memory.
  • Auto-refresh pauses when the tab is hidden; after expanding the panel, you can click “Refresh” to pull data immediately.

Server APIs

  • The plugin registers four routes under /dsbal/*, which require prior validation of the Harness session with the same Host/Origin as /api; unauthenticated requests return 401, cross-site requests return 403. Optional verification: curl -s http://127.0.0.1:3080/dsbal/state (interpret the result under the premise that the web service is running and the session is logged in).

Environment and Dependencies

  • DeepSeek Harness deployed, using the web profile (dsh web).
  • Node.js ≥ 20. The README notes compatibility verification on v0.1.2-rc.1, retested through v0.2.0-rc.2, with no usage changes to the plugin itself across versions.
  • DeepSeek API key (platform.deepseek.com → API keys).
  • Optional: userToken (platform.deepseek.com → DevTools → Application → Local Storage).

Installation and Activation

Installation requires just one step: hand the repository URL to the Agent, or let the plugin manager add the same address. The package declares dsh.bundle.patch; for Harness ≥ 0.2.0, the profile bundle route is recommended, eliminating the need to manually edit patch files.

Route A (Recommended)

Desktop: Menu bar → “Manage plugins” → enter:

https://github.com/OwlNjust/DSH-DeepSeek-Balance

CLI (replace <profile> with the actual profile name, e.g. web):

dsh plugin --profile <profile> add https://github.com/OwlNjust/DSH-DeepSeek-Balance

The manager writes the package into the profile’s dsh.profile.bundles and applies the bundled cordis.patch.yml to activate the plugin. After reloading or restarting the profile, the widget should appear at the bottom-right corner.

Do Not Mix the Two Installation Methods

If Route A has been used, do not manually write a same-named insert into the profile’s cordis.patch.yml, otherwise the plugin id may be inserted twice, causing difficult troubleshooting. Self-check (result should be 1):

dsh --profile web --dump-config | grep -c 'id: dsh-deepseek-balance'

If the output is 2, follow the README “Agent notes” to delete the manually written block or remove one from bundles, then restart dsh web.

First-Time Configuration

After a hard refresh of the page (e.g. Ctrl+Shift+R), click the widget → Configure → paste API key (optional userToken) → Save. Credentials and balance history are written to ~/.deepseek-balance.json (permission 0600); do not echo the file contents in logs or terminals.

Uninstallation

Remove the corresponding line from cordis.patch.yml (if installed only via bundle, remove the bundle through the manager flow), delete node_modules/dsh-deepseek-balance under the profile, and restart dsh web.

Typical Usage

Operation Location
API key / userToken Widget → Configure
Statistical time window Chips in the widget: Today / 24h / 7 days / Custom
Refresh “Refresh” button; or auto-polling via pollIntervalMs (default 5 minutes)
Language Follows host or browser; panel header bar EN/中 allows manual switching
Summary Bottom-right pill: current price window + balance + periodic spend

At the profile’s patch layer, you can override configuration for the plugin id (config: replaces the entire object; unlisted fields use defaults). Example fields:

- id: dsh-deepseek-balance
  config:
    pollIntervalMs: 900000     # Polling interval, 30s .. 24h, default 5 min
    historyDays: 180           # Snapshot retention / custom window upper limit, 1 .. 400, default 90

Use Cases and Notes

Who It’s For

  • Agent developers who work or debug in DSH web long-term and want to monitor balance and recent consumption without leaving the Harness page.
  • Users who need to control batch invocation costs against official peak/off-peak hours (alerts are based on official documentation, not Harness built-in capabilities).

Security and Permissions

  • The plugin runs with the same permissions as the current dsh process and makes HTTPS requests to the DeepSeek platform on your behalf; before installation, you should review the GitHub source code and MIT license to confirm acceptance of the local credential storage method.
  • Routes that write credentials are only accessible to authenticated local browser sessions; still, do not expose the web console in untrusted environments.

Ecosystem Notes

DSH adopts an “everything is a plugin” extension approach; the SkillHub catalog page is a community listing, with no official affiliation to DeepSeek / High-Flyer.

Conclusion

dsh-deepseek-balance consolidates DeepSeek account balance, per-model consumption, token breakdowns, and peak/off-peak price windows into the bottom-right corner of Harness web, ready to use once the API key is configured. For further details, visit the catalog page and repository:

羽毛球分组比赛记分
小程序二维码

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

Xiaoye