← 返回 Skills 市场
shallify

ClawCost

作者 ShallIfy · GitHub ↗ · v1.0.2
cross-platform ✓ 安全检测通过
757
总下载
0
收藏
1
当前安装
3
版本数
在 OpenClaw 中安装
/install clawcost
功能描述
Track OpenClaw agent costs. Check daily/weekly spending and model breakdown.
使用说明 (SKILL.md)

ClawCost

Run this command:

python3 {baseDir}/scripts/clawcost.py --budget 10

Output

JSON with:

  • balance: {initial, spent, remaining} or null
  • today: cost, budget, pct
  • week: total week cost
  • total: all-time cost, tokens
  • models: breakdown all-time
  • models_today: breakdown for today only
  • daily: cost per day (last 7 days)

Set Balance

User sets INITIAL balance (when they top up):

python3 {baseDir}/scripts/clawcost.py --set-balance 50.00

Remaining auto-calculates: initial - total_spent

How to Present

Tone: Friendly, like a helpful assistant checking expenses. Use emojis sparingly.

Format: Use tree-style (├ └) for clean output:

💰 clawleaks
├ Balance $42.98 / $50 remaining
├ Today   $1.36 / $10 (14%) ✅
├ Week    $7.02
└ Total   $7.02 (15.5M tok)

📈 Sonnet $3.99 (57%) • Haiku $2.06 (29%) • Opus $0.97 (14%)

Rules:

  • Skip $0 models
  • Add brief insight ("Opus only 14%, nice savings 👍")

Alerts (IMPORTANT):

  • If today.pct > 80%: Start with ⚠️ "Warning: Daily budget {pct}% used!"
  • If today.pct > 100%: Start with 🚨 "OVER BUDGET! ${cost} spent"
  • If balance.remaining \x3C 5: Warn "💸 Low balance: ${remaining} left"
  • If balance is null: Suggest "Set initial balance with --set-balance"
  • If budget is fine: End with ✅

Contextual:

  • Quick question → short answer
  • Wants detail → full breakdown + daily
  • Over budget → always show warning first, suggest switching to Haiku
安全使用建议
This skill appears to do what it says: it runs locally, reads your OpenClaw session logs to compute costs, and stores a small local config file. Before installing, consider: 1) inspect the included script (scripts/clawcost.py) yourself — it's short and readable; 2) be aware it reads session log files in ~/.openclaw/agents/main/sessions/*.jsonl (those files may contain conversation content), so if those logs are sensitive, review access policies or run the tool on a copy; 3) the tool writes ~/.clawcost/config.json to store initial_balance and budget — back up any existing config or check permissions; 4) there's a minor bug with JSON output mode (uses args.user) that can crash the script — run in text mode first or fix the variable; 5) if you want extra assurance, run the script in a sandboxed environment or with a non-privileged user and test with sample session files.
功能分析
Type: OpenClaw Skill Name: clawcost Version: 1.0.2 The skill bundle is benign. The `scripts/clawcost.py` script reads OpenClaw session logs from `~/.openclaw/agents/main/sessions/*.jsonl` and writes configuration to `~/.clawcost/config.json`, both of which are necessary and expected for its stated purpose of tracking agent costs. The script does not perform any network calls, execute arbitrary commands, or access unrelated sensitive files. The `SKILL.md` file contains instructions for the AI agent on how to format output and generate alerts, which is a functional use of prompt injection to guide the agent's behavior for the skill's intended purpose, not for malicious ends.
能力评估
Purpose & Capability
Name/description match the code and instructions: the skill is a Python script that reads OpenClaw session logs (~/.openclaw/agents/main/sessions/*.jsonl) to compute daily/weekly/all-time costs and model breakdowns, and stores settings under ~/.clawcost/config.json. Required binary (python3) is appropriate and no extraneous credentials or unrelated binaries are requested.
Instruction Scope
SKILL.md instructs running the included script and formatting output; the script implements those actions and stays within scope (reads session logs, aggregates cost, writes a local config). Notes: (1) the script reads the user's session files — these can contain conversation content; the script only extracts usage/cost fields but still opens and parses the session files. (2) There is a small bug: when run with --format json the code attempts to use args.user (which does not exist) instead of the local 'user' variable, which will raise an AttributeError; this is an availability/quality issue, not malicious behavior.
Install Mechanism
No install spec is provided (instruction-only with an included Python script). That is low-risk compared to remote downloads. The script is shipped with the skill (scripts/clawcost.py) so nothing will be fetched from external URLs during install.
Credentials
The skill requests no environment variables or credentials. It uses standard user-local paths (HOME via Path.home()) and reads/writes only: ~/.openclaw/agents/main/sessions/*.jsonl (read) and ~/.clawcost/config.json (read/write). These accesses are proportional to a local cost-tracking tool. The script also reads USER env var for display (non-sensitive).
Persistence & Privilege
The skill does not request always:true and does not modify other skills or system-wide settings. It writes only its own config under ~/.clawcost, which is reasonable for storing the initial balance/budget.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install clawcost
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /clawcost 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
Security fix: Use $HOME paths instead of /home/{user}/, removed --user arg, added security docs
v1.0.1
Added README documentation
v1.0.0
Initial release - Track OpenClaw agent costs with budget alerts and balance tracking
元数据
Slug clawcost
版本 1.0.2
许可证
累计安装 1
当前安装数 1
历史版本数 3
常见问题

ClawCost 是什么?

Track OpenClaw agent costs. Check daily/weekly spending and model breakdown. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 757 次。

如何安装 ClawCost?

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

ClawCost 是免费的吗?

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

ClawCost 支持哪些平台?

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

谁开发了 ClawCost?

由 ShallIfy(@shallify)开发并维护,当前版本 v1.0.2。

💬 留言讨论