Introduction

In the DeepSeek Harness (DSH) dsh web interface, Token usage, provider balances, and subscription quotas are often scattered across different backends or logs. Existing practices usually involve querying provider interfaces one by one or manually collating usage records. dawsondx/dsh-token-data is a DSH plugin that consolidates these types of information into the dsh web. Below is an introduction to its features, installation methods, and common queries.

What is this

dsh-token-data is a DSH plugin maintained by dawsondx with an MIT license (© dawsondx). It targets the dsh web graphical interface, providing a Token usage dashboard, provider balance queries, and subscription or quota window queries. The plugin’s internal ID is usage-stats, mounted via a DSH profile bundle.

The prerequisites are that DSH’s dsh web runs normally and the runtime environment includes Node.js >= 20.

Core Features

dsh-token-data primarily provides the following capabilities:

  • Real-time Token usage dashboard, supporting Hero summary cards and daily heatmaps
  • Daily and model-specific Token usage details and 7-day stacked trend charts
  • Provider balance queries, supporting DeepSeek, OpenRouter, Moonshot/Kimi, Z.ai, etc.
  • Subscription or quota window queries, supporting OpenCode Go, Z.ai, Kimi, MiniMax, etc.
  • Daily cache hit rate display
  • Read-only, loopback-only API, providing 5 GET endpoints
  • The plugin does not store keys locally; credentials are parsed by the DSH credential service upon request
  • Incremental aggregation and caching to usage-stats-cache.json
  • Panel fault tolerance, localized error messages, backoff retry, and retention of the last successful data
  • Localized number formatting: zh/ja uses 亿/万, en uses K/M/B

Installation and Activation

  1. Confirm that DSH’s dsh web can start, and the runtime environment includes Node.js >= 20.

  2. Execute the plugin installation command:

dsh plugin --profile web add dsh-token-data

You can also use GitHub to add directly:

dsh plugin --profile web add --ignore-scripts --config.auto-install-peers=false github:dawsondx/dsh-token-data
  1. After installation, restart dsh web.

Configuration and Queries

In the web profile’s cordis.patch.yml, you can configure provider monitors via usage-stats’s monitors. For example:

- id: usage-stats
  config:
    monitors:
      deepseek-official:
        adapter: deepseek-balance
        allowPrivateNetwork: true

The example above configures a deepseek-official monitor using the deepseek-balance adapter and enables allowPrivateNetwork.

The plugin provides 5 read-only GET endpoints:

Endpoint Purpose
GET /api/usage-stats/usage Query daily Token usage for all sessions
GET /api/usage-stats/providers Query configured providers and balance schemes
GET /api/usage-stats/balance?provider=<id> Query a single provider’s balance
GET /api/usage-stats/subscriptions Query OpenCode Go and Z.ai quota windows
GET /api/usage-stats/account Query a single provider’s unified account snapshot

Use Cases and Considerations

Suitable for developers who want to view usage centrally in DSH Web:

  • Need to view daily Token usage, model details, and 7-day trends
  • Need to query provider balances for DeepSeek, OpenRouter, Moonshot/Kimi, Z.ai, etc.
  • Need to view subscription or quota windows for OpenCode Go, Z.ai, Kimi, MiniMax, etc.
  • Want to retain the last successful data to avoid blank panels due to instantaneous network failures

Considerations before use:

  • The plugin runs with the current DSH process permissions; you should check the source code and license before installing.
  • The API is read-only and loopback-only; it does not write to sessions or logs, and the peer-socket address is the primary validation.
  • The plugin itself does not store keys; credentials are parsed by the DSH credential service upon request.
  • Account snapshots will mask sensitive headers such as authorization, cookie, and api-key.
  • Provider requests include a 15-second timeout and a 1 MB response limit.
  • OpenRouter balance queries require a Management Key.
  • Providers without public balance APIs will show a “no public balance interface status” message and will not guess numbers.

Related Links

  • Plugin Directory Page: https://www.skillhub.cn/plugins/dawsondx/dsh-token-data
  • GitHub: https://github.com/dawsondx/dsh-token-data