Install
openclaw skills install @space-cadet/token-usageTrack, aggregate, and report OpenClaw token usage and costs across sessions.
openclaw skills install @space-cadet/token-usageParse OpenClaw session JSONL files to extract token usage, aggregate by date/model/session, and generate cost reports.
.jsonl files in ~/.openclaw/agents/*/sessions/input, output, cacheRead, cacheWrite, totalTokens from each assistant messagepython3 ~/.openclaw/skills/token-usage/scripts/parse.py --today
python3 ~/.openclaw/skills/token-usage/scripts/parse.py --week --costs
python3 ~/.openclaw/skills/token-usage/scripts/parse.py --all --by-model
python3 ~/.openclaw/skills/token-usage/scripts/parse.py --week --json > /tmp/token-report.json
Sessions are stored as JSONL with lines like:
{"type":"message","message":{"role":"assistant",...},"usage":{"input":1000,"output":500,"totalTokens":1500},...}
Uses model pricing from scripts/pricing.json (user-editable). Default prices:
Costs are approximate. Cache read/write pricing applied when available.
The script reports input + output tokens as the usage metric. This is the actual new token consumption per turn.
The totalTokens field in session files includes cacheRead (cached context window), which gets re-counted at every turn. Summing totalTokens across messages would massively overcount — a 10K context used for 100 turns would appear as 1M tokens. The script avoids this by only summing input and output.
~/.openclaw/skills/token-usage/logs/YYYY-MM-DD.md~/.openclaw/skills/token-usage/logs/week-YYYY-Www.md/tmp/token-usage-*.jsonusage fields (OpenClaw 2026.5+ format)