940842546/dsh-usage-billing
Project Overview项目介绍
This is a native no-build usage tracking and billing plugin built exclusively for DeepSeek Harness. It automatically logs every DeepSeek model call across all local sessions, recording input, output, cache hit, and cache miss token counts. It calculates costs based on DeepSeek’s official changing pricing tiers, including the updated peak and off-peak pricing that took effect in mid-2026. The simplest installation method is running the dsh plugin add dsh-usage-billing command via the DSH CLI, and it can also be deployed by manually adding a user patch to your DSH cordis configuration.
The plugin is designed for DSH users who need to track and control their DeepSeek API spending. On first run, it automatically scans existing local session logs to backfill historical usage and cost data, attaches matching session titles to each entry, and saves the data to a persistent local file. During daily use, it displays current session usage on the main sidebar and below the input box, and you can click the sidebar card to open a full statistics modal with detailed breakdowns. It will also send desktop toast alerts when your spending crosses 80% and 100% of your configured budget threshold.
All usage and billing data is stored persistently in the .dsh-usage-billing.json file in your user home directory, so it persists across DSH restarts, and it supports exporting data as CSV or JSON for manual reconciliation. You can customize pricing tables, peak hours, exchange rates, and other settings directly within the plugin, and it can even pull your official DeepSeek account balance automatically and estimate how many more days your balance will last based on your average weekly spending. The plugin is released under the open-source MIT license, and it requires running DSH as a single instance to prevent conflicting writes to the shared data file; you will need to restart DSH after installing the plugin for it to take effect.
这是专为 DeepSeek Harness 开发的原生免构建用量统计与计费插件,可自动记录本机所有会话中 DeepSeek 模型的每次调用,统计输入输出、缓存命中/未命中的 tokens 数量,并按照 DeepSeek 官方的调价规则分段计算费用。它支持 DSH 官方的插件安装机制,可通过 DSH CLI 执行 dsh plugin add 命令一键安装,也支持手动添加用户补丁方式部署。
这款插件面向需要管控 DeepSeek API 调用成本的 DSH 用户,首次启动后会自动扫描本机已有的会话日志,回填历史用量与消费数据,日常使用中会在主界面侧边栏、输入框下方展示当前会话的用量,点击可打开完整统计弹窗,也可在设置页查看全量统计数据、图表和配置项。当花费超过预设预算阈值的 80% 和 100% 时,插件会主动发送桌面通知告警。
插件所有统计数据持久化保存在用户目录的 .dsh-usage-billing.json 文件中,重启后不会丢失,支持导出 CSV 或 JSON 格式数据对账,价格、时段、汇率都支持自定义配置,还可自动拉取官方账户余额并估算剩余可用天数。插件采用 MIT 许可开源,使用时需注意保持单实例运行,多实例同时写入会导致数据覆盖损坏,首次安装后需重启 DSH 生效。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-usage-billing(940842546/dsh-usage-billing)
仓库:https://github.com/940842546/dsh-usage-billing
本站详情页:https://www.yhbd.top/plugins/940842546-dsh-usage-billing/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 9 · 最近提交 2026-09-29 · 主语言 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 9 stars - very few users, little community feedback星标只有 9,几乎没人在用,遇到问题缺少社区反馈
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-usage-billing
把 940842546/dsh-usage-billing 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-usage-billing · DeepSeek 用量与消费统计插件
中文 | English
针对 DeepSeek Harness 的免构建双面插件:自动统计本机所有会话的 DeepSeek 模型调用,按官方定价分段计费,并在主界面与设置页提供图表化的用量面板。
计费口径:2026-08-17 00:00(北京时间)前旧价;之后峰谷定价(高峰为工作日 9:00–12:00、14:00–18:00(2026-08-23 起生效,此前周末同样计高峰),空闲价为高峰价的一半;9/10 12:00 起 flash 系列再次调价(空闲 hit 0.02 / miss 1 / out 4,高峰 ×2,pro 不变;V4 Pro 官方已确认 9/14 后继续提供服务、计费方式不变(仍按 pro 价;插件保留路由开关供将来官方恢复路由时开启,当前关闭)))。法定节假日与调休上班的周末全天空闲计费(内置 2026 年国务院放假安排,可在设置中自行增补)。价格表见文末。
功能
- 全自动统计:监听
llm/stream,所有会话的每次模型调用都会被记录(输入/输出/缓存命中/未命中 tokens) - 历史回填:首次启动自动扫描本机会话日志,重建历史用量与消费,并附会话标题
- 分段计费:按北京时间自动归入「调价前旧价 / 调价后高峰 / 调价后空闲」三段(2026-08-23 起高峰仅限工作日,周末全天空闲;此前周末同样计高峰;法定节假日与调休上班日全天空闲,节假日名单可在设置页编辑,2027 年安排公布后可自行增补)
- 预算告警通知:跨 80%/100% 阈值时桌面 toast 主动提醒(每日每档一次),进度条临近变橙、超支变红
- 定价可配置:价格表、高峰时段、调价边界日期、美元汇率均可编辑(改动只对后续调用生效),一键恢复默认
- 数据导出:一键导出 CSV(按日 / 按会话,文件名含日期范围)或 JSON,便于对账
- 官方余额拉取:自动检测已配置的 DeepSeek API Key,拉取官方账户余额(总余额 / 充值 / 赠金),每 10 分钟自动刷新,未配置 Key 时静默跳过
- 余额续航预估:按近 7 天日均花费估算余额可用天数与预计耗尽日期
- 告警历史:设置页展示最近预算告警记录
- 日趋势图:设置页近 30 天每日费用柱状图
- 统计更稳健:写入带 temp 副本,主文件损坏时自动恢复;双实例心跳检测告警
- 主界面:
- 侧边栏底部「Token 用量」卡片(当前模型 + 本会话 tokens/费用,千分位显示)→ 点击弹出居中「Token 用量与费用统计」弹窗(¥/USD 币种切换、总览卡片、按模型/按会话表格、预算进度、官方余额、分段占比、用量热力图)
- 输入框下方常驻一行当前会话的用量:环形进度(今日预算,≥80% 变橙、≥100% 变红)+ 花费/调用/tokens,点击弹出详情面板(本会话花费与今日合计、按计费时段着色的占比条、调用/输入/缓存命中率/输出明细、时段花费、模型分布、今日预算进度;Esc 或点击面板外关闭)——交互与样式对齐官方 ContextMeter
- 设置页 → 用量统计:完整明细(统计卡片、预算进度、分段占比、日/周/月/年/累计热力图(悬停即时显示 token 与金额)、按会话 Top 8(可点击打开对应会话)、按模型、最近调用、回填/清空/导出、计费与预算设置)
- 动态工具
usage_billing:模型可直接查询统计(“现在用了多少钱?”“今天呢?”——支持 today/month/all 范围) - 持久化:数据写入写策略根目录
.dsh-usage-billing.json,重启不丢(v0.5.4 前为.dsh-usage-stats.json,升级后自动迁移) - 中英双语:所有界面文案跟随应用语言设置即时切换(中文 / English)
界面预览
以下截图基于虚构演示数据。
统计弹窗 · 总览(主界面侧边栏卡片点开)

统计弹窗 · 图表区(分段占比 + 用量热力图,支持 ¥/USD 切换)

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