ChengChe106/dsh-session-cost 预览 preview

ChengChe106/dsh-session-cost

DSH插件:在Web GUI统计栏中估算每次会话的DeepSeek API费用

Project Overview项目介绍

dsh-session-cost is a native plugin built exclusively for DeepSeek Harness (DSH). It adds a line of estimated current session DeepSeek API cost to the bottom stats bar of DSH’s web GUI. The display matches the official stats bar’s 12px font size and adapts to the active user theme, so it fits seamlessly into the DSH interface. To install, run the command dsh plugin add dsh-session-cost if you have DSH installed globally, or use an npx command if you do not have DSH installed globally. After installation completes, you must restart the dsh web process for the plugin to activate.

This plugin pulls token usage data directly from DSH’s official tokenUsage session projection, which is the same data source used for DSH’s built-in token stats. It calculates cost based on DeepSeek’s official pricing, separating cached hit tokens, cached miss/write tokens, and output tokens into different pricing tiers. It supports DeepSeek’s peak/off-peak pricing for v4 models, automatically switching based on Beijing time without any extra user configuration. All current pricing for DeepSeek v4 flash and pro models is preconfigured, matching official pricing effective until August 17, 2026. It is ideal for DSH users who regularly use the DeepSeek API and want to track spending during active sessions.

The cost shown by this plugin is only an estimate, and it may differ from your actual DeepSeek API bill due to factors like rounding, mid-session model switching, and pricing alignment. Currently, if you switch models mid-session, the plugin will not retroactively recalculate cost for earlier tokens, and it uses a single default model for all sessions unless you edit the source code to change the default. The plugin is released under the open source MIT license, so you can modify the default model and pricing table directly in the source code if your individual needs differ from the preconfigured defaults.

dsh-session-cost 是一款专为 DeepSeek Harness (DSH) 开发的原生插件,核心功能是在 DSH 的 Web 界面底部统计条新增当前会话的 DeepSeek API 费用估算显示。插件显示风格与官方统计条对齐,支持自适应主题配色,字号也统一为 12 像素,界面融合度很高,用户可以在会话过程中随时直观看到当前的费用消耗情况。

插件可以通过 DSH 官方命令行工具直接安装,全局安装 DSH 后执行 dsh plugin add dsh-session-cost 即可,未全局安装 DSH 则使用 npx 命令 npx --yes @deepseek-ai/dsh plugin --profile web add dsh-session-cost 安装。安装完成后需要重启 dsh web 才能生效。这款工具适合经常使用 DSH 调用 DeepSeek API 开发的用户,帮助他们实时掌握会话费用,避免账单超支。

插件依托 DSH 官方 dsh-token-meter 提供的 tokenUsage 会话数据计算费用,计费口径和官方账单一致,会区分缓存命中、未命中以及输出 tokens 的不同单价,还支持 DeepSeek 官方的峰谷计价规则。本次费用为估算值仅供参考,可能和实际账单存在出入,采用 MIT 开源协议,用户如果需要修改默认模型和价格表,可以自行编辑源码文件。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • 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 add dsh-session-cost

把 ChengChe106/dsh-session-cost 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-cost

DSH(DeepSeek Harness)插件:在 Web GUI 底部统计条里显示当前会话的 DeepSeek API 费用估算。

效果:统计条下方多出一行 费用 ≈¥0.35 | 命中 ¥0.28 | 未命中 ¥0.02 | 输出 ¥0.05,字体与配色完全对齐官方统计条(12px、主题自适应)。

效果截图

安装

dsh plugin add dsh-session-cost

(dsh 未全局安装时:npx --yes @deepseek-ai/dsh plugin --profile web add dsh-session-cost)

安装后重启 dsh web 生效。

怎么算的

  • 数据源:DSH 的 tokenUsage 会话投影(官方 dsh-token-meter 提供,与统计条同源):uncachedInputTokens / cacheReadTokens / cacheWriteTokens / outputTokens
  • 计费口径(对应官方账单):缓存写入按"未命中"单价计 费用 = (未命中 + 写入) × miss单价 + 命中 × hit单价 + 输出 × out单价
  • 价格:官方 https://api-docs.deepseek.com/zh-cn/quick_start/pricing
模型 百万输入(命中) 百万输入(未命中) 百万输出
deepseek-v4-flash(2026-08-17 前) ¥0.02 ¥1 ¥2
deepseek-v4-pro(2026-08-17 前) ¥0.025 ¥3 ¥6
deepseek-v4-flash · 高峰(9-12/14-18 北京时间) ¥0.10 ¥3 ¥9
deepseek-v4-flash · 空闲 ¥0.05 ¥1.5 ¥4.5
deepseek-v4-pro · 高峰 ¥0.30 ¥9 ¥27
deepseek-v4-pro · 空闲 ¥0.15 ¥4.5 ¥13.5
  • 2026-08-17 00:00(北京时间)起自动切换峰谷计价;高峰时段自动按北京时间判断

说明与限制

  • 估算值:仅供参考,与实际账单可能有出入(缓存写入归入未命中的口径、模型切换、四舍五入)
  • 模型:v1 按 deepseek-v4-flash 计(会话中途切换模型不追溯);要改默认模型/价格,编辑 lib/client.js 顶部的 DEFAULT_MODEL 与价格表
  • 显示"≈"标记表示估算

开发者

← 上一个 Prev dsh-prompt-optimizer 下一个 Next dsh-filelens →