DeepSeek Harness Plugin Hub

Publish and manage complete Harness Profiles. Discover Plugins for your next setup.

Explore

PluginsPresetsDocsNews

Community

Publish a pluginContactReport an issue

Resources

Plugin Hub on GitHubDeepSeek HarnessSystem statusPrivacy notice
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

Independent and unofficial. Not affiliated with, authorized by, or endorsed by DeepSeek.

Token Stats — DSH Plugin for DeepSeek Harness
DeepSeek Harness Plugin Hub
ProfilesPluginsCategoriesNewsDocsSign inManage Profiles
ProfilesPluginsCategoriesNewsDocsSign in
← Plugins

@duke-dsh-plugins/dsh-token-stats

Token Stats

Token usage statistics for DeepSeek Harness (7/30-day per-model charts + yearly heatmap) plus an inline coding-plan balance/quota readout in the composer (minimax/deepseek/kimi/openrouter/zhipu).

The plugin will be installed here. Keep web if you are unsure.

npx -y @deepseek-ai/dsh plugin --profile web add @duke-dsh-plugins/dsh-token-stats@1.4.0
READMECompatibilityVersions

Compatibility and provenance

Token Stats is published as @duke-dsh-plugins/dsh-token-stats and currently resolves to version 1.4.0. The Hub verifies its manifest and preserves the exact installation source for reproducible installs.

DSH compatibility
*
Runtime surfaces
web
Release source
npm
Registry updated
9/20/2026

Versions

1.4.0stable
9/19/2026
1.3.4stable
8/23/2026
1.3.3stable
8/23/2026
Show 3 more versionsCollapse versions
1.3.2stable
8/22/2026
1.3.1stable
8/22/2026
1.3.0stable
8/22/2026

Related plugins

Loading related plugins…

Latest
1.4.0
DSH
*
HMR
Process restart
Tree shaking
Safe tree shaking not declared
Unpacked size
107.8 kB
Files
7
Surface
web
License
MIT
Source
npm
GitHub
★ 3
Weekly downloads
259
Security scan
✓ v1.4.0 scan passed
Last push
9/19/2026
View source ↗Project homepage ↗
README badge

Click the badge to copy Markdown for your README.

Do you maintain this Plugin?Claim benefit · Priority security scan

Verify the GitHub repository declared in package.json to manage this listing. After you claim it, Hub will prioritize a security scan of the current version and publish the result when it passes.

Claim this Plugin →
Report an issue

Related plugins

More verified plugins in models-usage.

Usage@linxin666/dsh-usageUsage statistics plugin for the dsh web GUI: per-provider balance and coding-plan quota detection plus a live token usage ledger, with a dedicated pet bubble for the current providerWhale Widgetdsh-whale-widgetDeepSeek balance whale widget in the bottom-right corner of the DSH Web interface: balance/today’s usage/peak-off-peak pricing, customizable bubble click sequence (text/balance/today/peak-off-peak/image/random phrases and parallel weighted selection), per-line styles and fonts, floating quick editinUsage Stats@ychris12138/dsh-usage-statsToken usage heatmap, provider balances, and subscription quotas for the dsh web GUICodex Connectdsh-codex-connectChatGPT OAuth and Codex models for DeepSeek Harness.

README

DeepSeek Harness Token 用量统计插件

中文


为 DeepSeek Harness(DSH) Web UI 打造的 Token 消耗统计插件:在设置面板里一目了然每个模型每天、每个统计区间的 token 用量。

功能

功能说明
📊 两个 Tab近 7 天 / 近 30 天,两个区间都包含今天
📈 堆叠柱状图统计区间内每个模型每天的消耗(悬停查看具体数字)
🥧 饼图统计区间内每个模型的总消耗占比 + 图例(精确值 + 百分比)
🔥 GitHub 风格热力图「近一年」每日活跃;天数随容器宽度自适应,最多显示 365 天(一年)
🗂 汇总卡片区间总 Tokens / 输入(含缓存) / 输出
💾 本地持久化聚合结果落盘 <DSH_HOME>/data/dsh-token-stats/stats.json,冷启动只扫描新会话、秒开;删除该文件可强制全量重扫
⏱ 自动刷新页面打开期间每 30s 刷新;历史回填期间每 2s 轮询进度
💰 套餐余额输入框工具行(model 选择器左侧)内联显示当前 provider 的余额/套餐用量,跟随当前模型自动切换;支持 minimax / deepseek / kimi / openrouter / zhipu;60s 轮询,点击立即刷新
🌗 主题适配全部使用 DSH 设计 token,明暗主题自动跟随

套餐余额功能参考自 dsh-musage(MIT),API Key 直接复用 DSH 模型设置里已配置的凭据(credentials 服务),无需重复配置。

安装

标准安装(推荐)

本插件是标准 DSH bundle:package.json 声明 dsh.bundle.patch,包内自带 cordis.patch.yml,用官方 dsh plugin 命令安装:

# 本地开发:pnpm 软链到本仓库,改代码即生效(无需重新复制)
dsh plugin --profile web add /path/to/dsh-token-stats

# 正式发布:从 GitHub Release tarball 安装
dsh plugin --profile web add https://github.com/MoonlitDropOfBlood/dsh-token-stats/releases/download/v1.4.0/dsh-token-stats-1.4.0.tgz

重启 DSH 后,打开 DSH Web UI 的设置(侧栏底部),左侧导航会出现 Token 统计 页。

dsh plugin add 把插件装成 profile 的 npm 依赖并追加到 dsh.profile.bundles,启动时 DSH 自动应用包内的 cordis.patch.yml 挂载插件。卸载:dsh plugin --profile web remove dsh-token-stats。

使用

  1. 打开 设置 → Token 统计。
  2. 在 近 7 天 / 近 30 天 两个 Tab 间切换:
    • 柱状图展示区间内每天、每个模型的消耗(堆叠)。
    • 饼图展示区间内每个模型的总消耗占比。
    • 顶部卡片给出区间总 Tokens / 输入 / 输出。
  3. 下方 每日活跃 热力图展示更长时间范围:格子越多 = 容器越宽,最多覆盖近一年。
  4. 会话输入框工具行(model 选择器左侧)内联显示当前 provider 的套餐余额:
    • DeepSeek / OpenRouter 显示余额(如 ¥43.97 / $12.50);
    • MiniMax / Kimi / 智谱 显示 5h X% | 7d Y%(5 小时 / 7 天窗口已用百分比,悬停查看重置时间);
    • 切换模型时自动切换 provider;每 60s 自动刷新,点击读数立即强制刷新;
    • 未配置对应 API Key 或拉取失败时显示 ⚠(悬停查看原因);当前 provider 不在支持列表时不占位。

工作原理

DSH 会话日志(唯一权威数据源)
  ├─ LIVE   : session/event  → assistant/message(usage)   [插件启动后实时累计]
  ├─ HISTORY: sessionQuery.readSession() → 回填历史        [仅扫描从未回填过的会话]
  ├─ DEDUP  : 按 session+seq 水位线去重,绝不重复计数
  └─ PERSIST: 聚合 + 水位线落盘 stats.json(防抖写盘 + 停止时 flush)
        │
        ▼
TokenStatsService.getStats()   ← ctx.remote.tokenStats.getStats()(Client 调用)
TokenStatsService.getQuota()   ← ctx.remote.tokenStats.getQuota(provider, force)
        │
        ├─ getStats → 设置面板「Token 统计」页(柱状图 / 饼图 / 热力图)
        └─ getQuota → composer 工具行内联读数(conversation.input.right,
                      紧贴 model select 左侧;跟随当前会话模型自动切 provider)
  • 数据按本地日历天 × 模型(provider::model)聚合;total = input + output + cacheRead + cacheWrite。
  • 历史回填只统计插件启动前发生的调用,实时监听只统计启动后的,两者通过每个会话的事件序号水位线合并,不会重复。
  • 模型/模型来自 assistant/message 的 message.source(kind = 'model'),无需自行解析请求头。
  • 套餐余额:Host 半经 credentials 服务解析用户在模型设置里已配置的 API Key(引用命名遵循 <ROUTE>_API_KEY 约定),GET provider 官方端点(宿主全局 fetch 优先,无 fetch 时回退 subprocess curl);30s 缓存 + 失败指数退避(5s→30min),不落盘。

目录结构

dsh-token-stats/
├── index.js            # Host 半:TokenStatsService(Remote 服务,采集 + 回填)
├── client.js           # Client 半:设置页「Token 统计」UI bundle
├── typert.host.js      # Typert Host manifest(tokenStats/getStats 描述)
├── cordis.patch.yml    # dsh bundle patch(挂载行)
├── .github/workflows/  # GitHub Actions 发布
├── AGENTS.md           # 面向 AI agent 的开发指南(含踩坑)
└── LICENSE             # MIT

开发

npm run check           # node --check index.js client.js typert.host.js
dsh plugin --profile web add /path/to/dsh-token-stats   # 安装/重装到本机 DSH profile

详见 AGENTS.md——记录了 DSH 正式插件(Host/Client/Typert 三件套)的完整机制和踩坑。

License

本项目遵循 MIT License。

本项目是基于 DeepSeek Harness 构建的社区插件,并非 DeepSeek 官方产品。