Preface

When calling the DeepSeek API in DSH, balance and token usage typically require querying a separate interface or searching through session logs. dsh-balance-plugin integrates these two types of information into the bottom of the DSH web sidebar, providing a Today / All-time toggle, and only aggregates data from deepseek-official to avoid mixing calls from other providers into the same dataset.

What is this

dsh-balance-plugin is a web plugin for DeepSeek Harness (DSH). Its primary function is to display the DeepSeek API balance and token usage at the bottom of the web sidebar, with support for today/all-time toggles, and it only aggregates data from provider=deepseek-official.

Public repository address:

https://github.com/stevenx65/dsh-balance-plugin

License: MIT.

Core Features

Display DeepSeek API Balance

  • Calls the official DeepSeek API endpoint GET /user/balance.
  • Reuses DSH credentials: ~/.dsh/.credentials.yaml.
  • No manual API key input required.

Display Token Usage

  • Reads DSH session logs: ~/.dsh/sessions/<scope>/<session-id>/session.jsonl.zstd.
  • Aggregates by provider:
  • uncached input
  • cache read
  • output
  • model call count
  • Only aggregates data from provider=deepseek-official, ignoring other providers.

Toggle and Display

  • Supports Today / All-time toggle.
  • Today range uses Beijing time.
  • All-time range includes all historical data.
  • Automatically adapts to light/dark themes.
  • Injects buttons and a floating panel at the bottom of the web sidebar, mounted at sidebar.footer.action.

Installation and Enabling

  1. Install from the plugin directory
dsh plugin --profile web add dsh-balance-plugin
  1. After installation, restart dsh web and refresh the page.

A balance button will appear at the bottom of the sidebar.

Manual Installation

Copy the following files to:

~/.dsh/profiles/web/node_modules/dsh-balance-plugin

Files include:

index.js
client.js
cordis.patch.yml
package.json

Then, add an insert entry with id set to dsh-balance and name set to dsh-balance-plugin in ~/.dsh/profiles/web/cordis.patch.yml, for example:

- insert:
    - id: dsh-balance
      name: dsh-balance-plugin

After saving, restart dsh web and refresh the browser page.

Typical Usage

After installation and enabling, open the balance button at the bottom of the sidebar to view the DeepSeek API balance and token usage, with the option to toggle:

Today
All-time

The data endpoint is:

/dsh-balance/data?scope=today|all

Where scope can be today or all.

Use Cases and Notes

This plugin is suitable for developers who frequently use the DeepSeek official API in DSH web and want to quickly check their balance, today’s usage, or all historical usage.

Before using, note:

  • The plugin runs with the current DSH process permissions; review the source code and license before installation.
  • This plugin only aggregates data from provider=deepseek-official; other providers are not included.
  • The Today range uses Beijing time.
  • The Node side requires the zstd CLI to decompress session logs.
  • The browser-side peer dependency is @deepseek-ai/dsh-client-ui-primitives 0.1.0-rc.6.

Links

  • Directory page: https://www.skillhub.cn/plugins/stevenx65/dsh-balance-plugin
  • GitHub: https://github.com/stevenx65/dsh-balance-plugin