Introduction

When developing with DeepSeek Harness (DSH), monitoring the API balance and understanding the current pricing period (peak and off-peak) are part of daily operations. The dsh-balance plugin addresses these two issues by providing a persistent widget in the Web interface, allowing you to check your balance status and pricing period without switching pages.

What Is This

dsh-balance is a DSH plugin maintained by qianmoyishu. It provides a persistent widget for the DSH Web interface to display the DeepSeek API balance in real time and offer visual hints based on Beijing Time peak and off-peak pricing rules.

Core Features

  1. Persistent draggable widget
    The widget is displayed in the top-right corner of the interface by default. You can hold its header and drag it to any location. The position is automatically saved to the browser’s localStorage and remains after refreshing the page or restarting the service. It is mounted in the shell.overlay root slot, does not occupy sidebar slots, and does not conflict with other plugins (such as pets) in position.
  2. Collapse and expand
    Click “–” in the widget header to collapse it. In the collapsed state, it appears as a dot and displays only the total balance and the peak period symbol; click “▸” to expand and display the full information.
  3. Balance display
    When expanded, the widget displays the total balance, top-up balance, bonus balance, and last update time.
  4. Auto-refresh and countdown
    The widget automatically refreshes balance data every 60 seconds. For peak periods, it displays a countdown to switching to the off-peak period or the next peak period. Hover over it to view the full period description.
  5. Peak period hint
    Based on the configured PEAK_WINDOWS (default is 09:00-12:00 and 14:00-18:00 Beijing Time), it displays the current period in real time:
    - Red: peak period
    - Green: off-peak half-price period
  6. Server-side proxy
    Balance queries are made through the server-side proxy endpoint /api/balance. DEEPSEEK_API_KEY is resolved only within the server process and is not exposed to the browser side, ensuring key security.

Installation and Enablement

  1. Install the plugin
    Run the following command in a terminal to install it:
   dsh plugin --profile web add "https://github.com/qianmoyishu/dsh-balance/releases/latest/download/dsh-balance-0.2.1.tgz"
  1. Configure API key
    In the DSH Web interface, go to “Settings” → “Models”, or configure DEEPSEEK_API_KEY in environment variables. If not configured, the widget will show a prompt but will not report an error.
  2. Restart the service
    After installing or updating the plugin, you must restart the dsh web service and refresh the page for the plugin to take effect.

Typical Usage

  1. Drag position
    Hold the widget header and drag it to the location on the screen that is most convenient for you to view.
  2. Collapse to view
    Click “–” in the header to collapse the widget and quickly view the current total balance and whether it is a peak period.
  3. Expand to view
    Click “▸” in the header to expand the widget and view the detailed balance breakdown and remaining time.

Applicable Scenarios and Notes

  • Applicable scenarios: Developers who need to continuously monitor the DeepSeek API balance during development and want to understand intuitively whether they are currently in a high-pricing period.
  • Time zone dependency: Peak period calculations are based on the Asia/Shanghai time zone and do not depend on the local system time zone.
  • Custom configuration: To modify the peak period definitions, edit the PEAK_WINDOWS constant at the top of the source file lib/client.js.
  • Development environment: In local source development mode, you need to restart dsh web after code changes for them to take effect.

Conclusion

dsh-balance provides intuitive balance monitoring and pricing hints, reducing the need for manual queries and page switching. The plugin is maintained by a community developer and follows the MIT license. For more details, refer to the plugin directory or source repository.