Yvesgao/dsh-cost-estimate
在 DSH Web 聊天界面里,当你发送一条比较大的问题时,回答开始之前会在聊天流中插入一行内联通知,预估这次回答大概需要多少 token、折合 DeepSeek API 多少钱;回答结束后,同一行自动更新为实际的 token 用量与费用。
catalog descriptioncatalog 简介 / catalog description:DSH 插件:回答前先预估 token 用量与 DeepSeek API 费用,回答后展示实际账单(Web 聊天内嵌行)
Project Overview项目介绍
This is a native plugin built exclusively for DeepSeek Harness (DSH) that provides token usage estimation and cost reconciliation before and after a large language model generates a response. It can be installed via the DSH CLI with the command dsh plugin --profile web add dsh-cost-estimate, or desktop DSH users can find it in the official plugin market for one-click installation. After installation, you need to restart dsh web and force-refresh your browser page to load the plugin properly, and the installation process requires pnpm to be installed globally on your system.
When you send a large request, the plugin inserts an inline notification in the chat stream with an estimated range of tokens and cost before the model starts generating. After the response is complete, it updates that same line with the actual token usage and cost pulled from the DeepSeek API provider response. It only triggers when the request meets a configurable threshold, which defaults to 8000 input tokens or 0.01 yuan estimated cost, so small requests don’t get annoying notifications, and it avoids cluttering your chat interface with unnecessary alerts.
This plugin is implemented purely on the client side, with all calculations and rendering done in the DSH web client, so it does not write any custom data to session logs and can be safely installed or removed without breaking existing sessions. It is released under the open source MIT license, and the embedded pricing matches DeepSeek’s official pricing as of 2026, so if DeepSeek updates their pricing later, you will need to manually update the price constants in the plugin’s source code. All estimates are provided for reference only, and actual billing is determined by DeepSeek’s official API calculation.
这是一个专为 DeepSeek Harness(DSH)开发的原生插件,功能是在大模型回答前后提供 token 用量预估和实际费用对账。当用户发送大体积请求时,插件会在聊天流插入内联通知,先给出预估的 token 区间和费用范围,等回答结束后,同一位置自动更新为 DeepSeek API 返回的实际用量与最终费用。和其他事后统计类插件不同,它主打事前预估,帮助用户提前把握调用成本。
插件默认仅当预估输入 token 超过 8000 或预估费用超过 0.01 元时才触发提示,小请求静默不打扰,避免刷屏。它内置 DeepSeek 官方最新价目表,支持 deepseek-v4-flash 和 v4-pro 两款模型,会根据当前北京时间自动选择高峰、平峰、低谷的对应计价档位,费用计算完全贴合官方最新定价规则。
本插件为纯客户端实现,所有计算和渲染都在 DSH Web 客户端完成,不会向会话日志写入自定义数据,安装卸载都不影响已有会话,可安全装卸。它采用 MIT 许可证开源,用户可通过 DSH CLI 命令从 npm 安装,桌面端用户也可在插件市场搜索一键安装,安装后需强制刷新浏览器页面生效。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-cost-estimate(Yvesgao/dsh-cost-estimate)
仓库:https://github.com/Yvesgao/dsh-cost-estimate
本站详情页:https://www.yhbd.top/plugins/yvesgao-dsh-cost-estimate/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 2 · 最近提交 2026-08-30 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add dsh-cost-estimate
把 Yvesgao/dsh-cost-estimate 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-cost-estimate
DeepSeek Harness(DSH)插件 —— 回答之前先报价,回答之后看账单。
在 DSH Web 聊天界面里,当你发送一条比较大的问题时,回答开始之前会在聊天流中插入一行内联通知,预估这次回答大概需要多少 token、折合 DeepSeek API 多少钱;回答结束后,同一行自动更新为实际的 token 用量与费用。
与社区已有插件(dsh-session-cost / dsh-token-budget / dsh-usage 等)的关键区别:那些都是事后用 provider 返回的 usage 统计账单;本插件是事前预估——输出长度天然无法精确预测,因此给出区间,并用会话内历史实际值做持续校准。
✨ 特性
- 事前预估:模型开始生成前,先显示预估的输入 token、输出 token 区间和费用区间
- 事后对账:回答结束(拿到 provider 真实
usage)后,同一行翻转为实际 token 与费用,并展示缓存命中率 - 阈值触发,不刷屏:默认"预估输入 ≥ 8000 token 或预估费用 ≥ ¥0.01"才显示,小问题静默、大问题必提示
- 峰谷计价:内置 DeepSeek 官方价目(deepseek-v4-flash / v4-pro),按当前北京时间自动选择高峰/低谷档位
- 输入侧尽量精确:优先锚定每次请求真实返回的
usage,中间穿插用 CJK 感知的启发式计数兜底 - 输出侧持续校准:用会话内"预估中点 vs 实际输出"的滑动均值校准后续预估,越用越准
- 纯客户端、零侵入:全部计算与渲染在 Web 客户端完成,不向会话日志写入任何自定义事件,装/卸插件不影响已有会话
- 多步回合友好:工具调用循环会标注"多步",并累计真实费用
效果示例
发送一个大问题(例如几千字的设计文档评审请求)后:
预估:输入约 9.9K tok · 输出 2.2K–7.3K tok · 费用约 ¥0.0096–¥0.0198(v4-flash)
模型回答结束后,同一行自动翻转为:
实际:输入 9.1K tok · 输出 1.1K tok · 费用 ¥0.02(缓存命中 87% · v4-flash)
演示

安装
# 从 npm 安装(推荐)
dsh plugin --profile web add dsh-cost-estimate
# 本地开发 / 尝鲜(从源码目录安装)
dsh plugin --profile web add <本目录路径>
安装后重启 dsh web,并在浏览器中强制刷新(Ctrl+Shift+R)以加载新插件。桌面端用户也可以在插件市场搜索 dsh-cost-estimate 一键安装。
注意:DSH 的
dsh plugin命令依赖 pnpm(npm install -g pnpm);Windows 上安装路径含空格时请使用无空格的路径(如 junction)避免解析错误。
配置
cordis.patch.yml 中 config 支持以下键:
| 键 | 默认值 | 说明 |
|---|---|---|
minInputTokens |
8000 |
预估输入超过该 token 数才显示 |
minCostCny |
0.01 |
或预估费用上限超过该元数才显示 |
defaultModel |
deepseek-v4-flash |
首次 usage 锚定前的模型回退值 |
headerTokensEstimate |
6000 |
首次 usage 锚定前,系统提示词 + 工具 schema 的启发式 token 数 |
defaultCacheHitRatio |
0.5 |
首次 usage 锚定前假定的缓存命中率 |
示例:
- id: cost-estimate
name: dsh-cost-estimate
config:
minInputTokens: 20000
minCostCny: 0.05
定价
内置 DeepSeek 官方定价(¥/百万 token,与 api-docs.deepseek.com 对齐):
| 模型 | 缓存命中输入 | 未命中输入 | 输出 |
|---|---|---|---|
| deepseek-v4-flash(2026-08-17 前) | ¥0.02 | ¥1 | ¥2 |
| deepseek-v4-pro(2026-08-17 前) | ¥0.025 | ¥3 | ¥6 |
| flash · 高峰(北京时间 9-12 / 14-18) | ¥0.10 | ¥3 | ¥9 |
| flash · 低谷 | ¥0.05 | ¥1.5 | ¥4.5 |
| pro · 高峰 | ¥0.30 | ¥9 | ¥27 |
| pro · 低谷 | ¥0.15 | ¥4.5 | ¥13.5 |
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
MeteorNOX/DeepSeek-Balance-Whale-Widget
edison7009/EchoBird
Han-1413141/dsh-cost-meter
wssfk12138/dsh-damage-pulse
zh667/TokenLedger
edonadei/caliper
Ychris12138/dsh-usage-stats
Aisland-SJL/dsh-usage