Token导航 LogoToken导航TokenDH.com
研究检索需要联网clawhub未标认证来源可访问clear审计通过

token-cost-monitor代币成本监控

Agent Skill

token-cost-monitor 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,491

周安装

189

GitHub Stars

公开资料未说明

下载量

1,572
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:token-cost-monitor(代币成本监控)
来源仓库:https://github.com/redwoo/token-cost-monitor
安装命令:
openclaw skills install token-cost-monitor
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install token-cost-monitor

简介

实时监控 OpenClaw API 成本并优化模型支出。

  • 适用于设置预算警报和跟踪令牌使用情况。
  • 提供成本优化建议和按会话/模型的分析报告。
  • 安装前需确认是否触发联网或写入日志操作。
  • 建议检查维护状态后再决定是否集成。token-cost-monitor 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
token-cost-monitor
description
>
homepage
https://github.com/openclaw/openclaw
metadata
openclaw
files
["scripts/*"]
official
false

Token Cost Monitor

Monitor OpenClaw API costs in real-time, set budget alerts, and optimize model spending.

Why This Matters

Real user stories:

  • One user spent $18.75 overnight on heartbeat checks asking "Is it daytime yet?"
  • Federico Viticci spent $3,600 in a single month
  • Regular users report $200/day bills from misconfigured automations

Quick Commands

Check current session costs:

# View token usage and estimated cost
openclaw /status
openclaw /usage

Set up cost alerts:

# Alert when daily spend exceeds $10
echo "Alert if daily_cost > $10"

# Alert when monthly spend exceeds $100
echo "Alert if monthly_cost > $100"

Cost Optimization Strategies

1. Model Routing

Use cheaper models for simple tasks:

  • Claude Haiku: $0.25/1M input tokens (fast, cheap)
  • Claude Sonnet: $3/1M input tokens (balanced)
  • Claude Opus: $15/1M input tokens (expensive, powerful)

Routing rules:

Simple queries (weather, facts) → Haiku
Complex analysis → Sonnet
Creative writing → Opus (only if needed)

2. Context Management

Reduce token waste:

  • Clear old conversation context regularly
  • Don't store tool outputs in context
  • Use concise system prompts
  • Limit heartbeat frequency

3. Heartbeat Optimization

Common mistake:

❌ Every 30 min: "Is it daytime yet?" → $18.75/night
✅ Every 6 hours: Check emails + calendar → $2/day

Best practices:

  • Combine multiple checks into one heartbeat
  • Use longer intervals (4-6 hours)
  • Skip nighttime heartbeats (23:00-08:00)
  • Track heartbeat costs separately

Cost Tracking Dashboard

Daily Cost Breakdown

CategoryTokensCost
Heartbeat checks50,000$0.50
Web searches100,000$1.00
Code generation200,000$2.00
Document analysis150,000$1.50
Total500,000$5.00/day

Monthly Projection

Daily average: $5.00
Monthly projection: $150.00
Budget limit: $100.00
⚠️ Warning: Will exceed budget by $50

Budget Alerts Setup

Tier 1: Light User ($10-30/month)

Daily limit: $1.00
Alert at: $0.80/day
Actions: Reduce heartbeat frequency, use Haiku more

Tier 2: Regular User ($40-80/month)

Daily limit: $2.50
Alert at: $2.00/day
Actions: Optimize context, review model routing

Tier 3: Power User ($100-500/month)

Daily limit: $10.00
Alert at: $8.00/day
Actions: Audit all automations, implement strict routing

Cost Reduction Checklist

Immediate Actions (save 30-50%)

  • [ ] Reduce heartbeat frequency to 4-6 hours
  • [ ] Route simple queries to Haiku
  • [ ] Clear context after completed tasks
  • [ ] Disable unnecessary automations

Medium-term (save 50-70%)

  • [ ] Implement model routing rules
  • [ ] Optimize system prompts
  • [ ] Batch similar tasks together
  • [ ] Use caching for repeated queries

Long-term (save 70-90%)

  • [ ] Build cost-aware agent behaviors
  • [ ] Implement token budgets per task
  • [ ] Use local models for simple tasks
  • [ ] Optimize tool output storage

Monitoring Commands

Real-time Cost Check

# Get current session stats
openclaw /status

# Get detailed usage breakdown
openclaw /usage --detailed

Historical Analysis

# Last 7 days cost trend
echo "Analyze spending trend for past 7 days"

# Identify most expensive tasks
echo "What are my top 5 most expensive task types?"

Anomaly Detection

# Alert if spending is 2x normal
echo "Alert if hourly_cost > 2 * average_hourly_cost"

Integration Examples

Slack/Discord Alerts

# Send daily cost summary to Slack
curl -X POST https://hooks.slack.com/services/YOUR/WEBHOOK/URL \
  -d '{"text": "Daily OpenClaw cost: $5.00 (Budget: $10.00)"}'

Email Reports

# Send weekly cost report via email
echo "Weekly cost report: $35.00 total, $5.00/day average" | mail -s "OpenClaw Cost Report" user@example.com

Cost Optimization Scripts

Auto-pause Expensive Sessions

#!/bin/bash
# Pause session if daily cost exceeds limit

DAILY_LIMIT=10
CURRENT_COST=$(get_current_cost)

if (( $(echo "$CURRENT_COST > $DAILY_LIMIT" | bc -l) )); then
    echo "⚠️ Daily cost ($CURRENT_COST) exceeds limit ($DAILY_LIMIT)"
    echo "Pausing non-essential automations..."
    # Add pause logic here
fi

Model Router

#!/bin/bash
# Route queries to appropriate model based on complexity

QUERY="$1"
WORD_COUNT=$(echo "$QUERY" | wc -w)

if [ $WORD_COUNT -lt 20 ]; then
    echo "Using Haiku (simple query)"
    MODEL="haiku"
elif [ $WORD_COUNT -lt 100 ]; then
    echo "Using Sonnet (medium complexity)"
    MODEL="sonnet"
else
    echo "Using Opus (complex analysis)"
    MODEL="opus"
fi

Common Cost Pitfalls

❌ Mistake: Infinite Loops

Agent keeps calling itself → 1000s of API calls → $100+ in hours

Fix: Implement loop detection and limits

❌ Mistake: Storing Tool Outputs

Every tool output saved to context → Context grows → Each call costs more

Fix: Only store essential information

❌ Mistake: Wrong Model for Task

Using Opus for weather queries → 60x more expensive than needed

Fix: Implement model routing

❌ Mistake: Heartbeat Misconfiguration

Heartbeat every 5 minutes → 288 calls/day → $50+/day

Fix: Use 4-6 hour intervals

Pricing Reference (2026)

Anthropic Claude

ModelInputOutputBest For
Haiku$0.25/1M$1.25/1MSimple queries, facts
Sonnet$3/1M$15/1MGeneral tasks
Opus$15/1M$75/1MComplex analysis

OpenAI GPT

ModelInputOutputBest For
GPT-4o Mini$0.15/1M$0.60/1MSimple queries
GPT-4o$2.5/1M$10/1MGeneral tasks
o1$15/1M$60/1MComplex reasoning

Google Gemini

ModelInputOutputBest For
Flash$0.075/1M$0.30/1MSimple queries
Pro$1.25/1M$5/1MGeneral tasks
Ultra$7.5/1M$30/1MComplex analysis

ROI Calculator

Calculate if automation is worth it:

Manual task time: 30 minutes
Your hourly rate: $50/hour
Manual cost: $25 per task

Automation cost:
- API calls: $0.50
- Setup time (amortized): $5.00
- Total: $5.50 per task

Savings: $25 - $5.50 = $19.50 per task
ROI: 355%

Updates

  • 2026-03-27: Initial release
  • Pricing as of March 2026
  • Based on real user cost data

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

94.25%
按下载量换算1,482

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills