DSH Token Insight: Local Token Usage Statistics Dashboard

Preface

When running tasks in DeepSeek Harness (DSH), Token consumption is scattered across session logs. To see cumulative usage, single-day peaks, model distribution, or consecutive usage days, you often have to dig through files yourself or rely on fragmented scripts. DSH Token Insight is a client-type local plugin published by maintainer daniei-chen: it only reads local ~/.dsh data, provides a full dashboard under DSH’s “Settings → Usage Statistics”, and ships with an AI-oriented installation guide. An optional companion Android shell app is available in the separate DeepSeek-Harness-APP repository; the plugin itself is installed on the host running DSH.

The following covers the plugin’s positioning, capabilities, installation, and verification methods. Facts are based on the GitHub repository README; community directory page: daniei-chen/dsh-token-insight.

What Is This

DSH Token Insight (dsh-token-insight, current version 0.5.0, MIT license) is a plugin installed on the DSH host. The host side parses sessions and historical summaries read-only, and the client side renders the statistics in the settings page; it does not write to sessions, does not write to storages, and incremental results are cached in ~/.dsh/dsh-usage-stats/session-cache.sqlite.

In one sentence: Local-first token usage dashboard for DeepSeek Harness — cumulative/peak tokens, consecutive-day streaks, a 52-week heatmap, daily trends, model usage, Top 5 sessions, cost, and export, all derived from local data. No network access, no uploads, no account or API key required.

Environment Requirements

Item Requirement
DSH 0.2.1-rc.2 or newer
Profile desktop (default)
DSH runtime Node Node 24 (the plugin uses the built-in node:sqlite)

DSH_HOME defaults to ~/.dsh; if customized, both the install script and the plugin will read that variable.

Core Features

The dashboard modules listed in the README are as follows. All are based on parsing the current version’s session.v4.jsonl.zstd (not estimates), and the data coverage range is labeled to avoid mistaking “not recorded” for “not used”.

Module Capability
Overview metrics Cumulative tokens, peak tokens, longest chat duration, current streak days, longest streak days
52-week heatmap Daily / weekly / cumulative; hover to show date, tokens, message turns; horizontal scrolling on mobile
Daily trend Last 7 days / last 30 days / all; color-coded by model
Model usage Donut chart + detail list; legend and donut chart can filter
Data coverage Actual start/end dates; today, this week, cache hit rate
Sessions Top 5 Title, tokens, duration
Export CSV / JSON / PNG
Daily budget Local localStorage on this machine; over-budget reminder, does not affect statistics
Historical billing Backfills partial costs by day from the old web-billing / cost-meter, labeled as “partial”
Theme Follows DSH dark/light

Data flow highlights: the current session comes from ~/.dsh/sessions/**/session.v4.jsonl.zstd; the old daily summary ~/.dsh/storages/web-billing.json; cost-meter ~/.dsh/storages/cost-meter/ledger.json. If the same calendar day has records in multiple places, they are merged with max() to avoid duplicate accumulation.

Installation and Activation

The plugin reads local files with the permissions of the current DSH process; before installing, review the repository source code and the MIT license yourself. The following commands and paths come from the official README. Do not blindly assemble dsh plugin add github:owner/repo based on the plugin name.

Method 1: Release package (no repository clone needed)

Download dsh-token-insight-0.5.0.tgz from Release v0.5.0, then select that tgz in the DSH plugin manager, or extract it to:

~/.dsh/profiles/desktop/node_modules/dsh-token-insight

Method 2: Manual profile setup

Add the dependency to ~/.dsh/profiles/desktop/package.json and add the package name to dsh.profile.bundles:

{
  "dependencies": {
    "dsh-token-insight": "file:/absolute/path/to/dsh-token-insight"
  },
  "dsh": {
    "profile": {
      "bundles": ["...", "dsh-token-insight"]
    }
  }
}

Create a junction or symbolic link under the profile’s node_modules pointing to the plugin directory. Windows example:

New-Item -ItemType Junction `
  -Path "$HOME/.dsh/profiles/desktop/node_modules/dsh-token-insight" `
  -Target "<absolute-path-to-dsh-token-insight>"

macOS / Linux:

ln -s "<absolute-path-to-dsh-token-insight>" \
  "$HOME/.dsh/profiles/desktop/node_modules/dsh-token-insight"

If you already have a local copy of the plugin directory

Run the install script inside the plugin directory; it will write dependencies into the profile and create the node_modules link:

node scripts/install.mjs --profile desktop

Regardless of which method is used, a full DSH restart (close the app, then reopen it) is required, then open the panel under Settings → Usage Statistics.

For AI/automated installation, you can first read the repository’s docs/INSTALL_FOR_AGENTS.md, which contains step-by-step commands, verification, and troubleshooting.

Verify Installation

On the host you can run three checks per the README (replace <port> with the DSH Web GUI port):

cd "$HOME/.dsh/profiles/desktop"
node -e "console.log(require.resolve('dsh-token-insight/client'))"
curl "http://127.0.0.1:<port>/usage-stats/api?days=30"
curl "http://127.0.0.1:<port>/usage-stats/api?days=all"

The expected response contains "ok": true, along with fields such as totalTokens, peakTokens, longestChat, models, cacheHitRate, todayTokens, weekTokens, sessionsTop, and coverage.

Typical Usage

Viewing in the UI

After installation and restart, from top to bottom: overview cards, data coverage, today/this week/cache hit/historical billing, daily budget, 52-week heatmap, time-range switcher, daily trend, model usage, Sessions Top 5, export and refresh.

HTTP API

Other local tools can consume the statistics read-only:

GET /usage-stats/api?days=7|30|all

Common returned fields include: coverage (firstDay, lastDay, sources), totalTokens / peakTokens, longestChat, currentStreak / longestStreak, cacheHitRate, todayTokens / weekTokens, cost, dayList, dayModels, models, sessionsTop, heatList, etc. See the “API” section of the README for details.

Relationship with the Mobile App

DeepSeek-Harness-APP is a separate Android project; the plugin does not need to be installed on the phone. The app displays the DSH Web UI via a WebView; once the plugin is installed on the host, the phone side can also open “Settings → Usage Statistics” to see the same local data.

Use Cases and Notes

Suitable for developers who need to track Token usage, model distribution, and session costs within DSH over the long term: data stays on the local machine, fitting scenarios with privacy and offline-statistics requirements.

Common issues (excerpted from the README): if the old “DSH Usage Statistics” and the new “Usage Statistics” both appear in Settings, confirm that the profile only retains dsh-token-insight and perform a full restart; if /usage-stats/api returns 404, check whether the plugin is loaded, the profile, and the port; Cannot find module 'node:sqlite' means the DSH built-in Node is too old, and DSH with Node 24 is required; if there is no data, confirm that .zstd files exist under ~/.dsh/sessions and that sessions have actually been produced in DSH.

To uninstall, remove dsh-token-insight from dependencies and dsh.profile.bundles in package.json, delete the corresponding node_modules entry and restart; optionally delete ~/.dsh/dsh-usage-stats/session-cache.sqlite — the original sessions are not deleted.

Conclusion

DSH Token Insight organizes local sessions and historical summaries into a readable dashboard and the /usage-stats/api, serving as a good reference implementation for a “client-side / usage statistics” plugin in the DSH ecosystem. Directory page: https://www.skillhub.cn/plugins/daniei-chen/dsh-token-insight; source code and documentation: https://github.com/daniei-chen/dsh-token-insight.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye