rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Lstalu/dsh-quota-meter-plus
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Per-session spend & quota meter for DSH — real token billing, live progress bar, budget blocking, configurable multi-model pricing.
给 DSH 的每个会话窗口设置金额额度:按真实 token 用量 × 可配置价目表记账,输入框上方显示消耗进度条,额度耗尽时自动拦截新的模型调用。
| 设置额度 | 消耗反馈 |
|---|---|
![]() |
![]() |
| 未配价模型提示 | 限额弹窗 |
|---|---|
![]() |
![]() |
| 余额校准胶囊(v0.3.0) | |
|---|---|
![]() |
屏幕右上角常驻悬浮:账户余额(官方真实值)+ 实测消耗 + 本会话 已花/剩余,可手动 ↻ 刷新 |
llm/stream 的真实 usage 记账,缓存命中/未命中/输出分档计费-¥ 金额徽标agent/pre-step),并弹出提示~/.dsh/storages/dsh-quota-meter-plus/sessions/),重启 dsh 不丢;会话关闭时自动清理,与对话记录生命周期一致Any machine with dsh CLI — 任意装有 dsh 的机器,一条命令:
dsh plugin --profile web add github:Lstalu/dsh-quota-meter-plus
Locked version — 锁版本安装(推荐正式环境):
dsh plugin --profile web add github:Lstalu/dsh-quota-meter-plus#v0.5.1
dsh plugin --profile web remove dsh-quota-meter-plusLocal development — 本地开发用 checkout 链接(改动即时反映):
dsh plugin --profile web add /path/to/dsh-quota-meter-plus
升级注意(已有安装者):默认价目表随版本更新,但本机
prices.json(如已存在)会覆盖默认值。 升级到含新价格的版本后,需在价格弹层点「重置」或删除~/.dsh/storages/dsh-quota-meter-plus/prices.json才会用到最新默认价。
价目表动态可编辑(UI 入口:额度条行尾「价格」),持久化到 ~/.dsh/storages/dsh-quota-meter-plus/prices.json。
单位 ¥/每 1M tokens。计价基准:官方 2026-09-11 中文页直接给人民币价,不再做汇率折算
(旧版按 2026-08-21 美元价 × 6.78 折算出的数字已全部替换)。价格仍可在 UI 修改。
✅ 官方核对(2026-09-11):价格与 api-docs.deepseek.com/quick_start/pricing 逐项一致。高峰时段为北京 09:00–12:00、14:00–18:00(周一至周五), 空闲 = 高峰半价,周六、周日全天按空闲价计费。 官方 usage 仅报告
prompt_cache_hit_tokens/prompt_cache_miss_tokens, 无独立的缓存写入计费字段(硬盘缓存构建成本并入未命中价), 故cacheWriteTokens对 DeepSeek 恒为 0,inputWrite档仅影响其他厂商。
⚠️ 模型名迁移(2026-09-10 生效):
deepseek-v4.1-flash-expires-on-0910已失效 (服务端 400:no longer supported since 2026-09-10),正式名为deepseek-flash。 旧名deepseek-v4-flash与deepseek-v4-flash-vision-exp仍可调用, 但请求由 V4.1-Flash 提供服务并按 Flash 价计费——三者必须同价,否则账目会漂。
| 缓存命中 | 缓存未命中 | 输出 | |
|---|---|---|---|
| 空闲时段(含周末) | ¥0.02 | ¥1 | ¥4 |
| 高峰时段 | ¥0.04 | ¥2 | ¥8 |
| 缓存命中 | 缓存未命中 | 输出 | |
|---|---|---|---|
| 空闲时段(含周末) | ¥0.15 | ¥4.5 | ¥13.5 |
| 高峰时段 | ¥0.30 | ¥9 | ¥27 |
📌 V4 Pro 下线计划:北京时间 2026-09-14 12:00 之后至 V4.1 Pro 上线前,
deepseek-v4-pro的请求全部路由到 V4.1 Flash 并按 Flash 价计费; 届时若账目需要精确,应把该条切到 Flash 价或直接用deepseek-flash。
fallback 模型价计费输入 = 未缓存输入 + 缓存命中输入,输出单独计价模型调用结束 → llm/stream 流中 {type:'usage'} 块
→ Host 按模型查价目表(峰谷自动选档)折算金额
→ 累加到会话记账本(spent / calls)
→ 客户端 1s 轮询 /quota/state → 进度条前进 + 扣费徽标弹出
额度耗尽 → agent/pre-step 返回 reject → 拦截新调用 + 提示弹窗
git clone git@github.com:Lstalu/dsh-quota-meter-plus.git
dsh plugin --profile web add ./dsh-quota-meter-plus # 本地链接安装
改 index.js(host)/ lib/client.js(client)→ client 刷新即生效,host 重启生效。
本仓库为增强维护版,基于官方 d9941af 基线,在官方基础上打了五处补丁(均可提交上游):
同源防护(安全):/quota/* 是本地写接口(改额度 / 改价目表),
浏览器里任意外部网页都能向 127.0.0.1 发跨源请求。host 端新增
isSameOrigin 校验——带 Origin 的请求要求其 host 与请求 Host 头
完全一致,跨源一律 403;无 Origin 的客户端(curl、本机进程)放行。
inputWrite 计费档(口径修正):cacheWriteTokens 不再并入
"缓存命中"低价档,改用独立的 inputWrite 单价(缺省 = 未命中价,
保守不低估;Anthropic 等写缓存按 1.25× 输入价计的厂商可自行调高)。
三档价格组扩展为四档 { inputMiss, inputHit, output, inputWrite },
旧价目表自动归一化(缺省 = inputMiss),价格弹层编辑不丢该字段。
DeepSeek 适配器不报告 cacheWriteTokens,该档对 DeepSeek 恒为 0,
默认配置下记账与官方口径一致。
屏幕右上角常驻悬浮胶囊 + 账户余额校准(v0.3.0):
shell.overlay,z-index 900),常驻显示
「账户余额(官方真实值)+ 实测消耗」与「本会话 已花/剩余」两行;
会话额度 10s 轮询,账户余额 60s 轮询,可手动 ↻ 立即刷新。GET https://api.deepseek.com/user/balance
(platform.deepseek.com/usage 网站余额的同一数据源,文档化、稳定,
无需登录态 cookie 爬网页)。host 端 60s 缓存 + 10s 超时 + 首次
拉取自动记录基线;实测消耗 = 基线 − 当前余额(账户级口径),
供与插件会话记账对照校准。⚙ 弹层保存,落盘
~/.dsh/storages/dsh-quota-meter-plus/config.json(0600,仅本机),
或设环境变量 DSH_DEEPSEEK_API_KEY / DEEPSEEK_API_KEY;
密钥只发往 api.deepseek.com,接口绝不回显。重设基线 按钮可在
充值后重新锚定参考点。留空保存 Key 不再清除 + 独立「清除密钥」按钮(v0.4.2,防误清空):
/quota/config 收到空的 apiKey 时视为"保留现有 Key",不再覆盖、不再
清除——避免在胶囊 ⚙ 弹层误点「保存」把密钥清掉。只有填入非空 Key 才会
更新;如需清除,用弹层新增的「清除密钥」按钮(带确认)显式清空。
子代理 / 多 agent 归属改用权威 header(计费归属修复):权威父子关系在
会话 header 里——dsh-subagent 创建子会话时写入 parentSession +
origin:'subagent'(+ delegationDepth),活着的 Agent 直接暴露
agent.session.header(dsh-subagent 自己的 authorizeLineage 就这么读)。
host 端在 agent/pre-step(agent loop 对每个 agent 的每一步派发,早于该步的
模型调用)按 header.origin === 'subagent' 认领子会话、建立 child → 根父映射,
并删除旧的 tools/result + /^subagent/ 工具名 FIFO 配对。
subagent/start:它的回调只收到 info(runId/provider/id/local)
——parent 被 createLifecycleEmitter 当作 scoped dispatch 的 carrier 用掉了
(ctx.events.dispatch('emit', [carrier(parent), name, info]) 之后只
callback(info)),第二个参数恒为 undefined。subagent 工具名,而 AgentTeams 成员经
agent_teams_* spawn,永远等不到匹配的 tools/result,映射建不起来 →
成员消耗留在成员自己的账本里(发起会话的额度条看不到),成员会话销毁时
账本文件又被 session/disposed 删除。parentSession(seed lineage),但
origin 不是 'subagent' —— 那是用户自己开的新对话,不能并账;过滤条件
与官方 listChildren 保持一致。parentId 恢复映射)。node test/subagent-attribution.test.mjs。MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。