检查指定时间范围内本地 OpenClaw 转录文件中的 Token 使用情况。当用户询问 OpenClaw、GitHub C... 中消耗了多少 Token 时使用。
Use the bundled script to aggregate token usage recorded in local OpenClaw transcript files under ~/.openclaw/agents/*/sessions/.
Run:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8'
Default output includes:
Optional additions:
--top-sessions 10 for Top N session ranking--csv-dir ~/.openclaw/workspace/output/token-usage-csv for CSV exports--format json for structured output including session totals--format markdown for a ready-to-share reportUTC+8 unless they ask otherwise.--agents when the user asks for specific agents.--providers or --models when the user wants only some models.--top-sessions when the user wants ranking or hotspot analysis..reset / .deleted transcript copies.All agents, human-readable summary:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8'
Only GitHub Copilot provider:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8' \
--providers github-copilot
Specific agents:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8' \
--agents main,xiaocheng,xiaowen
Top sessions ranking:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8' \
--top-sessions 10
JSON export:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8' \
--format json \
--output ~/.openclaw/workspace/output/token-usage.json
CSV exports:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8' \
--csv-dir ~/.openclaw/workspace/output/token-usage-csv
Markdown report:
bash
python3 ~/.openclaw/workspace/skills/openclaw-token-usage/scripts/report_openclaw_token_usage.py \
--from '2026-03-14' \
--to '2026-03-16' \
--tz 'UTC+8' \
--format markdown \
--output ~/.openclaw/workspace/output/token-usage-report.md
The script reports these metrics when present in transcripts:
inputoutputcacheReadcacheWritetotalTokensmessagesSession notes:
sessions.json indexes when available.file:<filename>.Markdown report notes:
Important:
--providers github-copilot.