Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Track OpenClaw token usage and API costs by parsing session JSONL files. Use when user asks about token spend, API costs, model usage breakdown, daily cost t...
Track OpenClaw token usage and API costs by parsing session JSONL files. Use when user asks about token spend, API costs, model usage breakdown, daily cost t...
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
Parse OpenClaw session files to compute per-model token usage, costs, and daily spend trends. Works with any OpenClaw installation โ no API keys or external services needed.
# All-time cost report python3 scripts/cost_tracker.py # Last 7 days python3 scripts/cost_tracker.py --days 7 # Today only python3 scripts/cost_tracker.py --days 1 # Since a specific date python3 scripts/cost_tracker.py --since 2026-02-01 # JSON output for dashboards/integrations python3 scripts/cost_tracker.py --days 30 --format json # Custom agents directory python3 scripts/cost_tracker.py --agents-dir /path/to/agents
Per-model breakdown: Total cost, tokens, and request count Input/output/cache token split Visual percentage bar Daily spend: Bar chart of cost per day (text) or structured array (JSON). Grand totals: Combined cost, tokens, and requests across all models.
Auto-discovers the OpenClaw agents directory (~/.openclaw/agents) Scans all agent session JSONL files (filtered by mtime for speed) Extracts message.usage and message.model from each entry Aggregates by model and by day Outputs formatted report or JSON
{ "models": [ { "model": "claude-opus-4-6", "totalTokens": 220800000, "inputTokens": 3200, "outputTokens": 390800, "cacheReadTokens": 149400000, "cacheWriteTokens": 1200000, "totalCost": 528.55, "requestCount": 2088 } ], "daily": [ { "date": "2026-02-20", "cost": 37.14, "byModel": { "opus-4-6": 35.0, "sonnet-4": 2.14 } } ], "grandTotal": { "totalCost": 580.11, "totalTokens": 269800000, "totalRequests": 3122 }, "meta": { "agentsDir": "...", "filesScanned": 65, "entriesParsed": 3122, "range": "7d" } }
Feed JSON output into dashboards, alerting, or budgeting tools. The daily array is ready for charting. Set up a cron to track spend over time: # Daily cost snapshot to file 0 0 * * * python3 /path/to/cost_tracker.py --days 1 --format json >> ~/cost-log.jsonl
Python 3.8+ OpenClaw installed with session data in ~/.openclaw/agents/ No external dependencies (stdlib only)
Code helpers, APIs, CLIs, browser automation, testing, and developer operations.
Largest current source with strong distribution and engagement signals.