← 返回
开发者工具 中文

Ccusage Report

Report Claude Code token consumption and costs using ccusage. Use when the user asks about their Claude Code usage, token consumption, API costs, spending, o...
使用 ccusage 报告 Claude Code 令牌消耗与费用。用户询问使用量、令牌消耗、API 费用等情况时使用。
spideystreet
开发者工具 clawhub v1.0.3 1 版本 99873.9 Key: 无需
★ 0
Stars
📥 792
下载
💾 6
安装
1
版本
#latest

概述

Claude Code Usage Report

Uses bunx ccusage to report token consumption and costs from Claude Code sessions.

IMPORTANT: The ONLY valid subcommands are daily, weekly, monthly. Do NOT use today, this_week, this_month, or any other subcommand — they will crash.

Workflow

1. Determine the subcommand

Map the user's intent to one of the three valid subcommands:

User intentSubcommandExtra flags
--------------------------------------
"today" / "how much today" / defaultdaily--since $(date +%Y%m%d) --until $(date +%Y%m%d)
"this week" / "weekly"weekly(none)
"this month" / "monthly"monthly(none)
"last 7 days"daily--since $(date -d '7 days ago' +%Y%m%d)
"in February" / specific monthdaily--since 20260201 --until 20260228

2. Run ccusage

{ "tool": "exec", "command": "bunx ccusage daily --no-color -z Europe/Paris -o desc --since $(date +%Y%m%d) --until $(date +%Y%m%d)" }

Replace daily with weekly or monthly as needed. Add --breakdown if the user asks for per-model details.

3. Format the output

📊 Claude Code Usage — <period>

Date/Period : <value>
Models      : <comma-separated list>
Input       : <n> tokens
Output      : <n> tokens
Cache read  : <n> tokens
Total       : <n> tokens
Cost        : $<amount> USD

For multi-row output (e.g. last 7 days), summarize totals and list each row briefly.

4. Deliver

  • Chat: Send the formatted message directly
  • Telegram (cron context): Reply with ONLY the formatted message in a code block — no extra commentary

5. Error handling

  • If bunx ccusage fails → check if bun/bunx is installed, report the error
  • If no data for the requested period → inform the user clearly ("No usage data found for this period")
  • If the output is empty → suggest checking a broader date range

Examples

User saysPeriodFlags
--------------------------
"Show my claude code usage"daily(none)
"How much did I spend this week?"weekly(none)
"Monthly report with model breakdown"monthly--breakdown
"Usage for the last 7 days"daily--since $(date -d '7 days ago' +%Y%m%d)

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-03-30 04:01 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,003
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,769
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 67 📥 180,036