Introduction

When calling the DeepSeek API in DSH, account balance, peak/valley pricing periods, and the approximate cost of the current session are usually scattered across the interface, console, and pricing rules. dsh-balance-monitor is a DSH plugin maintained by Rainronin. The goal is to bring this information into the dsh session and sidebar.

It is a DSH plugin from the community directory, not an official product from DeepSeek or Horizon. The philosophy of DSH is “Everything is a plugin”, and this plugin is also installed and composed into the profile as a community plugin.

Plugin Positioning

dsh-balance-monitor is a DeepSeek API balance real-time monitoring plugin with an MIT license.

It provides the following capabilities:

  • Official /user/balance interface balance snapshot
  • ds_balance session query tool
  • Beijing Time peak/valley pricing status
  • Single-session cost estimation
  • dsh native style sidebar badge

Core Capabilities

Balance Snapshot and Session Query

The plugin uses the official /user/balance interface to obtain a balance snapshot and provides the ds_balance tool, allowing the agent to query the balance within the session.

ds_balance supports cache bypass:

force: true

The plugin provides dsh native style sidebar badges:

  • Badge located at the bottom of the sidebar next to Settings
  • Supports a refresh button that forces cache bypass when clicked
  • Default 30s auto-polling
  • Collapsed state shows a status light
  • Supports multi-currency display, listing CNY/USD with CNY prioritized

Status light meaning:

  • Green: Normal connection
  • Yellow: Degraded

Peak/Valley Pricing Status

The plugin will display the Beijing Time peak/valley pricing status:

  • Peak: Displays Peak HH:MM:SS, with a countdown to the idle phase
  • Idle: Displays Idle

Official peak/valley pricing took effect on August 17, 2026, 00:00 Beijing Time; prior to this was a preview.

Single-Session Cost Estimation

The plugin estimates single-session costs based on the DeepSeek V4 peak/valley pricing.

Keys and Request Strategy

The plugin reuses DEEPSEEK_API_KEY and does not require separate key configuration. Relevant materials claim it does not write to disk, does not print logs, and does not cache.

Request strategy includes:

  • 30s TTL cache
  • Serial requests
  • 5s timeout

The plugin also supports optional per-round injection: injecting balance into the model context. This capability is disabled by default; when enabled, it only reads from cache and claims not to block the conversation.

Installation and Enablement

Install in web profile:

dsh plugin --profile web add @rainronin/dsh-balance-monitor

After installation, the plugin is automatically added to dsh.profile.bundles. You can view the combined configuration:

dsh --profile web --dump-config

When installing from GitHub, if pnpm blocks the prepare build script, you need to add allowBuilds to $DSH_HOME/profiles/<profile>/pnpm-workspace.yaml as prompted and retry.

Typical Usage

Query Balance in Session

You can ask the agent directly:

Check my DeepSeek balance

Or:

查一下 DeepSeek 余额

View Sidebar Badge

The sidebar badge will display the balance and status.

  • Click the refresh button to force cache bypass
  • Collapsed state shows a single status light: green means normal connection, yellow means degraded
  • Peak status displays Peak HH:MM:SS with a countdown to the idle phase
  • Idle status displays Idle

Overriding Configuration

You can override configuration in the profile’s cordis.patch.yml, such as cacheTtlMs and pollIntervalMs:

- id: balance-monitor
  config:
    cacheTtlMs: 10000
    pollIntervalMs: 10000

The example above sets both the cache TTL and polling interval to 10000 ms.

Abnormal Status

When key is not configured:

  • Tool returns Chinese prompt
  • Badge shows key not configured

API fails and has old cache:

  • Returns the last snapshot
  • Marked as expired

API fails and no cache:

  • Show the real failure reason
  • Badge shows no signal

Applicable Scenarios and Notes

This plugin is suitable for people calling the DeepSeek API in DSH who wish to view balance, peak/valley pricing status, and single-session cost estimates.

Notes before use:

  • Plugin runs with the permissions of the current dsh process
  • You should check the source code and license before installing; current data shows the license is MIT
  • Without DEEPSEEK_API_KEY configured, real balance cannot be obtained
  • Per-round injection is disabled by default; primarily queries via badge and ds_balance tool
  • The DSH community directory is an independent site and has no official affiliation with DeepSeek/Horizon

Related Links

  • GitHub: https://github.com/Rainronin/dsh-balance-monitor
  • Directory page: https://www.skillhub.cn/plugins/Rainronin/dsh-balance-monitor, provided by Plugin Clues.