DeepSeek Harness is a local intelligent agent development environment. Developers need to monitor token consumption. This plugin solves that problem.

Plugin Overview

dsh-token-usage is a local usage dashboard plugin for DeepSeek Harness. It is maintained by xbyzzZ and released under the MIT License.

Core Features

  1. Data Source: Reads session.l.zstd files under $DSH_HOME/sessions in read-only mode.
  2. Time Range: Aggregates provider-reported token usage over the last 30 days.
  3. UI Entry Point: Places an entry above Settings in the Web sidebar; clicking it opens the usage dialog.
  4. Display Format: Heatmap + model table.
  5. Technical Implementation: A standalone bundle plugin; does not modify DSH source code and does not introduce SQLite.
  6. Theme Support: Supports dark mode and light mode.

Installation and Configuration

Enter the plugin directory and run the installation command:

dsh plugin --profile web add .

This installs the plugin into $DSH_HOME/profiles/web using pnpm and appends it to dsh.profile.bundles in package.json. After installation, restart DSH; a Usage entry will appear above Settings in the lower-left corner.

If dsh plugin add reports the error pnpm v11.12.0 is a broken release, this means the profile’s packageManager has pinned a broken version. Change the pin in $DSH_HOME/profiles/web/package.json to pnpm@11.22.0 (or a newer working version), then run the installation command again.

The plugin ships with cordis.patch.yml. To override the configuration, rewrite the entire config section:

- insert:
    - id: dsh-token-usage
      name: dsh-token-usage
      config:
        days: 30
        maxFiles: 4000
        maxFileBytes: 33554432

Interface and Usage

Entry Point: Above the Settings button in the Web sidebar.

Dialog Contents:
* Heatmap for the last 30 days.
* Newly generated usage, days with usage, and session count.
* Heatmap Colors: Light mode uses white to blue; dark mode uses black to blue; no usage is shown as white / black.
* Model Table: Includes provider + model name, steps, input, output, cache read, cache write, and reasoning.
* Empty Data: No sessions with usage yet.
* Failure: Failed to read local JSONL; you can scan again.

Data Scope

  • Statistical Target: Only counts assistant/message.usage in session logs (for the same turn/step, later writes overwrite earlier writes).
  • New Generation Calculation: inputTokens + outputTokens + cacheWriteTokens.
  • Separate Listing: Cache read and reasoning are listed separately and are not included in the heatmap’s main number.
  • Old Sessions: Old sessions without usage are not estimated based on character count.

Technical Notes

  1. Runtime Environment: Requires Node >= 22.
  2. Profile Limitation: The Host does not register RPC in a headless profile without connection.
  3. Data Retrieval: The Web profile retrieves data through the summary endpoint under /token-usage.

Conclusion

This plugin provides lightweight usage monitoring for local DSH development. For more details and source code, see the plugin directory or the GitHub repository.