Introduction

The core philosophy of DeepSeek Harness (DSH) is that “everything is a plugin.” When developing or using DSH, real-time awareness of the API balance is a basic need. A common approach in the market is to rely on local estimation, but this method can be affected by price list changes and is often not precise enough. The dsh-balance plugin directly calls DeepSeek’s official GET /user/balance endpoint, displays the real balance in the account currency, and provides instant feedback in the sidebar.

Core Features

This plugin mainly provides the following capabilities:

  • Official data verification: Directly calls the official API endpoint and returns the real balance after verifying the API key.
  • Instant push: Uses SSE long-lived connections to push data and displays it on the screen within 1 second; a 15-second polling interval is also provided as a fallback mechanism.
  • Low balance alert: When the balance falls below the threshold, the number turns orange.
  • Bilingual support: The text automatically switches according to the interface language.
  • Zero dependencies: No npm runtime dependencies.

Installation

Run the following command in the terminal to install the plugin:

dsh plugin --profile web add @pengpeng6845/dsh-balance

Configuration and Usage

After installation, you need to override the configuration by id in the profile’s cordis.patch.yml file. Also, make sure that the environment variable DEEPSEEK_API_KEY is set correctly.

Add the following configuration to cordis.patch.yml:

- id: balance
  config:
    balanceEnabled: true              # 是否轮询官方余额端点
    balanceApiKeyEnv: DEEPSEEK_API_KEY # 余额 API key 的凭据引用(环境变量名)
    balanceBaseUrl: https://api.deepseek.com
    balanceRefreshMs: 60000           # 兜底轮询间隔(毫秒)
    lowBalanceAlert: 5                # 低余额警戒线(账户币种单位)

Display and Status

  • Display: Shown at the bottom of the sidebar in a one-line, flat, native-style format (no card, no border).
  • Status: During backoff after a network failure, the data is displayed in gray, but the last successful value is still retained. Polling automatically pauses when the tab is not visible.

Notes

  • The balance is displayed in the account currency, with no currency exchange rate conversion.
  • No cost estimation is performed; only real data is displayed.
  • This plugin runs with dsh process permissions. Check the source code and license before installing.

Conclusion

dsh-balance is a lightweight tool suitable for users who need precise monitoring of their API balance. Its zero dependencies and official data source ensure data reliability.

  • Maintainer: PengPeng6845
  • License: MIT
  • Catalog page: https://www.skillhub.cn/plugins/PengPeng6845/dsh-balance
  • Source code: https://github.com/PengPeng6845/dsh-balance