跳到正文
cccskills
免费在 GitHub 公开中文介绍

cost-counterfactual

比较实际使用不同AI模型的费用与全部任务统一使用同一模型的估算费用,按时间范围输出节省金额和比例,帮助核查模型选择的成本表现。

原文查看原文说明

Multi-baseline counterfactual cost analysis. Compares actual session spend to hypothetical always-haiku / always-sonnet / always-opus routing baselines. Answers "is the routing earning its keep?" Negative savings flag over-escalation; positive savings quantify the router's win.

AI 评分90分/ 100查看安装方法

适用场景

  • 在费用评审中报告节省效果
  • 核查模型选择设置变更后的费用
  • 在CI中检查节省比例门槛
  • 调查超出低价模型基准的支出

中文介绍

功能

比较实际使用不同AI模型的费用,与全部任务统一交给Haiku、Sonnet或Opus时的估算费用。技能读取cost-tracking中保存的会话记录,将输入、输出以及缓存写入和读取都计入费用,并以表格或JSON输出各基准模型的总费用、节省金额和节省比例。

适用场景

适合在定期费用评审中说明模型分工带来的节省,也可在修改模型选择设置后,检查费用表现是否变差。使用JSON结果,可以在节省比例低于指定值时让CI检查失败。与低价模型的基准比较,也可用于调查超出该基准的支出。

使用示例

  • “比较最近七天的实际费用与全部任务使用Sonnet的估算费用。”
  • “以JSON输出三个基准模型各自的节省金额和节省比例。”

注意事项

比较需要cost-tracking的会话记录。估算假设相同的词元数量能够获得相同结果,不考虑回答质量或失败后的重试。相对于低价模型出现负节省金额,并不能据此断定选择更昂贵的模型不合理。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确说明实际费用与三个模型基准的比较目的,并列出费用评审等场景。
步骤具体性步骤、输入输出和示例是否具体
A良好提供记录读取、时间筛选、计算公式和表格输出示例。
安全性发送数据、删除文件、执行命令等是否有说明
A良好步骤为读取和汇总会话记录,未记载删除或向外部发送数据。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要`cost-tracking`中的记录,但未提供准备这些记录的步骤。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月21日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md3.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Multi-baseline counterfactual cost analysis. Pairs with the existing observability surface:

  • cost-budget-check — "have we crossed a threshold?" (reactive)
  • cost-projection — "when will we cross a threshold?" (predictive)
  • cost-counterfactual — "is the routing earning its keep?" (comparative) ← this one

Algorithm

  1. Read all session-* records from the cost-tracking namespace.
  2. Apply --since window filter (default all-time).
  3. Sum tokens across byModel[*] entries for each session.
  4. For each requested baseline (default: all three):
    • counterfactualUsd = (input × tier.input + output × tier.output + cache_write × tier.cache_write + cache_read × tier.cache_read) / 1M
  5. Compute savings = counterfactualUsd − actualUsd.
  6. Emit per-baseline totals + savings % across the comparison set.

Smoke transcript (2 sessions: 50K haiku tokens + 50K sonnet tokens)

| Sessions considered | 2 |
| Total input tokens  | 100,000 |
| Actual spend        | $0.162500 |

| Baseline           | Hypothetical | Actual    | Savings    | %       |
| `always-haiku`     | $0.025000    | $0.162500 | -$0.137500 | -550.00% |
| `always-sonnet`    | $0.300000    | $0.162500 | +$0.137500 |   45.83% |
| `always-opus`      | $1.500000    | $0.162500 | +$1.337500 |   89.17% |

How to read negative savings

A negative always-haiku result means the router chose more-expensive models than haiku on tasks haiku could have handled. That's an over-escalation signal:

  • Maybe qualityBar is set too high
  • Maybe the sonnet/opus session was warranted by complexity but the baseline doesn't know that
  • Run cost optimize (or inspect specific sessions via cost conversation) to investigate

Positive savings quantify the router's win against that baseline. The most informative number is usually always-sonnet — it's the standard "safe default" baseline most teams would pick if they didn't have routing.

When to use

  • Quarterly cost review: "We saved $X vs always-Sonnet — here's the proof."
  • CI gate: cost counterfactual --format json | jq '.baselines[1].savingsPct > 30' — fail builds if routing isn't saving ≥30% vs sonnet baseline (workload-shift detector).
  • Routing-config validation: When introducing a new qualityBar or cost-ceiling, re-run counterfactual to confirm savings didn't regress.

Stationarity caveat

Like all counterfactual analyses, this assumes the same tokens at the same complexity would have produced the same outcome from the baseline model. That's an upper bound — the baseline might have failed and required retries, which the math doesn't capture. Treat the numbers as a quality-blind ceiling.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

add-model-descriptions

免费有简介AI 评分 80分

对照HuggingFace router的模型列表与chat-ui配置,研究尚未收录的模型,编写简短英文说明,并同步添加到生产和开发配置。

  • 添加路由中新上线的模型
  • 用简短说明概括模型特点
  • 同步更新生产和开发环境的模型信息
ruvnet/ruflo7.8万2026年10月22日 更新

adr-create

免费有简介AI 评分 80分

为技术选型和设计决策创建ADR文档,沿用现有文件的连续编号,生成模板并登记到AgentDB,同时为找到的相关历史决策添加链接和依赖关系。

  • 记录采用某项技术的理由
  • 记录API或数据模型变更
  • 将基础设施决策形成文档
ruvnet/ruflo7.8万2026年10月22日 更新

adr-index

免费有简介AI 评分 90分

读取记录架构决策及其原因的ADR,创建并更新搜索索引和依赖关系图。支持两种文档格式,并汇总引用与状态的不一致情况。

  • 导入其他项目的ADR后建立索引
  • 同步文件与关系图
  • 为现有代码库开始管理ADR
ruvnet/ruflo7.8万2026年10月22日 更新

adr-reindex

免费有简介AI 评分 70分

删除ADR设计决策记录或关系信息后,清空并重建索引,移除残留的旧条目,再核对当前文件数与索引记录数是否一致;也可预览重建内容而不作更改。

  • 删除ADR文件后重建索引
  • 删除ADR关系后清理残留记录
  • 定期核对并重建ADR索引
ruvnet/ruflo7.8万2026年10月22日 更新

adr-review

免费有简介AI 评分 80分

将代码差异与记录已采纳设计决策的ADR进行核对,整理违反决策、引用过时记录及缺少相关记录的变更,并提出代码修正或决策调整建议。

  • 合并PR前检查设计决策
  • 核对重大变更与设计决策
  • 查找对已被替代ADR的引用
ruvnet/ruflo7.8万2026年10月22日 更新

adr-verify

免费有简介AI 评分 90分

检查已保存的架构决策记录(ADR),报告失效引用、替代关系中的循环和状态不一致问题,适合导入后的校验与发布前的数据检查。

  • 检查ADR导入后的数据一致性
  • 在持续集成中检测不一致问题
  • 发布前检查已保存的ADR数据
ruvnet/ruflo7.8万2026年10月22日 更新

查看 ruvnet 的全部技能

报告此技能的问题