← 返回 Skills 市场
tso1079

Cost Guardian by Dexter Labs

作者 tso1079 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
106
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install dex-cost-guardian
功能描述
Monitor and control OpenClaw API costs. Tracks token usage across all sessions, estimates spend by model, alerts on budget overruns, and recommends cheaper m...
使用说明 (SKILL.md)

Cost Guardian — OpenClaw Cost Monitor & Optimizer

Know what your agent costs. Before it becomes a problem.

When to Use

USE this skill when:

  • "How much am I spending?"
  • "What's my API cost?"
  • "Which sessions cost the most?"
  • "Am I over budget?"
  • "How can I reduce costs?"
  • Setting up daily/weekly cost reports
  • Optimizing model usage for crons and automated tasks

DON'T use this skill for:

  • Billing issues with Anthropic/OpenAI (contact providers directly)
  • Managing API keys (use OpenClaw's secrets system)

Quick Start

Get a Cost Report (All Time)

python3 scripts/cost-report.py --all

Last 24 Hours

python3 scripts/cost-report.py --hours 24

With Budget Alert ($5/day)

python3 scripts/cost-report.py --budget 5.00

JSON Output (for dashboards)

python3 scripts/cost-report.py --all --json

What It Reports

  • Estimated cost by model and session
  • Token breakdown — input, output, context (cached)
  • Top spending sessions — find what's burning tokens
  • Model efficiency — how much you'd save switching routine tasks to cheaper models
  • Budget alerts — 🟡 at 80% and 🔴 when over budget
  • Cron cost tracking — automated jobs often account for 30-50% of spend

Setting Up Automated Reports

Daily Cost Report via Cron

Tell your agent:

"Set up a daily cost report that runs at 8 AM and alerts me if I'm over $5/day"

The agent should create a cron job that:

  1. Runs python3 \x3Cskill-dir>/scripts/cost-report.py --hours 24 --budget 5.00
  2. Delivers the report via your preferred channel

Model Optimization

The report flags when expensive models (Opus) are being used for routine tasks that Sonnet handles fine:

  • Email checking crons → Sonnet
  • Heartbeat checks → Sonnet
  • Site health monitoring → Sonnet or Haiku
  • Complex reasoning, strategy, writing → Keep on Opus

Supported Models & Pricing

Model Input $/1M Output $/1M Cache $/1M
Claude Opus 4 $15.00 $75.00 $1.875
Claude Sonnet 4 $3.00 $15.00 $0.30
Claude Haiku 3.5 $0.80 $4.00 $0.08
GPT-4o $2.50 $10.00 $1.25
GPT-4.1 $2.00 $8.00 $0.50
GPT-4.1-mini $0.40 $1.60 $0.10
GPT-4.1-nano $0.10 $0.40 $0.025
OpenRouter/auto ~$3.00 ~$15.00 ~$0.30

Pricing is estimated and may vary. Update scripts/cost-report.py MODEL_PRICING dict for current rates.

Roadmap

  • Auto model-switching recommendations per session type
  • Historical trend tracking (daily/weekly/monthly)
  • Cost anomaly detection (sudden spikes)
  • Per-project cost allocation
  • Web dashboard with charts
安全使用建议
This skill appears to do what it says: it reads the OpenClaw sessions.json in your home directory, computes estimated costs, and prints or outputs JSON. Before installing/using: 1) Inspect ~/.openclaw/agents/<agent>/sessions/sessions.json to understand what data will be read (it may include conversation metadata and token counts or even message text). 2) Run scripts/cost-report.py locally once to review output and ensure the path and agent-id are correct. 3) If you don't want an agent to modify your system, set up the cron job yourself rather than giving the agent instructions to create it; cron entries will run with whatever permissions the user has. 4) Be aware that "deliver via your preferred channel" means the agent may transmit report contents over chat/email/webhooks — if your reports contain sensitive text snippets, route them carefully. 5) If you need different pricing, update the MODEL_PRICING dict in the script. Overall the skill is coherent and contained, but grant automation (crontab or delivery) only with explicit consent.
能力评估
Purpose & Capability
Name/description (cost monitoring and optimization) aligns with the included script and SKILL.md. The script reads OpenClaw session data (~/.openclaw/agents/<agent>/sessions/sessions.json) and computes per-model/session cost estimates and recommendations — this is exactly what the skill claims to do. Requiring python3 is appropriate.
Instruction Scope
SKILL.md stays focused on cost reporting and optimization, and the script only reads a local sessions.json and prints or emits JSON reports. Two items to note: (1) SKILL.md asks the agent to create cron jobs to run the script and to "deliver the report via your preferred channel" — that grants the agent discretion to modify system crontab and to send the report over whatever delivery channel the agent uses (chat, email, webhook, etc.). These behaviors are consistent with 'automated reports' but are broader system actions than simply reading session data. (2) The script will exit with an error if the session file is missing; not a security problem but could cause noisy cron output.
Install Mechanism
No install spec (instruction-only plus a python script) — nothing is downloaded or extracted. Lowest risk for install mechanism; only requires a local python3 interpreter which is declared.
Credentials
The skill requests no environment variables or credentials. It reads the user's OpenClaw session store (a local file) which is necessary for cost calculation. There are no unrelated secrets requested.
Persistence & Privilege
Metadata does not request elevated or persistent privileges (always:false). However, SKILL.md explicitly instructs the agent to create cron jobs (system crontab changes) for automated reports. That is a legitimate feature for automation but is a system modification that the user should approve or perform manually.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install dex-cost-guardian
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /dex-cost-guardian 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of Cost Guardian — a skill for monitoring and optimizing OpenClaw API costs. - Tracks token usage and estimates spend by model and session. - Sends budget alerts and identifies top spending sessions. - Recommends more cost-efficient model routing for routine tasks. - Supports daily/weekly automated cost reports. - Lists detailed model pricing and usage breakdowns.
元数据
Slug dex-cost-guardian
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Cost Guardian by Dexter Labs 是什么?

Monitor and control OpenClaw API costs. Tracks token usage across all sessions, estimates spend by model, alerts on budget overruns, and recommends cheaper m... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 106 次。

如何安装 Cost Guardian by Dexter Labs?

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

Cost Guardian by Dexter Labs 是免费的吗?

是的,Cost Guardian by Dexter Labs 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Cost Guardian by Dexter Labs 支持哪些平台?

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

谁开发了 Cost Guardian by Dexter Labs?

由 tso1079(@tso1079)开发并维护,当前版本 v1.0.0。

💬 留言讨论