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 and Codex session JSONL files to extract token usage, aggregate by date/model/session, and generate cost reports across providers.
.jsonl files in OpenClaw agent sessions and nested Codex rollout sessionsevent_msg/token_count per-turn usagepython3 ~/.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 --week --by-cron
python3 ~/.openclaw/skills/token-usage/scripts/parse.py --week --by-cron --costs --json
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). The bundled table includes Kimi, OpenAI/GPT, Anthropic/Claude, and OpenRouter models. Unknown models are reported without a cost estimate rather than silently priced as Kimi.
Default examples (USD per 1M tokens):
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-*.jsonmessage.usage; Codex rollouts are parsed from payload.info.last_token_usage in token_count eventsinput + output is the new-usage metric; Codex cached input is reported separately as cacheRead