dshbase

Plugin directory / Developer / dsh-plugin-tokenmeter

dsh-plugin-tokenmeter

Verified · install-tested on dsh pythonshiyi

✓ Actively maintained

View on GitHub ↗ ← Back to plugin directory

1Stars
0Forks
0Open issues
JavaScriptLanguage
2026-08-15Last push
Cross-platformPlatform

What it does

Token usage display plugin (DeepSeek Harness web UI): real-time token usage per reply | Per-message token usage chips for DeepSeek Harness web UI

✅
Our take
Works — verified, early-stage project

Token usage display plugin (DeepSeek Harness web UI): real-time token usage per reply | Per-message token usage chips for DeepSeek Harness web UI It installs cleanly and boots without issues in our testing. It's early-stage but functional.

“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.

README

dsh-plugin-tokenmeter

[English](README_EN.md) | 中文 > DeepSeek Harness 网页端词元消耗显示插件 —— 在每条已完成的助手回复下方,实时显示本轮消耗的输入/输出词元、缓存命中率与会话累计。 !https://img.shields.io/github/license/pythonshiyi/dsh-plugin-tokenmeter !https://img.shields.io/github/v/release/pythonshiyi/dsh-plugin-tokenmeter https://img.shields.io/badge/GitHub-dsh--plugin-blue](https://github.com/topics/dsh-plugin)

功能特性

- 每条**已完成的助手轮次(turn)**底部显示词元消耗徽标: `` ↑1.2k ↓3.4k ·缓存62% 累计 12.3k ` - **↑ 输入 / ↓ 输出**:整轮**所有步骤**(含工具调用步骤——每步都会重发完整上下文并单独计费)的计费合计 - **缓存命中率**:缓存读取 ÷ 计费输入,缓存命中越高成本越低(默认仅在有缓存读取时显示;showCachePercent: true 可连 缓存0% 一起显示) - **思考标记**:轮次含思考词元时显示 🧠(思考是输出的子集,不重复累加) - **会话累计**:来自 Harness 的 tokenUsage 投影——基于整个持久化日志、随事件实时更新、不重复计数;默认只显示在**最后一条助手回复**(内置统计行已展示会话级数字,避免每条消息重复) - **悬停明细**:缓存读取/写入、思考词元、步骤数 - **多语言**:优先跟随 Harness 界面语言(zh/en),无 locale 服务时回退中文 - **纯客户端实现**:数据直接来自会话快照,无 Host 往返,消息完成即动态出现/更新 - 样式使用主题变量,自动适配明暗主题

行级配置

cordis.patch.yml 中该行可携带 config(均可省略,使用默认值): `yaml - insert: - id: plugin-tokenmeter name: 'dsh-plugin-tokenmeter' config: showCumulative: last # 'all' 每条消息都显示累计 | 'last' 仅最后一条(默认) | 'none' 不显示 showCachePercent: false # true 时连“缓存0%”也显示 compact: false # true 时合并为单个徽标 `

环境要求

- DeepSeek Harness **web 版**(
dsh --profile web) - 标准 web 插件列表(会话/对话 UI)

安装

方式一:npm(发布后可用)

`bash cd ~/.dsh/profiles npm install dsh-plugin-tokenmeter `

方式二:本地目录或 Git 仓库

`bash cd ~/.dsh/profiles npm install /path/to/dsh-plugin-tokenmeter

或:npm install https://github.com/pythonshiyi/dsh-plugin-tokenmeter

` 然后注册到你的 profile 补丁,例如 ~/.dsh/profiles/web/cordis.patch.yml: `yaml - insert: - id: plugin-tokenmeter name: 'dsh-plugin-tokenmeter' ` 重启应用(dsh --profile web)并刷新页面即可生效。

卸载

从
cordis.patch.yml 删除该行,或直接禁用: `yaml - id: plugin-tokenmeter name: 'dsh-plugin-tokenmeter' disabled: true ` 重启并刷新。

工作原理

| 环节 | 说明 | | --- | --- | | 槽位 |
conversation.chat.assistant-actions(增量列表槽,id: token-usage,order: 5) | | 轮次定位 | 关闭消息 id → chat.legacy.nodes → turn 编号 | | 轮次聚合 | chat.locations.getTurn(turn) → assistant-step 节点 data.usage / finalNode.usage(降级:legacy 节点扫描) | | 计费输入 | inputTokens + cacheReadTokens + cacheWriteTokens(不重叠计数;DeepSeek 适配器已将缓存命中从 prompt_tokens 中剔除) | | 思考词元 | 是 outputTokens 的子集——仅展示,绝不重复累加 | | 会话累计 | useProjection('tokenUsage') —— Host 端对整个持久化日志的增量折叠;默认仅渲染在最后一条助手回复(showCumulative 可调) |

常见问题

**为什么多步工具轮次的数字很大?** 每调用一次工具,模型都会重发完整上下文并单独计费(输入侧),本插件如实聚合了整轮所有步骤的消耗。 **为什么某些消息没有徽标?** 只有模型上报了 usage 数据的调用才会显示;窗口外的历史消息同样无法统计。 **重试过的步骤为什么只算最后一次?** 这是 Harness 会话快照的固有口径:
assistant-step 节点按轮次/步骤坐标原地更新,finalNode.usage 只保留最后一次尝试(内置统计行同理)。因此失败重试实际消耗的词元会偏低显示——这是口径说明,不是计数错误。

兼容范围

开发和验证版本: - DeepSeek Harness
0.1.0-rc.6(web profile) - 插件深度依赖会话快照内部形状(chat.legacy.nodes / chat.locations / assistant-step 节点的 finalNode.usage`),Harness 升级后若这些形状变更,徽标会静默降级为空而不报错(所有访问均有守卫)

支持与品牌

**公众号:十一AIGC** —— AI 工具评测与教程,第一时间获取本插件更新与更多 DeepSeek Harness 玩法。 如果本项目对你有帮助,欢迎 ⭐ Star,并关注公众号「十一AIGC」。

License

MIT

Install

🧩 Let your agent install it (recommended)

Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:

dsh plugin add dshbase-catalog

Then say "install dsh-plugin-tokenmeter for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.

This plugin is GitHub source (not published to npm) — install it straight from the repo:

Web profile:

dsh plugin --profile web add github:pythonshiyi/dsh-plugin-tokenmeter

Headless (CLI) profile:

dsh plugin --profile headless add github:pythonshiyi/dsh-plugin-tokenmeter

Test report

Verified: L1 install + L2 load + L3 runtime from GitHub source on dsh 0.1.0-rc.6.

When to use it

Extend the agent's coding surface — give it a new tool, workflow, or integration so it handles a dev task it couldn't before.

Who it's for

Developers who want dsh to behave like a teammate on real codebases — editing, running, and verifying changes rather than just answering.

For developers — extending it

The tool/command surface is the seam: expose more of the SDK, add smarter context wiring, or tighten the loop between code changes and verification.

Security: not yet scanned — our daily static scan will cover it shortly.

Share this badge

More in Developer

Browse all 7797 plugins →