cost-ledger
它能做什么
这项技能读取 AI 编程工具已在你电脑上保存的使用日志,按服务商展示开支、令牌和缓存使用情况。适合同时使用多个 AI 工具、希望统一查看的人。
适用场景
- ✓当你询问本周在 AI 工具上花了多少钱时。
- ✓当你想比较 Codex 和 Claude Code 的成本时。
- ✓当你想查看哪些模型还没有价格时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-ledger/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“本周我在所有服务商的 AI 编程工具上一共花了多少钱?”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能读取本地日志,按带日期的价格表为用量定价,并显示总计。没有价格的模型会单独列出,而不会被当作免费计算。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Cost Ledger
Reads the logs the agents already wrote (~/.claude/projects, $CODEX_HOME or ~/.codex) and prices them from data/prices.json (dated, editable).
Run
node ${CLAUDE_PLUGIN_ROOT}/scripts/ledger.mjs --since 7d
node ${CLAUDE_PLUGIN_ROOT}/scripts/ledger.mjs --provider codex --format json
One mission, or one project
--from and --to (ISO times) cut the window and --project <absolute path> keeps one project's rows; the console's mission page uses them for a mission's spend. An explicit --from/--to replaces the default 7-day look-back.
Read the result correctly
- USD and Codex credits are never added. GPT-6 Codex models are priced in credits; their cached-input rate is unpublished, so the figure is an upper bound.
- Estimates at list price, not bills. Subscriptions bill by window, not by token.
/usageis authoritative for the live Claude session; the Console or provider dashboard is authoritative for invoices. - Unpriced models are listed, never counted as $0. Say so, and offer to add them to
data/prices.json. - Counting rules (why numbers differ from naive sums): Claude messages are de-duplicated by
message.id + requestId; Codex uses deltas of the runningtotal_token_usage(never alsolast_token_usage), cached input is a subset of input, and forked rollouts are de-duplicated. - Claude transcript output tokens can under-count streamed output.
If the log directory is missing, say so; do not invent numbers.
常见问题
我的数据会被发送到别处吗?
这项技能只使用本地日志,不会发送任何内容。费用是按标价估算的,并非实际账单。
为什么美元和积分的总数对不上?
Codex 积分与美元永远不会相加,因为它们是不同的单位。
我能只查看某一个项目吗?
可以。项目设置可以把统计限制在某个项目文件夹内,也可以设置时间范围。
详情
作者的原始描述
One cost view across Claude Code, Codex and Grok on this machine — spend, tokens, cache hit ratio per provider and model, with unpriced models flagged. Use when asked "what did I spend", "how much did Codex cost", or to compare providers. Local logs only, nothing is sent.
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1603
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。