Evidence snapshot reviewed Sep 16, 2026GitHub checked Aug 21, 2026
Evidence-verifiedPlugin BundleDeveloper ToolsWeb Profile

DSH Cache Billing

Shows estimated cache, input, and output costs in DSH's context-ring popover.

At a glance

What it does

Shows estimated cache, input, and output costs in DSH's context-ring popover.

Use cases
Developer ToolsDataVisualizationSession Management
Works with
DshWeb
Compatibility

Web Profile
Not declared in supplied evidence

Trust & status

Evidence-verified
Checked Sep 11, 2026, 1:58 PM UTC

Code-evidenced contributions

What it adds to DSH

Web UIContext-ring billing panel

Adds step, turn, and session cost details to DSH's context-ring popover.

Mechanism evidence

Before you choose it

This DSH web bundle adds a billing section to the context-ring popover. It breaks estimated usage into the current API step, current turn, and entire session, including cache-hit, cache-miss, and output tokens. It applies Beijing-time peak/off-peak pricing and can show estimates when a nonofficial relay reports usage.

Best for

DSH users who want to see estimated token costs while deciding whether to continue or switch a long-running chat session.

Common tasks

  • Compare the current step, turn, and session's estimated token charges.
  • Spot cache costs that grow as a conversation accumulates context.
  • Review estimated usage from routes that report provider and usage data, including third-party relays.

Permissions and data

Processes reported usage data locally to calculate and display estimates in the DSH web interface.

Permissions
  • Adds dsh-cache-billing to the selected profile's layer stack.
  • Injects a client component into the DSH web context-ring interface.
Data handling
  • Uses usage categories including input, cache read, cache write, and output tokens for local estimation.
  • Maintains step, turn, and session-level accounting according to the supplied documentation.
External services
  • No external service requirement is declared; the plugin uses usage reported by the active route.
Credentials
  • No credential requirement is declared in the supplied evidence.

Limitations

  • Estimates use the DeepSeek-V4.1-Flash price model and documented model-name handling; unmatched models are still estimated at that price.
  • Actual provider charges may differ from the displayed estimate.
  • Only routes with a nonempty provider and reported usage are described as displayable.
  • No Harness version range is declared.

What DSHub checked

  • The immutable source commit, package manifest, bundle patch, and npm registry identity were captured.
  • The bundle patch enables dsh-cache-billing in a profile, and the manifest declares a web client.

What DSHub did not check

  • Installation, restart behavior, UI rendering, and runtime calculations were not executed.
  • Published npm package contents were not audited.

Pinned install

Install DSH Cache Billing

This plugin bundle does not have a DSH Plugin install action. Use its source documentation for the delivery method.

Visit the source project

Maintainer source

Project README

View at commit f2c7750
Maintainer-authored contentCaptured from README.md on Sep 11, 2026. The text and repository-relative media are fixed to commit f2c775087328 with content hash 7fc5a6e5a2c4; provider-hosted badges may update independently. README commands are upstream documentation; the DSHub copy action above is the verified, version-pinned install.

dsh·缓存账单插件

参考 dsh-meow-cachebilling 的思路重写,默认支持第三方中转与多级账单明细。

在上下文圆环弹层里实时算账,告诉你当前步、当前轮、整个会话各自花了多少钱,好让你知道什么时候该换窗口。

第三方中转照常记账,不限定 DeepSeek 官方路由。

引言

DSH 的上下文圆环是给「上下文用了多少」看的,可真正该看的是「这花了多少钱」。缓存命中率高是好事,但上下文越长,每轮带上的缓存前缀就越贵;到了换窗口的关口,旧窗口每动一次都是给缓存付费,还未必看得到数。

所以做了这个插件,把账算到明面上:当前步、当前轮、会话累计三块账,逐笔按各自时刻的峰谷费率累加,缓存命中、未命中、输出列得清清楚楚。心里有底,才知道窗口该不该换。

哦对了,这插件不挑路由——官方也罢、SiliconFlow 这种中转也罢,只要报用量,就照样记账。中转的价格表跟官方不一样时,模型名命中价目表就按估算金额显示,宁近似,不空转。

功能

  • 第三方中转也认:不限定 DeepSeek 官方路由,provider 非空即显示,模型名命中价目表就按估算金额计价。凭空 provider 的路由不会显示。
  • 三块计时级别:从上到下依次是当前步、当前轮、会话累计。当前步是单次 API 调用,当前轮是本轮内多步累加,会话累计带步数。每块一行标题带总额与总 token,下面缩进细列缓存命中、缓存未命中、输出三行,各带 token 数与金额。
  • 会话累计:整会话的累计花费,逐笔按各自事件时刻的峰谷费率累加,跨轮不比价。会话块还有缓存失效统计:缓存失效次数与完全失效次数,部分中转会报写入量,一并显示。
  • 峰谷计价自动判定:工作日高峰时段北京时间 09:00–12:00、14:00–18:00 按峰价,其余时段及周六日全天按谷半价。与系统时区无关,纯事件时刻换算。
  • 单一模型计价与显示:只按 DeepSeek-V4.1-Flash 计价,界面统一显示「按 DeepSeek-V4.1-Flash 计价」。模型名认官方现名 deepseek-flash、历史旧名 deepseek-v4-flashdeepseek-v4-flash-vision-exp、以及 deepseek-v4.1-flash 及其带后缀变体;没命中白名单的模型仍按 Flash 价估算并标注实际运行模型名。低谷价 缓存命中 0.02 / 未命中输入 1 / 输出 4 元每百万 token,高峰翻倍,价格写在 src/index.ts
  • 金额精度分级别:步四位小数、轮三位、会话两位,尾零不省,便宜到 0.0001 也看得出不是零。

账单底部小字标注当前是峰价还是谷价,并附「按 DeepSeek-V4.1-Flash 计价」;模型名没命中白名单时小字改为「估算」并标注实际运行模型。

效果

点开输入框右侧的上下文圆环,弹层底部就是账单,跟「上下文用了多少」同屏对看:

效果预览

安装

从 GitHub 安装:源码在 src/lib/ 不入仓库,安装时 npm 会触发 prepare 脚本现场构建。

dsh plugin --profile web add github:better-er/dsh-cache-billing

从 npm 安装:包内已含构建产物 lib/index.jslib/client.js,安装时不再构建。

dsh plugin --profile web add dsh-cache-billing

两种方式装完都会自动挂载,重启 DSH web 后启用,无需手工编辑任何文件。

卸载

dsh plugin --profile web remove dsh-cache-billing

彻底移除,重启 DSH web 后不再加载。

要求与开发

  • 标准形态的 dsh 主机加客户端双半身插件:host 投影层在服务端折叠事件记账,./client 把账单贴进官方上下文弹层。
  • host 侧用 sessionProjections 实现:会话内的步、轮、会话累计三级账目都由投影层按事件时刻的费率逐笔核算,apply 返回同一引用即无变化。
  • host 侧由 src/index.ts 经 esbuild 构建到 lib/index.js,client 侧由 src/client.ts 构建到 lib/client.jspackage.json 声明 dsh.client.platform: "web"exports["./client"] → ./lib/client.js,改源码后执行 npm run build 重建。
  • 账目只认 usage 的 input / cacheRead / cacheWrite / output 四类 token,本地估算,实际扣费以账单为准。
  • 价格、峰谷时段、模型名白名单与显示名都写在 src/index.tsMODEL 常量里,调整后重建即可。

License

MIT

Operate deliberately

Install and manage

Prerequisites and target Profile

Target Web Profile

Delivery Dsh Bundle Git — better-er/dsh-cache-billing#f2c77508732877428575d4aeb57704cc17b238d2

Verify, update, and remove

Show lifecycle commands
Verify
dsh plugin --profile web list

Compatibility and access

DSH web client bundle with host and client components Not declared in supplied evidence

Review compatibility evidence

Risk facts

Lifecycle_script

GitHub-source installation runs the package prepare build script.

Evidence
Local_cost_estimate

Displayed charges are local estimates, not the provider's authoritative bill.

Evidence
Evidence and editorial reviewManifest, Bundle patch, distribution and freshness

Immutable evidence

Review status and source activity

AI reviewed

MIT-licensed package. The pinned Git bundle is the clearest auditable installation source; source installation may build locally through its prepare script.

AI reviewed Sep 11, 2026, 1:59 PM UTCGitHub facts last checked Sep 11, 2026, 1:59 PM UTC

No material source change has been recorded since this evidence baseline.

Next step

Follow the Plugin installation workflow

Subscribe to material changes for DSH Cache Billing