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

@deepseek-ai/dsh-token-cost

Token Cost

DSH web GUI plugin: token usage (input/output), cache hit/miss and cost statistics per conversation and in aggregate, with auto-switching DeepSeek pricing schemes

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

npx -y @deepseek-ai/dsh plugin --profile web add github:le-soleil-se-couche/dsh-token-cost#a944b73c5e8b8c96ada84ecc9be9b533a740c9b7
READMECompatibilityVersions
对话底部状态行费用展示费用明细弹窗

Compatibility and provenance

Token Cost is published as @deepseek-ai/dsh-token-cost 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
8/25/2026

Versions

0.2.0stable
8/25/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
BSD-3-Clause
Source
github
GitHub
★ 0
Weekly downloads
0
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 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

dsh-token-cost

dsh-token-cost

English · 中文

DeepSeek Harness(DSH)Web GUI 的 Token 用量 / 缓存命中 / 费用统计插件:单对话与整体汇总,内置 DeepSeek 双计价方案(东八区峰谷),也可为自己调用的其他模型填写单价。

2026-08-17更新:支持为自己调用的其他模型填写单价;点「添加模型」即写入本地价格文件,刷新后仍在,历史费用立刻按新单价重算。

2026-08-25 更新:计量内核升级为 attempt-aware fold,补齐失败调用后 retry、compaction/summary.usage 与 fork seedLength 边界;账本 schema 升至 v2,旧缓存会从权威 session logs 自动重折叠。

功能

  • 单对话视图:对话页面底部官方状态行(「首 token 平均 … · … tok/s」之后)直接嵌入本会话消耗费用,点击即可打开按请求的明细弹窗(时间 / 模型 / 缓存未命中 / 缓存命中 / 输出 / 费用,最新在上)。

对话底部状态行费用展示

费用明细弹窗

  • 整体汇总(设置 > 插件配置 > Web UI 插件 > Token 费用统计):时间筛选(今天 / 昨天 / 最近 7 天 / 最近 30 天 / 本月 / 上月 / 自定义,最多 30 天)+ 费用 / 输入 / 输出 / 缓存命中率统计卡,按模型、会话、日期分组。
  • 计价状态:高峰时段按东八区显示(09:00–12:00、14:00–18:00),判定也按东八区时钟。
  • 自定义模型价格:配置页可从账本发现未定价模型,或手动添加尚未调用的模型;按每百万 tokens 填写缓存未命中 / 缓存命中 / 输出。点「添加模型」即写入本地价格文件,刷新后仍在,历史记录立刻按新单价重算。缓存命中可不填(按 0 计)。第三方模型按平价,不受 DeepSeek 峰谷影响。

数据来源

插件读取 DSH 的持久会话日志($DSH_HOME/sessions/<cwd>/<session-id>/session.jsonl.zstd),把 provider 上报的 usage 事件折叠为按调用尝试的计费记录:同一次 attempt 内最终 message 替换 chunk 样本;失败 finish 会结算当前 attempt,让同一 turn/step 的 retry 另行累加;compaction/summary.usage 作为独立调用计入;聚合 fork 子会话时跳过 seq < seedLength 的继承前缀。紧凑账本($DSH_HOME/storages/dsh-token-cost/ledger.json)缓存解析结果,只重解析变化的日志;计量语义升级会自动使旧账本失效并从 session logs 重折叠。自定义单价存在同目录的 custom-prices.json。zstd 解压使用 fzstd(纯 JS 零依赖)。

Token 字段遵循 Harness 约定:inputTokens = 缓存未命中部分,cacheReadTokens = 缓存命中部分(两者不相交,相加即计费输入)。

统计边界仍由上游日志决定:标题生成、Web Search、被中断调用或其他客户端若没有写出 usage,插件不会虚构 token 或费用。可公开复核的 synthetic fixture 与手算结果位于 tests/fixtures/usage-accounting/。

计量优化与官方差异

截至 2026-08-25,DSH 官方 master b150a551b8 的 tokenUsage projection 仍为 stateVersion: 1:它能去重同一次 attempt 的 chunk/message 样本,但尚未折叠 compaction/summary.usage,失败 attempt 后同一 (turn, step) 的 retry 仍会覆盖前一次 usage;跨 session 汇总也需要消费方自行排除 seq < seedLength 的继承前缀。

本插件已经覆盖这些边界,并用 ledger v2 自动使旧口径缓存失效。在“已写入 DSH session logs 的 usage 如何结算”这一明确范围内,本插件当前领先于官方 master;这不代表插件能替代官方账单,也不扩大上游没有记录 usage 的遥测边界。独立 synthetic conformance checker 的四个 bucket 已逐项通过,记录见 deepseek-harness Discussion #1886。

安装

dsh plugin --profile web add github:le-soleil-se-couche/dsh-token-cost

重启 dsh web 后,在设置页展开「Web UI 插件」即可看到。历史会话日志在首次查询时自动回填。

配置项

键类型默认说明
enabledbooleantrue总开关(状态行费用显示 + 汇总卡片)
currency'cny''usd''cny'
priceMode'auto''scheme-a''scheme-b'
customPricesstring (JSON)''兼容旧设置项;现用配置页表单,落盘到 storages/dsh-token-cost/custom-prices.json

以上均可在卡片的「配置」页编辑;「重新扫描会话日志」按钮强制全量重解析。

开发

pnpm install && pnpm -r build
pnpm --filter @deepseek-ai/dsh-token-cost test
pnpm --filter @deepseek-ai/dsh-token-cost typecheck

架构说明见 DESIGN.md。


English version