← 返回 Skills 市场
neal-collab

Agent Cost Monitor

作者 Nealbuilds · GitHub ↗ · v1.1.1
cross-platform ✓ 安全检测通过
1336
总下载
0
收藏
8
当前安装
3
版本数
在 OpenClaw 中安装
/install agent-cost-monitor
功能描述
Monitor token usage and estimated costs across all OpenClaw agents in real-time, with alerts and recommendations to stay within budgets and optimize spending.
使用说明 (SKILL.md)

Agent Cost Monitor — Know What Your Agents Cost

Track token usage, costs, and efficiency across all your OpenClaw agents in real-time. Get alerts before you blow your budget.

The Problem

Running multiple agents is powerful — but expensive if you're not watching:

  • Which agent is burning the most tokens?
  • Are heartbeats wasting money on expensive models?
  • Is caching actually saving you anything?
  • When will you hit your weekly rate limit?

What This Skill Does

When triggered (via cron or manually), the agent:

  1. Checks session_status for each agent
  2. Calculates per-agent and total costs
  3. Compares against budget thresholds
  4. Sends alerts if limits are approaching
  5. Suggests optimization moves

Usage

Ask your monitoring agent (or any agent with this skill):

"Give me a cost report for all agents"
"Which agent used the most tokens today?"
"Am I going to hit my rate limit this week?"

Automated Daily Report (Cron)

{
  "name": "Daily Cost Report",
  "schedule": { "kind": "cron", "expr": "0 20 * * *", "tz": "Europe/Berlin" },
  "payload": {
    "kind": "agentTurn",
    "message": "Run a cost report across all agents. Check session_status for each. Report: total tokens, cost per agent, top spender, budget warnings. Send summary to user."
  },
  "sessionTarget": "isolated",
  "delivery": { "mode": "announce" }
}

Cost Report Format

When generating a report, use this structure:

## 💰 Agent Cost Report — [Date]

### Per-Agent Breakdown
| Agent | Model | Tokens (24h) | Est. Cost | Status |
|-------|-------|-------------|-----------|--------|
| Central | Opus 4.6 | 125K | $1.87 | ⚠️ High |
| Techops | Opus 4.6 | 89K | $1.33 | ✅ Normal |
| Atlas | Sonnet 4.5 | 45K | $0.27 | ✅ Low |
| Closer | Haiku 4.5 | 23K | $0.02 | ✅ Minimal |
| Heartbeats | Ollama | 12K | $0.00 | ✅ Free |

### Summary
- **Total 24h:** 294K tokens (~$3.49)
- **Projected weekly:** ~$24.43
- **Budget:** $20/week → ⚠️ 122% projected

### Recommendations
1. Move Techops from Opus → Sonnet for routine tasks (-40% cost)
2. Increase heartbeat interval from 15m → 30m
3. Enable context pruning on Atlas (idle sessions burning cache)

Model Cost Reference

Use these rates for estimation (as of 2026):

Anthropic (Claude OAuth / API)

Model Input/1M Output/1M Cache Read/1M Cache Write/1M
Opus 4.6 $5.00 $25.00 $0.50 $6.25
Sonnet 4.5 $3.00 $15.00 $0.30 $3.75
Haiku 4.5 $1.00 $5.00 $0.08 $1.25

Free Options

Model Cost Use For
Ollama (local) $0 Heartbeats, simple tasks
Gemini OAuth $0* Fallback (rate limited)

*Free tier with rate limits

Optimization Playbook

Quick Wins (Do These First)

  1. Heartbeats on Ollama
{ "heartbeat": { "model": "ollama/llama3.2:3b" } }

Saves: 100% of heartbeat costs (can be $5-10/week with Opus)

  1. Haiku Cache Retention Off
{ "anthropic/claude-haiku-4-5": { "params": { "cacheRetention": "none" } } }

Saves: Cache write costs on cheap model (not worth caching)

  1. Context Pruning
{ "contextPruning": { "mode": "cache-ttl", "ttl": "5m" } }

Saves: Stale context re-reads on every turn

  1. Opus/Sonnet Cache Retention Long
{ "anthropic/claude-opus-4-6": { "params": { "cacheRetention": "long" } } }

Saves: Re-sending system prompt every turn (biggest single saving)

Model Tiering (Biggest Impact)

Task Type Use This Not This Saving
Coordination, complex reasoning Opus Justified
Finance, data analysis Sonnet Opus -40%
Sales drafts, marketing copy Haiku Sonnet -67%
Heartbeats, health checks Ollama Any paid -100%
Tweet drafts Haiku or Grok Opus -80%

Session Management

  • Daily reset: Sessions auto-clear at a set hour (reduces token accumulation)
{ "session": { "reset": { "mode": "daily", "atHour": 4, "idleMinutes": 45 } } }
  • Memory flush: Save important context before compaction
{ "compaction": { "memoryFlush": { "enabled": true } } }

Alert Thresholds

Configure in your monitoring agent's memory:

## Budget Alerts
- Daily budget: $5.00 (warn at 80% = $4.00)
- Weekly budget: $20.00 (warn at 70% = $14.00)
- Per-agent daily max: $2.00
- Alert channel: Telegram DM

Integration with DevOps Agent

If you have a DevOps/monitoring agent (e.g. your DevOps agent), add to its AGENTS.md:

## Cost Monitoring
- Run daily cost report at 20:00
- Alert if any agent exceeds $2/day
- Weekly summary every Monday 09:00
- Track trends: is usage going up or down?

FAQ

Q: Does this skill make API calls? A: No. It uses OpenClaw's built-in session_status tool. No external APIs, no additional costs.

Q: How accurate are cost estimates? A: Based on published model pricing. Actual costs may vary with caching hits. Estimates are conservative (slightly high).

Q: Can I track costs per conversation? A: Not directly. Costs are tracked per session. Use sessions_list to see per-session token counts.

Q: Works with non-Anthropic models? A: Yes. Token counts work for all providers. Cost estimation requires known pricing (add custom rates in the cost reference section).

Changelog

v1.1.0

  • Generalized all agent names in examples
  • No specific setup references

v1.0.0

  • Initial release
安全使用建议
This skill appears coherent and low-risk as-is: it only describes reading agent session state and computing estimates and recommendations. Before enabling it, check two things: (1) what platform permissions an agent running this skill will have — if it can write agent configs, it could apply the example changes (cacheRetention, session resets, model swaps) automatically; restrict write permissions if you only want reports, and (2) if you configure external alert channels (Telegram, webhooks, etc.), provide tokens only to an agent you trust. Run the skill in an isolated/non-production agent first to confirm behavior and outputs.
功能分析
Type: OpenClaw Skill Name: agent-cost-monitor Version: 1.1.1 The OpenClaw AgentSkills bundle 'agent-cost-monitor' is benign. Its stated purpose is to track token usage and costs, provide alerts, and suggest optimizations, which is consistently supported by all instructions and examples in SKILL.md. Crucially, the FAQ explicitly states, 'No. It uses OpenClaw's built-in `session_status` tool. No external APIs, no additional costs,' indicating no intent for data exfiltration or unauthorized external communication. All agent instructions are limited to internal monitoring, calculation, and reporting.
能力评估
Purpose & Capability
Name/description (cost monitoring across agents) match the instructions: it reads session_status/sessions_list, computes per-agent token/cost metrics, compares to budgets, and issues alerts/recommendations. No unrelated binaries, environment variables, or install steps are requested.
Instruction Scope
The SKILL.md stays within monitoring and recommendation tasks. It explicitly uses platform-internal tools (session_status, sessions_list) which is coherent. Note: the document contains example JSON snippets that change session/reset/cache/model parameters and recommends moving agents between model tiers — these are configuration-change suggestions. The skill does not include explicit commands that will automatically modify other agents, but an agent with write privileges could apply those snippets; review platform permissions before allowing autonomous writes.
Install Mechanism
Instruction-only skill with no install spec and no code files; nothing written to disk and no external packages downloaded.
Credentials
No environment variables, secrets, or external API keys are required. The SKILL.md mentions alert channels (e.g., Telegram DM) as an example but does not request corresponding tokens — if you configure such channels, you must supply credentials separately. No unexpected credentials are requested by the skill itself.
Persistence & Privilege
always is false (not forced into every agent run). The skill can be invoked autonomously by agents (default) which is normal for skills; combined with the configuration-change examples, consider restricting write permissions if you do not want automated configuration changes across agents.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-cost-monitor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-cost-monitor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.1
Added changelog section, fixed version in frontmatter
v1.1.0
Generalized all agent names in examples
v1.0.0
Initial release — track and optimize token usage and costs across all your OpenClaw agents: - Real-time monitoring of token usage and cost per agent - Automated alerts when approaching budget thresholds - Daily and weekly cost reports with suggestions for saving money - Model usage and cost breakdown, including free/paid model support - Built-in optimization tips and easy configuration of alert levels and reporting
元数据
Slug agent-cost-monitor
版本 1.1.1
许可证
累计安装 8
当前安装数 8
历史版本数 3
常见问题

Agent Cost Monitor 是什么?

Monitor token usage and estimated costs across all OpenClaw agents in real-time, with alerts and recommendations to stay within budgets and optimize spending. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1336 次。

如何安装 Agent Cost Monitor?

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

Agent Cost Monitor 是免费的吗?

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

Agent Cost Monitor 支持哪些平台?

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

谁开发了 Agent Cost Monitor?

由 Nealbuilds(@neal-collab)开发并维护,当前版本 v1.1.1。

💬 留言讨论