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.

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/mimo/opencode-go; mimo uses the dashboard cookie since MiMo exposes no API-key quota API).

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.10.0
READMECompatibilityVersions

Compatibility and provenance

Token Stats is published as @duke-dsh-plugins/dsh-token-stats and currently resolves to version 1.10.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
11/4/2026

Versions

1.10.0stable
11/4/2026
1.9.0stable
11/4/2026
1.8.0stable
10/27/2026
Show 18 more versionsCollapse versions
1.7.4stable
10/19/2026
1.7.3stable
10/18/2026
1.7.2stable
9/30/2026
1.7.1stable
9/29/2026
1.7.0stable
9/29/2026
1.6.0stable
9/28/2026
1.5.5stable
9/26/2026
1.5.4stable
9/26/2026
1.5.3stable
9/25/2026
1.5.2stable
9/25/2026
1.5.1stable
9/25/2026
1.5.0stable
9/24/2026
1.4.0stable
9/19/2026
1.3.4stable
8/23/2026
1.3.3stable
8/23/2026

Related plugins

Loading related plugins…

Latest
1.10.0
DSH
*
HMR
Process restart
Tree shaking
Safe tree shaking not declared
Unpacked size
156.7 kB
Files
8
Surface
web
License
MIT
Source
npm
GitHub
★ 8
Weekly downloads
556
Security scan
✓ v1.10.0 scan passed
Last push
11/4/2026
View source ↗
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
1.3.2stable
8/22/2026
1.3.1stable
8/22/2026
1.3.0stable
8/22/2026

Related plugins

More verified plugins in models-usage.

Whale 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 editinOur Free Model@ebony-vinyl/dsh-our-free-modelOur Free Model — Install this plugin in dsh to use cutting-edge models including DeepSeek V4.1 Flash and Kimi K3, with no login, registration, or API Key required. The desktop version also offers an EAC co-payment channel; starting with 2.0, it supports ten account channels: LobsterAI, Qoder, TRAE, 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 compact price glance card above the sidebar's Settings rowConnect Workbuddydsh-connect-workbuddyConnects locally signed-in WorkBuddy models (domestic and international versions) to DeepSeek Harness, automatically reading each model’s points multiplier from the upstream catalog on every refresh, with per-model image input toggles, multi-account switching, automatic account rotation from an acco

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 / mimo(小米)/ opencode-go;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.10.0/duke-dsh-plugins-dsh-token-stats-1.10.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 天窗口已用百分比,悬停查看重置时间);
    • 小米 MiMo 与其他 provider 同规则:未配置时显示 ⚠;配置 dashboard 登录 Cookie(环境变量 XIAOMI_MIMO_COOKIE,见下)后显示官方 剩余 X% + 周重置倒计时;Cookie 失效时自动退回本地用量统计 今日 X · 7d Y,不报错;
    • OpenCode Go 显示 5h X% | 7d Y% | 30d Z%(三个窗口的已用百分比,来自官方 opencode.ai/zen/go/v1/usage 接口);
    • 切换模型时自动切换 provider;每 60s 自动刷新,点击读数立即强制刷新;
    • 未配置对应 API Key 或拉取失败时显示 ⚠(悬停查看原因);当前 provider 不在支持列表时不占位。

MiMo(小米)配置:MiMo 与其他 provider 同规则——不配置就没有读数(composer ⚠、设置页无卡片)。它没有 API Key 配额接口(token-plan-* 与 api. 主机只有 OpenAI 兼容的 /v1 推理 API,实测所有 Bearer 配额路径均 404;key 还与区域强绑定,CN key 在 SGP/AMS 主机一律 401),唯一配额数据源是 dashboard 账号会话 Cookie。

想要官方剩余用量百分比:打开 platform.xiaomimimo.com 登录后,F12 → Network 任一 /api/v1/* 请求 → 复制完整 Cookie 请求头(含 api-platform_serviceToken 与 userId)→ 设置环境变量 XIAOMI_MIMO_COOKIE(写入 DSH 进程环境后重启生效;凭据库里已存过该 ref 的话直接可用)。插件内置最小 cookie jar:服务端若在响应里 Set-Cookie 续发会话会被自动吸收并写回凭据库(跨轮询、跨重启生效);Cookie 彻底失效时自动静默退回本地用量统计(今日 / 近 7 天消耗),不会报错。composer 读数按 route id 匹配(xiaomi-mimo / xiaomimimo / xiaomi-token-plan-cn / 名字含 xiaomi 或 mimo 均可)。

OpenCode Go 配置:与其他 provider 同规则——不配置就没有读数(composer ⚠、设置页无卡片)。在 DSH 模型设置里给 opencode-go 这个 provider 填好 API Key 即可(插件读 OPENCODE_GO_API_KEY,同时也认 OPENCODE_API_KEY / OPENCODE_GO_KEY / OPENCODE_ZERO_API_KEY 这几个同义变量名)。数据来自 OpenCode 官方 JSON 接口 GET https://opencode.ai/zen/go/v1/usage(Authorization: Bearer <key>),返回 rolling / weekly / monthly 三个窗口的已用百分比(5 小时滚动 / 7 天 / 30 天)与重置时间。⚠️ 这个接口只给百分比、不给金额(社区插件显示的美元金额是按硬编码额度自己算的),所以插件只渲染百分比。

工作原理

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),不落盘。小米 MiMo 没有 API Key 配额接口:配了 dashboard Cookie(XIAOMI_MIMO_COOKIE)走官方剩余用量 %,Cookie 失效时静默退回本地用量统计;未配置则与其他 provider 一样视为未配置。OpenCode Go 走官方 JSON 接口 opencode.ai/zen/go/v1/usage,给出 5h / 7d / 30d 三个窗口的已用百分比。

目录结构

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 官方产品。