rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:limingwei-88/dsh-session-usage-meter
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
一个 DeepSeek Harness 插件:在侧边栏会话行的悬浮卡片里显示该会话的累计 Token 消耗与预估成本。
English: shows per-Session cumulative token usage and an estimated cost inside the sidebar session-row hover card.
assistant/message 事件上的 usage(输入 / 输出 / 缓存命中 / 缓存写入)。12.4k Tokens · 估算 ¥0.0081;鼠标悬停可见分项明细。# 从 npm 安装(发布后)
dsh plugin --profile web add dsh-session-usage-meter
# 从 GitHub 安装
dsh plugin --profile web add github:<owner>/dsh-session-usage-meter
# 从本地目录安装(开发调试)
dsh plugin --profile web add "C:\\path\\to\\dsh-session-usage-meter"
profile 说明:
--profile web是 DSH 的默认 Web profile;本机若运行的是别的 profile(例如 Desktop 使用desktop),把它换成你实际启动的 profile 名即可,否则装到了另一个 profile 里,当前界面不会出现该插件。
安装后重启 dsh 并刷新页面。dsh plugin ... add 只是把包加进 profile 的依赖;要让 bundle 真正挂载,还需要该包的 dsh.bundle.patch 被 profile 选中(本包已自带 cordis.patch.yml,在支持 dsh.bundle 的 DSH 版本上会自动登记)。
| 半边 | 作用 |
|---|---|
Host (index.js) |
仅用于让 bundle 行可解析,不注册任何资源。 |
Client (client.js) |
通过 ctx.slots.inject('sidebar.session.row.hover', ...) 注册一个区块,读取该会话已落盘的 assistant/message.usage 并求和。 |
数据全部来自会话自身的事件窗口,不发额外请求,也不把用量写回会话。
默认价格(人民币 / 每百万 Token)写在 client.js 的 DEFAULT_PRICES 中,按模型名匹配,匹配不到时使用 default:
| 字段 | 含义 | 默认值 |
|---|---|---|
input |
输入(缓存未命中) | 2 |
cacheRead |
缓存命中 | 0.2 |
cacheWrite |
缓存写入 | 2 |
output |
输出 | 3 |
不改代码覆盖价格:在浏览器控制台写入 localStorage 后刷新页面。
localStorage.setItem(
'dsh-session-usage-meter.prices',
JSON.stringify({ default: { input: 2, cacheRead: 0.2, cacheWrite: 2, output: 3 } })
)
金额是估算值,不是账单:它不包含套餐折扣、阶梯计价、缓存策略差异,也不计入未被 usage 覆盖的部分。
usage 的 assistant/message;早期历史或中断的调用可能没有 usage。default。node --check index.js
node --check client.js
node -e "JSON.parse(require('fs').readFileSync('locale/zh.json','utf8'))"
本仓库无构建步骤:client.js 直接是浏览器模块加载器接受的格式。
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。