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 Data — DSH Plugin for DeepSeek Harness
DeepSeek Harness Plugin Hub
ProfilesPluginsCategoriesNewsDocsSign inManage Profiles
ProfilesPluginsCategoriesNewsDocsSign in
← Plugins
T

dsh-token-data

Token Data

Token usage dashboard, provider balances, and subscription quotas for the dsh web GUI

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

npx -y @deepseek-ai/dsh plugin --profile web add github:dawsondx/dsh-token-data#552b1601ff24fb6b3ab6ceaedbc6acd591112bc4
READMECompatibilityVersions

Compatibility and provenance

Token Data is published as dsh-token-data and currently resolves to version 0.2.0. The Hub verifies its manifest and preserves the exact installation source for reproducible installs.

DSH compatibility
*
Runtime surfaces
web
Release source
github
Registry updated
10/17/2026

Versions

0.2.0stable
10/17/2026

Related plugins

Loading related plugins…

Latest
0.2.0
DSH
*
HMR
Process restart
Tree shaking
Safe tree shaking not declared
Unpacked size
Unavailable
Files
Unavailable
Surface
web
License
MIT
Source
github
GitHub
★ 2
Weekly downloads
0
Last push
10/17/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

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 compact price glance card above the sidebar's Settings rowClient Ui Model Capabilities@linxin666/dsh-client-ui-model-capabilitiesPer-model capability declarations (image input and reasoning efforts) for custom pi-ai providers, edited in place on the Models settings cards; writes the official llm-pi-ai settings namespace, no DSH source changes.Codex Subscriptiondsh-codex-subscriptionUse ChatGPT and Codex subscriptions in DeepSeek Harness with OAuth, quota, safe resets, web search, images and Fast mode, and control DSH from the ChatGPT mobile app (Beta)Connect Workbuddydsh-connect-workbuddyConnect locally logged-in WorkBuddy models to DeepSeek Harness, with read-only credit overview and model management.

README

中文 · English

dsh-token-data:面向 DeepSeek Harness Web 图形界面的 Token 用量仪表盘——每日用量热力图、供应商余额与订阅配额,尽在一个浮动面板

dsh-token-data 是 DeepSeek Harness(DSH)的插件,把实时 Token 用量仪表盘带进 dsh web 图形界面。点击侧边栏底部的徽章即可打开浮动面板,查看每日 Token 消耗、各供应商余额与订阅配额窗口——不必在多个供应商后台之间来回切换,也无需手工记账。

你能看到什么

你想知道什么面板会告诉你
今天 / 这个月烧了多少 Token?Hero 汇总卡片 + Codex 风格每日热力图
Token 都花到哪去了?按日、按模型的明细 + 7 日堆叠趋势图
DeepSeek 余额是不是快用完了?供应商余额(DeepSeek、OpenRouter、Moonshot/Kimi、Z.ai 等)
订阅窗口还剩多少?OpenCode Go、Z.ai、Kimi、MiniMax 的配额窗口
提示词缓存真的有用吗?每日缓存命中率,就在总数旁边

它有什么不同

  • 跟进 DSH 0.2——用量改由 sessionPersistence 的分页日志读取(list / open / read),不再依赖已废弃的同步 Session 事件读取;供应商连接信息改由 settings.describe() 的实时配置投影取得;前端不再 import 任何 Harness 客户端包(图标自绘),因此不会因为 primitives 图标集改名而渲染崩溃。
  • 零构建步骤——浏览器端是手写的 __ModuleLoader__ 模块(无打包器、使用者无需 npm install);服务端是纯 ESM。clone、添加、重启即可。
  • 只读、仅回环的 API——5 个 GET 端点,位于 peer-socket 回环防护之后;绝不会写入你的会话。
  • 密钥留在凭据缝隙里——供应商 API Key 在请求时通过 DSH 凭据服务解析。插件自身不存储任何密钥。
  • 增量聚合——每个会话的折叠状态被缓存(<DSH_HOME>/storages/usage-stats-cache.json),按日志产物的稳定标识(大小 + 事件数)判重;无论日志多大,稳态成本始终是 O(新增事件)(实测本地 121 个会话约 0.2 秒)。
  • 面板抗故障——网络 / 超时 / HTTP 错误会归类为友好的本地化消息,瞬时失败带退避重试,并保留最后一次成功数据,网络抖动也不会让面板空白。
  • 本地化数字格式——zh/ja 用 亿/万,en 用 K/M/B;徽章与面板跟随浅色 / 深色主题的所有颜色令牌。

支持的供应商

供应商余额订阅 / 配额
DeepSeekGET /user/balance(CNY)-
OpenRouterGET /api/v1/credits(需 Management Key)-
Moonshot / KimiGET /v1/users/me/balanceKimi coding 用量
Z.ai(GLM)GET /api/paas/v4/balanceCoding Plan 配额窗口
OpenCode Go-未公开的用量端点 + 工作区面板兜底
MiniMax-Token 套餐余量(global / CN)
其他通用 new-api / sub2api / general 适配器,以及声明式 JSON Pointer 配置

没有公开余额 API 的供应商会明确显示无公开余额接口状态,而不是猜测一个数字。

安装

前置条件: 可正常运行的 DSH(dsh web 能启动)、Node.js ≥ 20。

方式一:从 npm 安装(推荐)

dsh plugin --profile web add dsh-token-data

方式二:clone 后安装(审阅源码 / 参与贡献)

git clone https://github.com/dawsondx/dsh-token-data.git
cd dsh-token-data
dsh plugin --profile web add \
  --ignore-scripts --config.auto-install-peers=false \
  .

方式三:直接从 GitHub 添加(无需 npm)

dsh plugin --profile web add \
  --ignore-scripts --config.auto-install-peers=false \
  github:dawsondx/dsh-token-data

方式四:本地开发

dsh plugin --profile web add link:C:/path/to/dsh-token-data

安装完成后重启 dsh web。面板从侧边栏底部徽章打开;用 profile 的 cordis.patch.yml 配置监视器(示例见下)。

配置

本插件是一个 DSH profile bundle(dsh.bundle.patch),内部插件 id 为 usage-stats。在 web profile 的 cordis.patch.yml 中挂载监视器并配置各供应商选项:

- id: usage-stats
  config:
    monitors:
      deepseek-official:
        adapter: deepseek-balance
        allowPrivateNetwork: true   # 放行本地代理(TUN/fake-ip)解析
      minimax-cn:
        adapter: minimax-token-plan
        region: cn                   # MiniMax 中国区账号

工作原理

flowchart LR
  S[会话事件日志] --> F[增量折叠<br/>按日 / 按模型]
  F --> C[(usage-stats 缓存<br/>DSH_HOME/storages)]
  C --> E[5 个只读回环端点]
  E --> P[网页面板<br/>热力图 · 余额 · 配额]
  K[凭据缝隙] -. 请求时解析 Key .-> E

服务端在 /api 下注册了 5 条精确路由,优先于连接插件的 /api 前缀处理器。聚合以 sessionPersistence 为准:list() 给出每个已存会话的日志产物,open(id, "read") + read(offset) 增量取回新事件;产物未变化(大小 + 事件数相同)的会话整轮跳过,因此稳态成本与历史日志总量无关。

折叠规则与 Harness 自身的 token-meter 投影一致:用量取自 assistant/message 的 data.usage,缺失时退回该事件 stream 里最后一个 usage chunk;assistant/attempt(失败 / 重试的尝试)同样计入。同一 (turn, step) 重复上报时替换而非累加,llm/retry-started 会清空该槽位,使重试后的新尝试正常累加。fork 出的会话只统计自身事件(inheritedEventCount 之后),所以祖先会话的用量不会被重复计算。无法打开的旧格式日志会被记住并排除在总量之外,只汇总为一条警告,不会反复拖慢每次刷新。

端点用途
GET /api/usage-stats/usage所有会话的按日 Token 用量
GET /api/usage-stats/providers已配置的供应商 + 余额方案
GET /api/usage-stats/balance?provider=<id>单个供应商的余额
GET /api/usage-stats/subscriptionsOpenCode Go + Z.ai 配额窗口
GET /api/usage-stats/account单个供应商的统一账户快照

安全性

  • 只读——每个端点都是 GET;不会写入你的会话或日志。
  • 仅回环——必须是回环接口的 peer-socket 地址(而非客户端可控的 Host 头);Host 头只是二次校验。
  • 不存密钥——凭据在请求时经 DSH 凭据缝隙解析;账户快照会脱敏敏感头(authorization、cookie、api-key 等)。
  • 上游调用有界——供应商请求带 15 秒超时与 1 MB 响应上限。

开发

npm run check   # 对每个 lib 文件执行 node --check
npm test        # 折叠语义(替换 / 重试 / 模型归属)的纯函数断言

lib/usage.js 与 lib/balance.js 是纯模块(无 cordis 依赖)——折叠与余额解析可以在 DSH 之外对真实日志做单元测试与验证。浏览器端没有任何构建步骤:改完 lib/client.js 直接刷新页面即可(Harness 的 client-hmr 会按文件变更重新提供 bundle);服务端 lib/index.js 属于 Node 模块图,改动后需要重启 dsh web。

致谢

  • dsh-usage-stats(MIT,© 2026 dsh-usage-stats contributors)——本项目的改造基础:内部插件 id usage-stats 与 API 路由保持不变以兼容既有配置,包名与前端 bundle 为全新实现。
  • cc-switch(MIT)——统计面板 UI(Hero 汇总卡片、SVG 堆叠趋势图、表格数字)的设计灵感,以及 formatTokensShort 本地化数字格式逻辑(zh/ja 用 亿/万,en 用 K/M/B)。

许可证

MIT © dawsondx