Clawmeter
by @someone0070
Tracks OpenClaw API usage and spending in real-time with customizable budget alerts and detailed cost breakdowns by model and session.
Environment Variables
Edit .env to customize:
# Paths
OPENCLAW_AGENTS_DIR=/home/youruser/.openclaw/agents
CLAWMETER_DB=/home/youruser/.openclaw/workspace/clawmeter/data/clawmeter.dbServer
PORT=3377Budgets (USD)
BUDGET_DAILY_LIMIT=5.00
BUDGET_MONTHLY_LIMIT=100.00Telegram alerts (optional)
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_idEmail alerts (optional)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your@email.com
SMTP_PASS=your_app_password
ALERT_EMAIL_TO=notify@yourdomain.com
Budget Alerts
ClawMeter automatically checks spending against configured thresholds and sends alerts via:
Alert triggers:
BUDGET_DAILY_LIMITBUDGET_MONTHLY_LIMITAlert throttling: One alert per type per day (prevents spam).
Dashboard shows $0.00
Cause: Session logs not found or not yet ingested.
Fix:
1. Verify OPENCLAW_AGENTS_DIR points to correct path
2. Run npm run ingest manually
3. Check that .jsonl files exist in agents/*/sessions/
Auto-watch not working
Cause: File watcher not detecting changes.
Fix:
1. Ensure server is running (npm start)
2. Check terminal for π₯ X new events messages
3. Verify file permissions on session directories
Budget alerts not sending
Cause: Missing or incorrect credentials.
Fix:
1. Double-check TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID in .env
2. For email, verify SMTP settings
3. Check server logs for error messages
Database errors
Cause: Corrupted or locked database file.
Fix:
1. Stop the server
2. Backup data/clawmeter.db
3. Delete database and re-run npm run ingest
clawhub install clawmeter