Introduction

When developing DSH plugins or agent call chains, token consumption is often scattered across different models, dates, and sessions. To view daily, weekly, or monthly consumption, or to export and review data by session, one often needs to process logs manually. dsh-token-stats is a DeepSeek Harness (DSH) plugin that aggregates token usage from persistent session logs into a statistics page and API.

The philosophy of DSH is “Everything is a plugin”; the community directory is an independent site with no official affiliation to DeepSeek or Fantuan. Below, we introduce the features, installation methods, API usage, and precautions of dsh-token-stats.

What is this

  • Plugin Name: dsh-token-stats
  • Positioning: Token usage & cost statistics plugin for DeepSeek Harness (DSH)
  • GitHub Owner: 1841220388zzzcccxxx-star
  • License: MIT, © 2026 quansheng; the documentation does not directly explain the relationship between quansheng and the GitHub owner
  • Loading Method: Installed as an external DSH profile dependency and automatically loaded when DSH starts, without the need for manual activation

It solves a very specific problem: viewing token usage within DSH, splitting it by model / date / session, and obtaining USD / CNY cost estimates.

Core Features

Statistics and Cost Estimation

Confirmed capabilities include:

  • Statistics token usage by model, date, and session
  • Provide USD / CNY cost estimates
  • Support filtering by model and session

Native Settings Page

After installation, the entry point can be found in DSH’s settings page:

Settings → Token Stats

The documentation indicates that this page supports dark / light themes, as well as zh / en internationalization.

Trend Charts

The plugin provides SVG line charts for daily / weekly / monthly trends, with documentation noting zero dependencies.

Historical Backfill

On startup, it scans persistent session logs so that statistics are retained even after DSH restarts.

Export

The plugin provides CSV / JSON export capabilities and supports filtering by model and session.

Estimation Markers

When the adapter does not report usage, the plugin uses tokenMeter.estimateMessage for estimation and marks the record as estimated.

Installation and Activation

The documentation states that the plugin is installed as an external DSH profile dependency. The installation command provided is:

cd ~/.dsh/profiles/web && pnpm install

After completion, follow these steps to activate:

  1. Restart DSH web.

  2. Open:

Settings → Token Stats
  1. View the statistical results on the page or retrieve data via the HTTP API.

Typical Usage

HTTP API

The interface path provided in the documentation is:

/token-stats/api

The operations listed in the documentation include:

  • summary
  • query
  • models
  • sessions
  • export

Among them, export supports:

format=csv|json
model=<optional>
sessionId=<optional>

Here, model and sessionId are optional filter criteria.

Development Checks

The local check commands provided in the documentation include:

node --check index.js
node --check client.js
node test-plugin.js
.\sync-deploy.ps1

The descriptions are as follows:

  • node --check index.js: Check the server half
  • node --check client.js: Check the browser half
  • node test-plugin.js: Run standalone mock tests
  • .\sync-deploy.ps1: Resync source code to DSH profile, then restart DSH web

Applicable Scenarios and Precautions

Suitable for these scenarios:

  • Need to view token usage centrally within DSH
  • Need to split consumption by model, date, and session
  • Need USD / CNY cost estimates
  • Need to export CSV / JSON for subsequent review
  • Hope the plugin loads automatically with DSH startup

Precautions during installation and use:

  • The plugin runs with the permissions of the current DSH process; source code and license should be checked before installation
  • The license documentation is written as MIT © 2026 quansheng
  • Categories, star count, and directory page URL have not been confirmed in the verified documentation herein
  • Performance data are measurement results on the author’s machine from the documentation and do not constitute a general performance commitment
  • Estimated records will be generated when there is no usage reporting; attention should be paid to the estimated marker

Links

GitHub repository:

https://github.com/1841220388zzzcccxxx-star/dsh-token-stats

The directory page URL has not been confirmed in the documentation provided herein; if you need to enter from the DSH community directory, please refer to the actual display on the community directory site.