dsh-balance: Check DeepSeek Account Balance in Conversation

In DeepSeek Harness, checking the account balance typically requires opening a browser panel or navigating to a settings page, which interrupts the current session’s workflow. The dsh-balance plugin registers the /balance command to read and display DeepSeek account balance information directly within the session, eliminating the need to leave the current terminal or chat window.

Plugin Positioning

dsh-balance is a client-side plugin maintained by DWJZ. It integrates DeepSeek’s account balance inquiry functionality into the session interaction, supporting the viewing of available balances, top-up amounts, and bonus amounts.

Core Functions

  1. Command Registration: Registers the /balance command. The output is treated as the command’s own text and rendered directly in the originating session, rather than being sent to the model.
  2. Balance Reading: Reads the account balance via GET {baseUrl}/user/balance, reporting the breakdown of funds between top-ups and bonuses.
  3. Cache Control: Supports the /balance refresh command to bypass the cache and force a re-read.
  4. Key Resolution: Supports specifying apiKey directly via the config file or using apiKeyRef (defaulting to DEEPSEEK_API_KEY) to reference credentials or environment variables, facilitating key rotation.
  5. Error Handling: Upon a read failure, displays the last successfully read balance and indicates the status, rather than hiding known balance information.

Installation

Use the official installation command to add the plugin:

dsh plugin --profile web add github:DWJZ/dsh-balance

Configuration and Usage

This plugin requires configuration in cordis.patch.yml to function correctly. The configuration file path is typically $DSH_HOME/profiles/<profile>/cordis.patch.yml.

Sample configuration:

- id: dsh-balance
  config:
    apiKey: ''                        # Explicit key; uses apiKeyRef if left empty
    apiKeyRef: DEEPSEEK_API_KEY       # Credential reference or environment variable name
    baseUrl: https://api.deepseek.com
    timeoutMs: 10000
    cacheMs: 30000                    # Cache validity duration in milliseconds

Usage Examples:

  1. View current balance:
    /balance
    (Sample output: DeepSeek account balance (available), CNY total balance ¥293.58 · Top-up ¥293.58 · Bonus ¥0.00, read at 2026/9/18 13:20:41)

  2. Refresh balance (bypass cache):
    /balance refresh

Notes

  • Dependencies: This plugin depends on @deepseek-ai/cordis.
  • Configuration Requirements: Key information in cordis.patch.yml must be configured correctly to enable reading.
  • Caching Mechanism: The cache validity is 30000 milliseconds; the refresh command overrides this limit.
  • License: MIT License.
  • Ecosystem Background: The DeepSeek Harness philosophy is “Everything is a plugin.” This is a community-maintained project and is not officially affiliated with DeepSeek or High-Flyer.

Summary

dsh-balance simplifies the balance management process through a simple command-line interface. For developers who need to frequently monitor their account financial status, this is a highly integrated and practical tool. For more details, please refer to the GitHub repository.

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

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

Xiaoye