cost-report
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCost Report
成本报告
Generate a comprehensive cost report showing token usage, USD costs, and budget utilization for the specified period.
生成一份全面的成本报告,展示指定时间段内的令牌使用量、美元成本以及预算利用率。
When to use
使用场景
When you need to understand current spending -- how much each agent costs, which models consume the most budget, and whether you're on track to stay within budget.
当你需要了解当前支出情况时——比如每个Agent的成本是多少,哪些模型消耗的预算最多,以及你是否能在预算范围内控制支出。
Steps
操作步骤
- Retrieve usage -- call to fetch token usage records from the
mcp__claude-flow__agentdb_hierarchical-recallnamespace for the specified period (default: today)cost-tracking - Compute costs -- for each record, calculate cost using model pricing:
- Haiku: $0.25/M input, $1.25/M output
- Sonnet: $3.00/M input, $15.00/M output
- Opus: $15.00/M input, $75.00/M output
- Include cache write/read costs where applicable
- Aggregate by model -- sum costs per model, compute percentage share
- Aggregate by agent -- sum costs per agent, include the model each agent used
- Check budget -- recall budget configuration and compute utilization percentage, check alert thresholds (50%/75%/90%/100%)
- Report -- display: total cost, budget remaining, model breakdown, agent breakdown, active alerts
- 获取使用数据——调用接口,从
mcp__claude-flow__agentdb_hierarchical-recall命名空间中获取指定时间段(默认:今日)的令牌使用记录cost-tracking - 计算成本——针对每条记录,根据模型定价计算成本:
- Haiku:输入每百万令牌0.25美元,输出每百万令牌1.25美元
- Sonnet:输入每百万令牌3.00美元,输出每百万令牌15.00美元
- Opus:输入每百万令牌15.00美元,输出每百万令牌75.00美元
- 适用时需包含缓存写入/读取成本
- 按模型汇总——统计每个模型的总成本,计算占比
- 按Agent汇总——统计每个Agent的总成本,包含各Agent使用的模型信息
- 检查预算——调取预算配置并计算利用率百分比,检查告警阈值(50%/75%/90%/100%)
- 生成报告——展示:总成本、剩余预算、模型成本明细、Agent成本明细、激活的告警信息
CLI alternative
CLI替代方案
bash
npx @claude-flow/cli@latest memory search --query "cost report for today" --namespace cost-trackingbash
npx @claude-flow/cli@latest memory search --query "cost report for today" --namespace cost-tracking