OpenClaw session cost analytics for API spend, OAuth subscription value, and model usage.
OpenClaw session cost analytics. Single static page plus a tiny Python exporter that reads OpenClaw trajectory jsonls and writes a flat data/usage.json the page renders.
Splits real API spend from OAuth subscription burn (what your Codex Pro / Claude Max calls would have cost at API rates) so you can see what each session actually cost and whether your subscriptions are paying off.
git clone https://github.com/solomonneas/usage-tracker.git
cd usage-tracker
# Build data/usage.json from your OpenClaw sessions
python3 bin/export_usage.py --since 30d
# Serve the page
python3 -m http.server 5200Open http://localhost:5200.
For an always-fresh dataset, install the opt-in user-systemd timer (5 minute refresh):
cp bin/usage-tracker-export.service ~/.config/systemd/user/
cp bin/usage-tracker-export.timer ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now usage-tracker-export.timer(Edit the service file's ExecStart path to point at wherever you cloned this repo.)
If data/usage.json is missing (e.g., you opened the page on a different machine), drop one or more *.trajectory.jsonl files or a previously-exported usage.json onto the page. Records are parsed client-side and cached in localStorage.
- API spend versus OAuth value extracted for the period
- Per-agent breakdown (main, coder, codex-builder, claude-builder, ...)
- Sessions table grouped by session id, with per-call drill-down
- Per-model bar chart, stacked by billing type
- Daily cost time series, stacked by billing type
- Subscription ROI: monthly subscription costs versus OAuth value extracted
- Five design variants to choose from
bin/export_usage.pywalks~/.openclaw/agents/*/sessions/*.trajectory.jsonl, extractsmodel.completedevents, writes a flat array todata/usage.json.index.htmlfetchesdata/usage.jsonon load (drag-and-drop fallback), normalizes records into renderer-friendly aggregates, displays.- No backend. localStorage caches the last load and your subscription settings.
python3 -m pytest tests/ # exporter tests
python3 -m http.server 5200 # pageMIT