Preface

In the DSH plugin ecosystem, the community plugin directory is an independent site and is not equivalent to the official app store. If your dsh session is already connected to the DeepSeek Open Platform but lacks balance and current session cost prompts, you can install dsh-balance.

It is used for the Host + Web Client of deepseek-harness to query DeepSeek Open Platform account balance and estimate the current session cost.

What This Is

dsh-balance is a plugin for DeepSeek Harness (DSH), with the repository LemCAE/dsh-balance, the npm package name @lemcae/dsh-balance, and the MIT license.

It mainly solves two types of problems:

  1. View the DeepSeek Open Platform account balance.

  2. Estimate the cost consumption of the current session based on local session logs.

Core Features

Query Balance

The plugin queries the official DeepSeek Open Platform balance endpoint:

GET https://api.deepseek.com/user/balance

During the call, the API key is only passed through the bounded node subprocess stdin and does not appear in the command line, logs, or UI.

Estimate Current Session Cost

The plugin estimates the cost consumption of the current session based on the usage in the session logs and calculates pricing according to Beijing timezone peak/off-peak rates.

The estimate is for reference only; the official bill prevails.

Session Header Chip

After opening any session, the top of the session displays:

Balance ¥x | Session ≈¥y

Click the chip to refresh, and hover to show details.

Settings Page

In Settings → DeepSeek Balance, you can view the balance and manage:

  • Auto-refresh toggle
  • Refresh interval
  • UI language
  • Editable price table

Model Tool

The plugin provides a model tool:

deepseek_balance

This tool takes no arguments and returns the balance and the estimated cost of the calling session.

Pause-Aware Refresh

After two consecutive refreshes with no new messages, automatic refresh pauses.

It resumes when a new session appears.

While paused, it probes once every 5 minutes, and recovery may be delayed by up to that interval.

Self-Contained Deployment

Deployment does not require modifying the host repository.

Communication is performed through the built-in commands Remote namespace.

Installation

Run:

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

The host needs to provide peer dependencies, including:

@deepseek-ai/cordis ^4.0.1
@deepseek-ai/* ^0.1.0-rc.5
react

Typical Usage

The common entry points are listed below.

  1. Session Header

View:

Balance ¥x | Session ≈¥y

Click to refresh, hover to view details.

  1. Settings Page

Navigate to:

Settings → DeepSeek Balance

Manage balance, automatic refresh interval, auto-refresh toggle, UI language, and price table.

  1. Command

The command can be used:

/dsh-balance [refresh | interval <milliseconds> | prices <JSON> | language <auto|zh-CN|en> | auto-refresh <on|off>]
  1. Model Tool

Have the model call:

deepseek_balance

Notes and Limitations

Cost estimation is based on local session logs and may differ from the official bill.

The official bill prevails.

The following limitations should be noted:

  • Unknown models are priced using default (v4-flash rate).
  • Subagents have independent session IDs and are not included in the estimate.
  • Compaction may cause the estimate to retain the total before compaction.
  • Each automatic refresh appends command/run and command/done events; the pause mechanism can reduce noise.
  • The balance is cached for 10 seconds, and the tool and chip may share a single API call.

The plugin runs with the permissions of the current dsh process. Before installation, you should review the source code, dependencies, and MIT license.

Links

Repository address:

https://github.com/LemCAE/dsh-balance