← 返回列表
D

dsh-gauge

v0.1.1 · 2 天前发布

Accurate cache-hit rate, token usage, and cost estimates for the DeepSeek Harness Web UI: one-decimal hit rate, bucket breakdown, peak/off-peak pricing with auto price-switch, and a session usage panel.

dshdsh-plugindeepseek-harnesscache-hittoken-usage

README

dsh-gauge

中文 | English

为 DeepSeek Harness Web UI 提供精确缓存命中率、token 用量与费用估算。

官方统计行把缓存命中率四舍五入成整数——Math.round 会把 99.8% 显示成误导性的 100%
dsh-gauge 用一位小数(可配置)的精确数值顶替它,并补充分桶 token 明细、会话用量面板,以及自动跟随 DeepSeek 官方调价的会话费用估算(使用官方 API)。

功能

  • 精确缓存命中率cacheRead / (cacheRead + uncached + cacheWrite),小数位可配置(默认 1),99.8% 就是 99.8%。

  • 分桶明细 — 命中 / 未命中输入 token 与输出 token。写入桶为 0 时自动隐藏(opencode-go/pi-ai 适配器从不报告 cache-write,实际恒为 0)。

  • 费用估算 + 调价对比 — 按实际用量 × 模型单价估算(deepseek-v4-flash / deepseek-v4-pro,自动从会话推导)。官方新价生效前显示 当前费用 + 新价费用 + 预计涨幅;生效时刻自动切换到新价。

  • 按请求时刻的峰谷计价 — 估算不是"当前时刻"快照:每条 assistant 消息按自己的时间戳计价,高峰时段消耗的 token 按高峰价、闲时按折扣价,最后求和。

  • 高峰时段徽标 — 北京时间 09:00–12:00 / 14:00–18:00 为 DeepSeek 峰谷定价的高峰窗口。统计行尾按当前时段显示高峰/闲时状态(切换为新价后同样按当前时段显示)。

  • 用量面板 — 会话页头 ⓘ
  • 版本兼容矩阵

    DSH 版本状态说明
    dsh@0.1.0-rc.6 ✅ 兼容 cordis patch ✅
    dsh@0.1.0 ✅ 兼容 标准 patch ✅
    dsh@0.2.0 ⚠️ 待验证 待实测(API 可能在变)
    dsh@0.3.0+ ❓ 未知 尚未发布

    💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正

    元数据

    License
    MIT
    npm
    dsh-gauge
    Repo
    Engines
    {}
    Weekly DL
    0
    Monthly DL
    0
    dsh.bundle
    {"bundle":{"patch":"./cordis.patch.yml"},"client":{"inject":["@deepseek-ai/dsh-client-runtime","@deepseek-ai/dsh-client-locale","@deepseek-ai/dsh-client-ui-slots"],"platform":"web"}}