Preface

When running sessions on DeepSeek Harness Web, a common requirement is to view several types of information together: how much balance is left in the current DeepSeek account, how much the current session cost, how much has been spent recently, and how much different models consumed. These pieces of information are scattered across the DeepSeek platform, Harness local logs, and manual statistics, making it inconvenient to check directly.

Below is an introduction to dsh-balance-stats. It is a community plugin for DeepSeek Harness Web, maintained by pangzi499, and uses the MIT license. It will provide balance, current session cost estimation, usage details, and an optional invoice summary import in Harness Web.

What is This

The positioning of dsh-balance-stats is: a balance and usage statistics plugin for DeepSeek Harness Web.

The core problem it solves is: viewing DeepSeek balance, current session cost, historical spending, model consumption, and token usage centrally in the Harness Web interface, and supporting calculating total spending closer to ledger standards by importing invoice information.

Note: This is a community plugin, not the official @deepseek-ai plugin.

Core Features

Balance Display

The plugin reads the official DeepSeek balance API and displays available balance, top-up balance, and bonus balance.

Current Session Cost Estimation

The plugin estimates the cost of the currently active session in real-time via the balanceStatsSessionCost projection. The scope here is bound to the composer.

Total Spending Display

After importing an invoice, the plugin uses a ledger-based percentage to display total spending. If no invoice is imported, it falls back to Harness local estimation.

Detail Card

Clicking the status bar opens the detail card. The card displays:

  • Today’s spending
  • Last 7 days / 30 days spending
  • Spending by model
  • Token usage
  • Last update time
  • Invoice import entry

Invoice Import

The plugin supports two invoice import methods:

  1. Automatic Import: After saving the platform userToken in the detail card, the plugin will periodically re-fetch invoices.
  2. One-time JSON Import: Manually paste the get_all_invoice response JSON as a fallback method.

Automatic import supports credential persistence and also supports one-click clearing.

Fault Tolerance & Refresh

When a request fails, the plugin retains the last successfully retrieved balance or invoice information. The plugin also supports refreshing data at a configurable interval.

Installation & Enablement

Before installation, confirm that Node.js and pnpm are available:

node -v
pnpm --version

Requirements: Node.js >=22.19.0 and pnpm available in PATH.

After confirming the environment, execute the following command to install the plugin:

npx @deepseek-ai/dsh plugin --profile web add https://github.com/pangzi499/dsh-balance-stats.git

After installation, start or restart Harness Web:

npx @deepseek-ai/dsh web

After starting, perform a hard refresh in the browser and look for the plugin entry in Harness Web.

If you want to update the plugin, execute:

npx @deepseek-ai/dsh plugin --profile web update dsh-balance-stats

Typical Usage

Open Detail Card

After installing and refreshing the page, click the status bar provided by the plugin to open the detail card.

In the card, you can see balance composition, billing summary, spending by model, token usage, and invoice import related configurations.

Use Automatic Invoice Import

If using automatic import, follow these steps:

  1. Open the detail card.
  2. Paste the platform userToken.
  3. Click Save.

After saving, the plugin will periodically re-fetch invoices. Credentials are written to the local Harness credentials file:

~/.dsh/.credentials.yaml

File permissions are 0600.

You can also one-click clear saved credentials in the detail card.

Use Manual JSON Import

If you don’t want to save userToken, you can use the one-time JSON import:

  1. Expand Advanced in the detail card.
  2. Paste the complete get_all_invoice JSON response.
  3. Execute import.

Manually pasted JSON is only parsed in memory. Browser-side localStorage fallback summary only saves aggregated information, not order details.

Configure Token via Credentials

In addition to manual pasting, you can also provide tokens via Harness credentials or configuration items:

DEEPSEEK_PLATFORM_TOKEN

You can also configure in:

cordis.patch.yml

Under:

platformToken

Or use a similarly named environment variable.

Applicable Scenarios & Notes

Who is it for

If you are already using DeepSeek Harness Web and want to view in the same interface:

  • DeepSeek balance
  • Current session cost estimation
  • Last 7 days / 30 days spending
  • Spending by model
  • Token usage
  • Total spending after importing invoices

Then dsh-balance-stats is suitable.

Notes

  1. This is a community plugin, not the official @deepseek-ai plugin.
  2. The plugin requires Node.js >=22.19.0 and pnpm available in PATH.
  3. The plugin has been tested within the DeepSeek Harness range 0.1.0-rc.6 to 0.1.1-rc.1.
  4. DeepSeek Harness is currently in developer preview, so the client API or mount points used by the plugin may change in future versions.
  5. By default, the plugin does not request get_all_invoice and does not save DeepSeek Platform credentials.
  6. The plugin will only write to the local credentials file after explicitly saving userToken:
   ~/.dsh/.credentials.yaml

File permissions are 0600.

  1. The plugin does not accept or save DeepSeek Platform cookies. Tokens are only sent to:
   platform.deepseek.com
  1. get_all_invoice is a private, authenticated DeepSeek Platform interface, and the response format may change.
  2. Only top-up orders with payment_order_status set to SUCCESS are counted; valid bonus orders are accumulated separately.
  3. The DSH plugin runs alongside the current dsh process. You should check the source code and license before installing. This plugin is licensed under the MIT license.

Summary

dsh-balance-stats brings DeepSeek balance, current session cost, model usage, and invoice import together into DeepSeek Harness Web, suitable for users who want to perform daily cost checks within the Harness interface.

GitHub Repository:

https://github.com/pangzi499/dsh-balance-stats