← 返回 Skills 市场
spideystreet

Ccusage Report

作者 𝑠𝑝𝑖𝑑𝑒𝑦 · GitHub ↗ · v1.0.3
cross-platform ⚠ suspicious
439
总下载
0
收藏
0
当前安装
5
版本数
在 OpenClaw 中安装
/install 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...
使用说明 (SKILL.md)

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 intent Subcommand Extra flags
"today" / "how much today" / default daily --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 month daily --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 — \x3Cperiod>

Date/Period : \x3Cvalue>
Models      : \x3Ccomma-separated list>
Input       : \x3Cn> tokens
Output      : \x3Cn> tokens
Cache read  : \x3Cn> tokens
Total       : \x3Cn> tokens
Cost        : $\x3Camount> 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)
安全使用建议
This skill appears to do what it says: it runs the ccusage CLI via bunx to summarize local Claude Code usage. Before installing/use, consider the following: - Running the skill executes local shell commands; ccusage will read Claude Code session data on your machine — ensure you trust the ccusage package and that you are willing to let it access those files. - bunx (or bun) may fetch and run code from package registries at runtime. If you prefer, inspect or install ccusage yourself before using the skill. - The SKILL.md uses GNU date syntax (`date -d '7 days ago'`) that may fail on macOS; expect possible command failures on some environments. - The skill does not request API keys or env vars, but outputs could include sensitive usage details; avoid sending raw output to untrusted external channels. If you only need a local usage summary and trust ccusage, this skill is coherent and appropriate. If you are uncomfortable with runtime package fetching or local file access, consider running ccusage manually instead.
功能分析
Type: OpenClaw Skill Name: ccusage-report Version: 1.0.3 The skill bundle facilitates Claude Code usage reporting but introduces a shell injection vulnerability by instructing the agent to execute commands containing shell substitutions (e.g., `$(date ...)`) via `bunx ccusage` in `SKILL.md`. While the intent appears benign (reporting token costs), the reliance on the `exec` tool with dynamic shell-evaluated strings without explicit sanitization poses a security risk if the agent is manipulated into including additional shell metacharacters.
能力评估
Purpose & Capability
The name/description say it reports Claude Code usage via ccusage and the SKILL.md only requires the bunx binary and runs `bunx ccusage`. There are no unrelated environment variables, binaries, or config paths requested, so the requested footprint matches the stated purpose.
Instruction Scope
The instructions direct the agent to execute local shell commands (e.g., `bunx ccusage ...` and `date` invocations) which is appropriate for a CLI-based usage report. This will cause the agent to run commands on the host and read whatever files ccusage needs (the README notes Claude Code session data must be present). That behavior is coherent with the skill's purpose but users should be aware ccusage may read local session files (which could contain sensitive content or tokens). Also, the SKILL.md uses GNU `date -d` syntax which is not portable on all systems (macOS BSD date), so commands may fail on some hosts — a functional, not security, concern.
Install Mechanism
This is an instruction-only skill (no install spec). It expects bunx to be present; the README says `ccusage` will be fetched automatically via bunx at runtime. Not writing files itself is low risk, but runtime fetching/executing of a third-party package via bunx means you must trust the ccusage package and the host toolchain (bun/bunx/npm). There are no embedded download URLs or obscure installers in the skill itself.
Credentials
The skill declares no required environment variables or credentials, which is appropriate for a local CLI report tool. Note: although no env vars are requested, the executed ccusage tool may access local session data (files) that could contain API keys or other sensitive info — this is expected for a usage-reporting tool but worth awareness.
Persistence & Privilege
The skill is not always-enabled and is user-invocable; it does not request persistent presence or modify other skills or global agent settings. Autonomous invocation remains allowed by platform default but this is not combined with any broad credentials or always:true privilege.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ccusage-report
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ccusage-report 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.3
Declare `bunx` in `metadata.openclaw.requires.bins` and normalize install slug.
v1.0.2
Translate all prompts and examples to English.
v1.0.1
Re-publish with CI fixes.
v0.0.0-pr-check
Slug availability check
v1.0.0
Initial release.
元数据
Slug ccusage-report
版本 1.0.3
许可证
累计安装 0
当前安装数 0
历史版本数 5
常见问题

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... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 439 次。

如何安装 Ccusage Report?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ccusage-report」即可一键安装,无需额外配置。

Ccusage Report 是免费的吗?

是的,Ccusage Report 完全免费(开源免费),可自由下载、安装和使用。

Ccusage Report 支持哪些平台?

Ccusage Report 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Ccusage Report?

由 𝑠𝑝𝑖𝑑𝑒𝑦(@spideystreet)开发并维护,当前版本 v1.0.3。

💬 留言讨论