Install
openclaw skills install clawmeterTracks OpenClaw API usage and spending in real-time with customizable budget alerts and detailed cost breakdowns by model and session.
openclaw skills install clawmeterTrack OpenClaw API usage and spending in real-time with budget alerts.
ClawMeter is a self-hosted cost tracking dashboard that monitors your OpenClaw session logs, calculates token usage and API costs, and provides real-time analytics with customizable budget alerts.
Perfect for:
Clone or download ClawMeter:
cd ~/.openclaw/workspace
git clone https://github.com/yourusername/clawmeter.git
cd clawmeter
Install dependencies:
npm install
Configure (optional):
cp .env.example .env
# Edit .env to customize paths, budget limits, or alert settings
Ingest existing logs:
npm run ingest
Start the dashboard:
npm start
Open dashboard: Navigate to http://localhost:3377
When this skill is installed, your OpenClaw agent can respond to:
"How much have I spent today?"
"What's my monthly spend?"
"Show me this week's costs"
"Which model is most expensive?"
"Show my most expensive sessions"
"What's my average daily spend?"
"Open my cost dashboard"
"Generate a cost report"
"Refresh cost data"
"Clear old cost data"
ClawMeter exposes a REST API that agents can query:
GET http://localhost:3377/api/summary
Response:
{
"today": 2.15,
"week": 8.42,
"month": 32.76,
"allTime": 127.89,
"sessions": 234,
"messages": 1842,
"budgetDaily": 5.0,
"budgetMonthly": 100.0
}
GET http://localhost:3377/api/daily?days=30
Response:
[
{
"date": "2026-02-14",
"cost": 2.15,
"input_tokens": 45820,
"output_tokens": 12340,
"messages": 18
}
]
GET http://localhost:3377/api/sessions?limit=50&offset=0
Response:
[
{
"id": "abc123",
"agent": "main",
"model": "claude-sonnet-4-5",
"total_cost": 0.842,
"message_count": 12
}
]
GET http://localhost:3377/api/models
Response:
[
{
"model": "claude-sonnet-4-5",
"provider": "anthropic",
"total_cost": 45.62,
"message_count": 324
}
]
GET http://localhost:3377/api/top-sessions?limit=10
GET http://localhost:3377/api/alerts
POST http://localhost:3377/api/ingest
Edit .env to customize:
# Paths
OPENCLAW_AGENTS_DIR=/home/youruser/.openclaw/agents
CLAWMETER_DB=/home/youruser/.openclaw/workspace/clawmeter/data/clawmeter.db
# Server
PORT=3377
# Budgets (USD)
BUDGET_DAILY_LIMIT=5.00
BUDGET_MONTHLY_LIMIT=100.00
# Telegram alerts (optional)
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id
# Email 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
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).
User: "How much have I spent today?"
Agent Response:
Let me check your spending...
📊 Today's Spend: $2.15
Budget: $5.00 (43% used)
You have $2.85 remaining today.
Implementation:
const res = await fetch('http://localhost:3377/api/summary');
const data = await res.json();
const pct = (data.today / data.budgetDaily * 100).toFixed(0);
return `📊 Today's Spend: $${data.today.toFixed(2)}\nBudget: $${data.budgetDaily.toFixed(2)} (${pct}% used)\n\nYou have $${(data.budgetDaily - data.today).toFixed(2)} remaining today.`;
User: "Which model should I use to save money?"
Agent Response:
Based on your usage history:
💰 Cost per 1K messages:
• Claude Haiku 3-5: $0.12
• GPT-4o-mini: $0.18
• Claude Sonnet 4-5: $0.45
• Claude Opus 4: $1.23
Recommendation: Use Haiku for simple tasks, Sonnet for complex work.
Agent (proactive):
⚠️ Budget Alert
You've spent $5.52 today, exceeding your $5.00 daily limit.
Top sessions today:
1. Code review task — $2.10
2. Research project — $1.85
3. Email drafting — $0.98
Consider switching to a cheaper model or pausing non-urgent tasks.
Scenario: You want to keep OpenClaw costs under $100/month.
Setup:
BUDGET_MONTHLY_LIMIT=100.00Result: Get notified before you exceed budget, adjust usage accordingly.
Scenario: Multiple team members use shared OpenClaw instance.
Setup:
Result: Fair cost distribution, identify optimization opportunities.
Scenario: You're unsure which model to use for different tasks.
Setup:
Result: Data-driven model selection, optimize for cost/quality balance.
Scenario: OpenClaw running in production, need cost visibility.
Setup:
Result: Catch cost spikes immediately, prevent runaway spending.
Cause: Session logs not found or not yet ingested.
Fix:
OPENCLAW_AGENTS_DIR points to correct pathnpm run ingest manually.jsonl files exist in agents/*/sessions/Cause: File watcher not detecting changes.
Fix:
npm start)📥 X new events messagesCause: Missing or incorrect credentials.
Fix:
TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID in .envCause: Corrupted or locked database file.
Fix:
data/clawmeter.dbnpm run ingestIf you use custom models or pricing changes:
src/pricing.mjsMODEL_PRICING object:
'your-custom-model': {
input: 2.50, // per million tokens
output: 10.00, // per million tokens
cacheRead: 0.25, // optional
cacheWrite: 3.75 // optional
}
Use cron to schedule daily/weekly reports:
# Daily summary at 9 AM
0 9 * * * curl -s http://localhost:3377/api/summary | mail -s "Daily Cost Report" you@example.com
Export raw data for external analysis:
# Export all sessions to CSV
sqlite3 data/clawmeter.db "SELECT * FROM sessions" -csv > sessions.csv
Create systemd service for persistent operation:
# /etc/systemd/system/clawmeter.service
[Unit]
Description=ClawMeter Cost Tracking Dashboard
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser/.openclaw/workspace/clawmeter
ExecStart=/usr/bin/npm start
Restart=always
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl enable clawmeter
sudo systemctl start clawmeter
By default, ClawMeter binds to localhost:3377 and is not exposed to the internet.
To access remotely, use SSH tunneling:
ssh -L 3377:localhost:3377 your-server
Session logs may contain conversation data. ClawMeter:
ClawMeter currently has no authentication. For production:
ClawMeter handles:
For massive deployments (millions of messages), consider:
Planned features:
MIT — Free and open source forever.
Made with ⚡ by the OpenClaw community
Track your spending. Optimize your costs. Stay in control.