1.1 KiB
1.1 KiB
openclaw-daily-tokens-exporter
Tiny FastAPI Prometheus exporter for OpenClaw daily token totals.
What it exports
Reads OpenClaw session JSONL files and exposes today's totals at /metrics:
openclaw_daily_total_tokensopenclaw_daily_input_tokensopenclaw_daily_output_tokensopenclaw_daily_cache_read_tokensopenclaw_daily_cache_write_tokensopenclaw_daily_reasoning_tokensopenclaw_daily_usage_entries
Timezone defaults to Europe/Berlin.
Run locally
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 9487
Runtime
- Canonical repo path:
/root/projects/openclaw-usage-exporter - systemd user unit:
~/.config/systemd/user/openclaw-daily-tokens-exporter.service - Direct metrics:
http://100.74.255.106:9487/metrics - Tailscale Serve path:
https://luna.taile7522.ts.net/openclaw-daily-tokens
Env
OPENCLAW_SESSIONS_DIRdefault:/root/.openclaw/agents/main/sessionsOPENCLAW_EXPORTER_TZdefault:Europe/BerlinPORTignored by app directly; set it in the service/uvicorn command