
noone89A/dsh-gauge
40Last commit Aug 15, 2026
dsh-gauge DSH plugin
dsh-gauge enhances DSH Web UI by replacing the rounded cache hit rate with a precise configurable decimal value. It adds token bucket breakdowns, a usage panel, and real-time fee estimation that automatically follows DeepSeek's official price adjustments including peak/off-peak rates.
How to install the dsh-gauge DSH plugin
dsh plugin --profile web add dsh-gaugeCopying does not run this command. Review the repository and version before installing the dsh-gauge DSH plugin.
dsh-gauge DSH plugin data source
dsh-gauge DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-gauge DSH plugin can do
- Precise cache hit rate with configurable decimal places (0-2)
- Token bucket breakdown: hit, uncached input/output, auto-hides write bucket when zero
- Fee estimation using actual consumption × model unit price, with current vs new price comparison
- Peak/off-peak pricing per request timestamp (Beijing peak hours 09:00-12:00, 14:00-18:00)
- Peak/off-peak badge on the stats line
- Usage panel accessible via conversation header ⓘ button showing model, hit rate, token totals, context pressure, and fee
- Dual-line stats (native metrics + precise usage), configurable to replace or append
- Bilingual UI (English/Chinese) and currency auto-adaptation (USD/CNY)
Where the dsh-gauge DSH plugin fits
- Monitor actual token consumption and cache efficiency to optimize API usage costs
- Compare current fees with upcoming new pricing to plan budget adjustments
- Evaluate how peak/off-peak timing affects billing for individual conversations
- Debug token distribution across buckets during development or testing
- Quickly view per-session fee estimates and model details via the usage panel
Who the dsh-gauge DSH plugin is for
- DeepSeek API users who want precise cache hit rate and fee transparency
- Developers using DSH Web UI to manage conversational AI sessions
- Users sensitive to token costs and needing accurate fee projections
dsh-gauge DSH plugin limitations
- Write bucket auto-hides when zero; some adapters never report cache-write tokens
- Fee estimates are approximations; official bill may differ
- Configuration card requires whitelist patch in current DSH version (core functionality works without it)
- Requires DSH environment and token usage projections from @deepseek-ai/dsh-token-meter
dsh-gauge DSH plugin: from the repository README
Quoted from the noone89A/dsh-gauge README, the upstream source of the dsh-gauge DSH plugin. Copyright remains with the original authors.
中文 | [English](README.en.md) 为 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 峰谷定价的高峰窗口。统计行尾按当前时段显示**高峰**/**闲时**状态(切换为新价后同样按当前时段显示)。 - **用量面板** — 会话页头 ⓘ 按钮弹出面板:模型、命中率、计费输入、各桶总数(默认完整数字)、上下文占用与费用估算(含调价后对比)。 - **两行统计(官方指标 + 精确用量)** — 第一行保留官方会话指标(轮/步、LLM/工具调用时长、首 token 平均、tok/s),复刻官方样式(行距刻意收紧,两行视为一个整体);第二行是插件的精确用量(命中率、分桶、输出、费用、高峰/闲时徽标)。`replaceNativeStatsLine: false` 时保留官方原生行(含原生用量段)。 - **双语 & 货币自适应** — UI 为英文时文案切英文、费用按国际价目表以 USD 估算。语言与货币实时跟随,无需重启。 ## 截图   does not include third-party plugins by default. To enable the card, add `"gauge"` to that array in the host's `index.js` file (see troubleshooting section in README). The core functionality works without the card; you can also configure via `cordis.patch.yml` instead.
Why is the write bucket always showing 0?
Some adapters (like opencode-go/pi-ai) never report cache-write tokens. The plugin automatically hides the write bucket when its value is zero. If an adapter starts reporting write tokens in the future, the bucket will reappear. This is by design.
How accurate is the fee estimation? Can I rely on it for billing?
The fee estimation uses actual token consumption from the session history multiplied by the built-in price plans (CNY and USD). However, it is an approximation and may differ from the official bill. Always refer to the official DeepSeek billing statement for actual charges. The plugin automatically updates to new pricing at the configured effective date.
How does dsh-gauge differ from dsh-usage?
dsh-gauge focuses on precision and efficiency: it provides a precise cache hit rate (configurable decimals), peak/off-peak pricing per message timestamp, and automatic price transition. dsh-usage offers per-turn readings and a cross-session usage page with heatmap and provider summaries. Both plugins can coexist without conflict as they use different slots and IDs.