DSH Plugins Marketplace

DSH Plugins

Plugins

/

dsh-token-stats

1

dsh-token-stats

Manifest valid2

DSH plugin: token usage & cost statistics per model / date / session with history backfill and CSV/JSON export

UI (client)hasBundlePatch

dsh-token-stats

Token usage & cost statistics plugin for DeepSeek Harness (DSH).

Tracks token consumption per model, per date, and per session with cost estimation in USD / CNY, served as a native page under Settings → 📊 Token Stats. Installed as an external DSH plugin, it loads automatically at DSH startup — no manual activation needed.

中文说明

Features

  • 📊 Native settings page (dark/light aware, follows DSH theme tokens, i18n zh/en)
  • 📈 Daily / weekly / monthly trends with an SVG line chart (zero dependencies)
  • 💰 Cost estimation (USD & CNY) from a built-in pricing table for DeepSeek, GPT, Claude, Gemini, Qwen…
  • 🔁 History backfill: scans all persisted session logs at startup, so stats survive restarts
  • ⚡ Fast: batched session-title reads with an in-memory cache (TTL 5 min), single-pass summaries, memoized pricing
  • 📤 CSV / JSON export, filterable by model and session

Screenshot

Token Stats dashboard

Installation

The plugin is installed as an external DSH profile dependency.

  1. Clone / copy this repository to a local folder, e.g. D:\dev\dsh-token-stats

  2. In your DSH profile manifest (~/.dsh/profiles/web/package.json):

    {
      "dependencies": {
        "dsh-token-stats": "file:D:/dev/dsh-token-stats"
      },
      "dsh": {
        "profile": {
          "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-token-stats"]
        }
      }
    }
    
  3. cd ~/.dsh/profiles/web && pnpm install

  4. Restart DSH web. Open Settings → 📊 Token Stats.

cordis.patch.yml declares the bundle-layer mount point so the plugin auto-loads at startup.

How it works

  • Authoritative data = DSH persisted session logs: assistant/message events carry real usage (input / output / cache-read / cache-write / reasoning tokens), request/header events carry provider/model.
  • A one-shot backfill at startup (sessionQuery) rebuilds the in-memory aggregation index from all history (bounded concurrency).
  • llm/stream usage chunks are captured for live (display-only) in-flight totals.
  • When an adapter reports no usage, tokenMeter.estimateMessage is used and the record is flagged estimated.

HTTP API (/token-stats/api)

opdescription
summarytoday / week / month / total aggregates
querytime series (day/week/month) + per-model / per-session aggregates; filters: model, sessionId, from, to
modelsbuilt-in pricing table (USD per 1M tokens) + USD→CNY rate
sessionssession list (id + title)
exportCSV / JSON dump (format=csv|json, optional model / sessionId)

Development

node --check index.js      # server half
node --check client.js     # browser half
node test-plugin.js        # standalone mock tests: correctness + performance benchmarks
.\sync-deploy.ps1          # re-sync sources into the DSH profile (then restart DSH web)

Performance

Measured on the author's machine (14 sessions / ~10k records):

endpointbeforeafter
sessions~1700 ms (N serial readTitle calls)~12 ms (one batched readTitleSnapshots + cache)
summary~110 ms (4× full-array filters)<1 ms (single pass)
query~10 ms~18 ms at 10k records (memoized cost)

License

MIT © 2026 quansheng

Versions

Latest versionPublishedSize
0.1.0
0.2.0

Comments

Loading…

From the same category

open-design

by nexu-io

🎨 Best DeepSeek Harness Design Plugin. The open-source Claude Design alternative. 🖥️ Local-first desktop app. 🖼️ Your coding agent becomes the design engine: prototypes, landing pages, dashboards,

Development & InfrastructureTerminal & ClientsManifest valid

97.5k

Apache-2.0

TypeScript

Sep 21, 2026

Index only — not installable

by Molunerfinn

:rocket: The Ultimate Image Uploader for Efficient Creators. Supports Obsidian, Typora, VS Code etc. and 60+ image hosting services (S3, GitHub, Cloudflare R2, Imgur, Aliyun OSS...). Paste, upload, d

Terminal & Clients

27.2k

MIT

TypeScript

Sep 1, 2026

Index only — not installable

by YaoApp

✨ All your agents and workspaces in one place, on every device you own. Track tasks on a board, accessible from desktop, mobile, browser, or API. Self-hosted.

Terminal & Clients

8k

Go

Sep 21, 2026

Index only — not installable

by zhu1090093659

DeepSeek Harness (DSH) Web Plugin Aggregation Ecosystem · Everything is a plugin, distributed via the Creative Workshop

Tools & CapabilitiesTerminal & ClientsDevelopment & InfrastructureModels & ProvidersManifest valid

7.9k

Apache-2.0

TypeScript

Sep 21, 2026

dsh plugin --profile web add dsh-web

by omdsh-dev

开放的侧边栏底座,支持三方拓展注册新侧边栏页面。内置文件渲染编辑/终端/侧边对话/Git/子代理页面 | Open sidebar foundation, supports third-party extensions to register new sidebar pages. Built-in file rendering/editing, terminal, side chat, Git,

Terminal & ClientsUI & ExperienceWorkflow & AutomationManifest valid

3.7k

52.1k/wk

MIT

TypeScript

Sep 21, 2026

dsh plugin --profile web add dsh-better-sidebar

by ccch1mneyyy

DSH 官方公众号收录的 TUI 补位插件:Claude Code 风,鲸鱼顶栏/实时状态/流式思考/双击 Esc 回滚/上下文进度+TPS。npm 一键装。 DSH official WeChat featured TUI plugin — Claude Code style: whale bar, live status, streaming thoughts, double-Esc rol

Terminal & ClientsUI & ExperienceManifest valid

3.1k

6.1k/wk

MIT

TypeScript

Sep 21, 2026

dsh plugin --profile web add @deepseek-harness-tui/dsh-tui