The Web interface of DeepSeek Harness (DSH) currently has no native way to view the API balance or the exact consumption of the current conversation. Developers usually need to manually switch to the official platform or inspect the logs. The dsh-web-api-balance plugin solves this by providing a persistent capsule next to the input box; hover over it to expand and view the account balance and the consumption breakdown for the current conversation.

This is a client-side plugin maintained by Charaaah. By persistently displaying a balance capsule in the input box toolbar and supporting hover-to-expand details, it addresses the need to monitor API usage and costs in real time during development.

Core Features

  1. Persistent Balance Capsule: Displays the total DeepSeek API balance in the input box toolbar.
  2. Hover to Expand Details:
    - The left panel shows the account balance (total balance, gift balance, update time).
    - The right panel shows the consumption of the current conversation (including cache hits, cache misses, and output tiers).
  3. Automatic Peak/Off-Peak Detection: Automatically switches pricing tiers based on specific time periods on weekdays (9:00–12:00 and 14:00–18:00 Beijing Time).
  4. Top-up Entry: A top-up area slides out to the right of the capsule, preferring the top-up address from the account service, or falling back to the official platform address.
  5. Multiple Credential Sources: Supports obtaining the balance from account authorization, a saved API key, or an environment variable.
  6. Balance Caching: Supports configuring a cache window (refreshSeconds) to avoid frequent API requests.
  7. Technical Implementation: No build steps and no external dependencies.

Installation and Configuration

Installing the plugin requires the official installation command; pinning the version number is recommended.

dsh plugin --profile web add dsh-web-api-balance@1.0.5

After installation, enable and configure the parameters in the Web Profile configuration file. The configuration file is located at ~/.dsh/profiles/web/cordis.patch.yml:

- id: dsh-web-api-balance
  disabled: false
  inject: [webServer]
  config:
    apiKey: ''                       # 单独指定 key 时填 sk-...(优先级最高)
    apiKeyEnv: DEEPSEEK_API_KEY      # 否则用这个凭证引用 / 环境变量名
    baseURL: https://api.deepseek.com
    refreshSeconds: 300              # 缓存窗口,30-86400 秒

The plugin resolves credentials in the following order: “account authorization” → config.apiKey → the apiKeyEnv from the credential service → the same-named environment variable.

Uninstallation and Cleanup

Use the following command to uninstall the plugin:

dsh plugin --profile web remove dsh-web-api-balance

This command only removes the package and deletes the dependency in package.json. For a complete uninstall, manually edit ~/.dsh/profiles/web/package.json and delete the dependency line. In addition, uninstalling does not remove DEEPSEEK_API_KEY from ~/.dsh/.credentials.yaml, nor does it delete the dsh-web-api-balance:last cache data in localStorage.

Notes

  • Privacy and Security: The plugin does not contain any credentials and does not send data anywhere. The API key is read only at runtime from the configuration or credential service and does not enter the browser environment (requests are forwarded via host.js).
  • Pricing Table: The pricing table is hard-coded and does not include prices for unknown models.
  • Cumulative Usage: It displays the cumulative usage of the current conversation, does not include sub-agents, and is not the account’s historical billing records.
  • Holidays: Peak/off-peak detection is based on Beijing Time and does not account for statutory holidays. Workdays falling on statutory holidays will still show peak pricing tiers.

Summary

dsh-web-api-balance provides a lightweight balance-monitoring capability for the DSH Web interface. Through the capsule display and hover details, developers can intuitively understand the current API balance and the token consumption of the current conversation. Source code and documentation are available on GitHub.