DeepSeek Harness Plugin Hub

Publish and manage complete Harness Profiles. Discover Plugins for your next setup.

Explore

PluginsPresetsDocsNews

Community

Publish a pluginContactReport an issue

Resources

Plugin Hub on GitHubDeepSeek HarnessSystem statusPrivacy notice
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

Independent and unofficial. Not affiliated with, authorized by, or endorsed by DeepSeek.

Cache Cost Monitor — DSH Plugin for DeepSeek Harness
DeepSeek Harness Plugin Hub
ProfilesPluginsCategoriesNewsDocsSign inManage Profiles
ProfilesPluginsCategoriesNewsDocsSign in
← Plugins
C

dsh-cache-cost-monitor

Cache Cost Monitor

DSH (DeepSeek Harness) v0.1.x Cordis plugin: Automatically monitors cache hits, cache misses, and output tokens for each model API call, provides real-time statistics on the cache hit rate and estimated API costs based on official pricing (including peak and off-peak periods), registers the cache_re

The plugin will be installed here. Keep web if you are unsure.

npx -y @deepseek-ai/dsh plugin --profile web add github:eurt-nano/dsh-cache-cost-monitor#73ee7a1d9898d0964023b97a177a353eef2095c9
READMECompatibilityVersions
Plugin screenshotPlugin screenshot

Description

DSH (DeepSeek Harness) v0.1.x Cordis plugin: Automatically monitors cache hits, cache misses, and output tokens for each model API call, provides real-time statistics on the cache hit rate and estimated API costs based on official pricing (including peak and off-peak periods), registers the cache_report tool, and discreetly displays the tokens and RMB cost for the current round at the end of each message in the browser.

Compatibility and provenance

Cache Cost Monitor is published as dsh-cache-cost-monitor and currently resolves to version 0.3.1. The Hub verifies its manifest and preserves the exact installation source for reproducible installs.

DSH compatibility
*
Runtime surfaces
web
Release source
github
Registry updated
8/27/2026

Versions

0.3.1stable
8/27/2026

Related plugins

Loading related plugins…

Latest
0.3.1
DSH
*
HMR
Process restart
Tree shaking
Safe tree shaking not declared
Unpacked size
Unavailable
Files
Unavailable
Surface
web
License
MIT
Source
github
GitHub
★ 2
Weekly downloads
0
Last push
8/27/2026
View source ↗
README badge

Click the badge to copy Markdown for your README.

Do you maintain this Plugin?Claim benefit · Priority security scan

Verify the GitHub repository declared in package.json to manage this listing. After you claim it, Hub will prioritize a security scan of the current version and publish the result when it passes.

Claim this Plugin →
Report an issue

Related plugins

More verified plugins in models-usage.

Usage@linxin666/dsh-usageUsage statistics plugin for the dsh web GUI: per-provider balance and coding-plan quota detection plus a live token usage ledger, with the current session provider's today usage on the sidebar entryUsage Stats@ychris12138/dsh-usage-statsToken usage heatmap, provider balances, and subscription quotas for the dsh web GUICodex Connectdsh-codex-connectChatGPT OAuth and Codex models for DeepSeek Harness.Ui Usage Billing@kenz1117/dsh-ui-usage-billingUsage billing dashboard for DeepSeek Harness: sidebar cost metrics plus a full dashboard modal, priced from a current multi-provider catalog with real usage aggregated from session logs.

README

image image

🧮 dsh-cache-cost-monitor

让 DeepSeek 的每一分钱都花在刀刃上 —— 前缀缓存命中率、费用与健康度,一眼看穿。

DSH(DeepSeek Harness)v0.1.x 的 Cordis 插件:自动监听每一轮 Agent 的模型 API 调用,提取 prompt_cache_hit_tokens / prompt_cache_miss_tokens / completion_tokens,实时统计缓存命中率与按官方定价(含峰谷时段)预估的 API 费用,并给出缓存健康度评级与趋势火花线。


✨ 它为什么值得收藏

特性说明
📊cache_report 工具一行摘要(命中率/费用/健康度)+ 趋势火花线 + 成本明细 + 3 条针对性优化建议
🏆缓存健康度评级累计命中率一键换算 S/A/B/C/D + 🟢🟡🟠🔴,像游戏评分一样直观
🖥️常驻统计条输入框下方实时显示 ⌀ 1.2M tokens · ¥2.01 · 命中 68% ▂▅▇█,低头即见
📝消息末尾页脚每条助手回复末尾低调显示 本轮 12.3K tokens · ¥0.0123,hover 看明细
⏱️峰谷计价官方 PEAK/OFF-PEAK 时段自动判定(UTC 00:30–16:30),费用按实际时段计算
💰费用预算设置 budgetUsd,超支自动告警 + 报表标注 ⚠️,心里有底
🚨阈值告警单轮/累计命中率低于阈值即输出 warn 日志,状态翻转防刷屏
🛡️优雅降级字段缺失、无定价、服务不可用……任何异常都只记日志,绝不拖垮主程序

🏗️ 架构一览

flowchart LR
  A[Agent 会话] -->|"每次模型调用<br/>llm/stream 瀑布流"| B[dsh-cache-cost-monitor 宿主]
  B --> C[CacheStats 统计器<br/>累计/趋势/分桶/预算]
  C --> D[cache_report 工具<br/>模型可直接调用]
  B --> E[sessionProjections<br/>cacheCost 投影]
  E --> F[消息末尾页脚<br/>conversation.chat.turnTail]
  E --> G[常驻统计条<br/>conversation.composer.dock]

宿主侧(Node)负责监听与统计;浏览器侧(React)只读投影快照渲染 UI。两者通过 DSH 官方能力缝连接,无任何私有 API。


🎬 效果预览

输入框下方的常驻统计条(实时,随每轮更新):

⌀ 1.2M tokens · ¥2.01 · 命中 68% ▂▅▇█

每条助手消息末尾的页脚(低调,hover 可看命中/未命中/输出明细):

本轮 12.3K tokens · ¥0.0123

启动日志 banner(一眼确认插件状态):

╔══════════════════════════════════════════════════════════╗
║   dsh-cache-cost-monitor  v0.3.0                         ║
║   缓存命中率 · 费用预估 · 峰谷计价 · 健康度评级          ║
╚══════════════════════════════════════════════════════════╝

cache_report 报表开头(模型一句话即可召唤):

# 缓存命中率与成本报告(cache_report)

> 📊 **摘要**:命中率 68.4% · 费用 $0.0312(¥0.2122)· 12 轮 · 健康度 B 🟡

## 累计统计
- 模型调用次数:12
- 累计缓存命中率:68.4%
...

## 命中率趋势(最近 5 轮,右为最新)
> 火花线:▂▅▇█▅
| 轮次 | 模型 | ... | 单轮命中率 | 单轮费用 |
| --- | --- | --- | --- | --- |
...

📦 安装

前置

  • Node.js >= 18
  • pnpm(corepack enable 或 npm i -g pnpm)
  • DSH v0.1.x

方式一:一键脚本(本地开发)

cd dsh-cache-cost-monitor
npm install && npm run build && npm test
powershell -ExecutionPolicy Bypass -File scripts\install-profile.ps1

方式二:从 GitHub 安装(仓库即发布源)

# 固定版本(推荐)
dsh plugin --profile web add https://github.com/eurt-nano/dsh-cache-cost-monitor.git#v0.3.0 --config.node-linker=isolated

# 或最新 main
dsh plugin --profile web add https://github.com/eurt-nano/dsh-cache-cost-monitor.git#main --config.node-linker=isolated

方式三:Release 附件

从 Releases 下载 dsh-cache-cost-monitor-0.3.0.tgz,本地解压后按方式一安装。

Windows 说明:pnpm workspace 对盘符绝对路径创建链接存在 bug,安装/移除命令请保留 --config.node-linker=isolated;git 安装时若 pnpm 拦截构建脚本,把 dsh-cache-cost-monitor 加入 profile 的 pnpm-workspace.yaml 的 allowBuilds 列表。

安装后 重启 DSH(dsh web),页脚与统计条需刷新浏览器页面。


🎮 使用

  1. 召唤报表:对 Agent 说「调用 cache_report」,或让它「看看缓存命中率和花了多少钱」。 可选参数:{ "detail": true, "limit": 10 } 输出逐轮明细(含计价档位、实际单价、时间戳)。
  2. 看常驻统计条:输入框下方实时累计消耗,无需任何操作。
  3. 看页脚:每条助手回复末尾的灰字小标。
  4. 看日志:[cache-monitor] 前缀的 warn/info 输出告警与启动信息。

⚙️ 配置参考(cordis.patch.yml)

字段默认说明
threshold0.3单轮缓存命中率告警阈值(0~1)
cumulativeThreshold0.3累计命中率告警阈值(0~1),状态翻转时提示一次
historySize20趋势窗口轮数(>= 2)
warnOnMissingUsagetrue响应缺 usage 字段时是否输出 debug 日志
timeBillingauto峰谷计价:auto(高峰 UTC 00:30–16:30)/ peak / off-peak
currencyboth费用显示:USD / CNY / both
usdCnyRate6.8美元→人民币汇率
budgetUsd未设置累计费用预算(USD):超出后 warn 告警并在报表标注 ⚠️
pricing官方定价按模型 ID 的定价表(USD / 每百万 tokens)

内置定价(cacheHit / cacheMiss / output):

模型OFF-PEAKPEAK
deepseek-v4-flash0.007 / 0.22 / 0.660.014 / 0.44 / 1.32
deepseek-v4-pro0.022 / 0.66 / 1.980.044 / 1.32 / 3.96
deepseek-chat0.028 / 0.28 / 0.42—
deepseek-reasoner0.14 / 0.55 / 2.19—

未配置的模型按 0 计费并在报表中标注;deepseek-v4-* 变体按前缀回退。


📈 健康度评级规则

评级累计命中率表情含义
S≥ 85%🟢缓存利用极佳,成本控制优秀
A≥ 70%🟢良好
B≥ 50%🟡中等,有优化空间
C≥ 30%🟠偏低,缓存频繁失效
D< 30%🔴几乎无命中,费用偏高

❓ FAQ

Q:数据存在哪?重启后还在吗? cache_report 的进程内累计统计随 DSH 重启归零;每条消息的页脚数据来自会话投影(随会话落库,重启后历史轮次仍可显示)。

Q:为什么我的消息末尾没有页脚? 页脚只显示插件安装之后、且 API 响应携带 usage 的轮次;产出了文件的轮次会让位给官方 "Produced" 行。tokens 直接读会话快照(引擎自带每轮 usage),人民币费用经 cacheCost 投影(v0.3.1 起宿主注入 sessionProjections,保证投影注册);升级后请重启 DSH 并刷新页面。

Q:费用是精确的吗? 按「配置定价 × 实际 token 数」估算,不含折扣、重试与网关加价;未配置定价的模型按 0 计。官方调价后在 config.pricing 覆盖即可。

Q:页脚不显眼,我想更醒目/更隐蔽? 样式是 CSS 变量 + 透明度控制,可在浏览器端自行调整;也欢迎提 issue 增加配置项。


🗺️ Roadmap

  • 跨会话累计统计持久化(重启不丢)
  • 报表导出 Markdown / CSV / JSON 文件
  • 缓存失效原因诊断(compaction/动态注入检测)
  • 告警通道扩展(Webhook / 桌面通知)
  • 峰谷时段本地化配置(自定义时区窗口)

有想法?欢迎 提 issue 或 PR。


🤝 贡献

npm run build    # tsc 宿主 + tsdown 客户端
npm test         # 42+ 项冒烟测试,改代码请保持全绿
  • 宿主逻辑为纯 ESM,可脱离 DSH 用 test/smoke.mjs 的假 ctx 驱动验证;
  • 客户端组件使用 React.createElement,平台模块由 shell 模块表提供。

📄 License

MIT © 2026 eurt-nano


English README:README.en.md