跳至主要内容
小龙虾小龙虾AI
🤖

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...

下载72
星标0
版本1.0.3
开发工具
安全通过
💬Prompt

技能说明


name: ccusage-report description: Report Claude Code token consumption and costs using ccusage. Use when the user asks about their Claude Code usage, token consumption, API costs, spending, or wants a daily/weekly/monthly usage summary. Triggers on: "show my claude code usage", "how much did I spend", "my token consumption", "ccusage report", "usage report", "token consumption", "how much did I spend". metadata: {"openclaw":{"requires":{"bins":["bunx"]}}}

Claude Code Usage Report

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

Workflow

1. Determine the period

Identify the period from the user's message:

KeywordPeriodCommand suffix
"today", defaultdailydaily
"this week"weeklyweekly
"this month"monthlymonthly

2. Run ccusage

{ "tool": "exec", "command": "bunx ccusage <period> --no-color -z Europe/Paris -o desc" }

Add --breakdown if the user asks for per-model details.

Filtering by date range:

  • Today only: --since $(date +%Y%m%d) --until $(date +%Y%m%d)
  • Last 7 days: --since $(date -d '7 days ago' +%Y%m%d)
  • Specific month: --since 20260201 --until 20260228

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)

如何使用「Ccusage Report」?

  1. 打开小龙虾AI(Web 或 iOS App)
  2. 点击上方「立即使用」按钮,或在对话框中输入任务描述
  3. 小龙虾AI 会自动匹配并调用「Ccusage Report」技能完成任务
  4. 结果即时呈现,支持继续对话优化

相关技能