微算力 · API 导航与自营网关
API 接入 EN
未登录登录
✨

Ccusage Report

Ccusage Report · v1.0.2
安全 unknown 级 作者 spideystreet 公开目录收录
951 下载 0 安装 4k 收藏 1 浏览

简介

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

通过你的 Agent 添加

安装目录:ccusage-report/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/ccusage-report/
Codex CLI~/.codex/skills/ccusage-report/
DeepSeek Harness~/.agents/skills/ccusage-report/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


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:

Keyword Period Command suffix
"today", default daily daily
"this week" weekly weekly
"this month" monthly monthly

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 says Period Flags
"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)

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

没有标签

同类 Skill