{"id":50755264,"url":"https://github.com/escoffier-labs/usage-tracker","last_synced_at":"2026-06-11T04:02:44.558Z","repository":{"id":363809127,"uuid":"1247800419","full_name":"escoffier-labs/usage-tracker","owner":"escoffier-labs","description":"Token usage and cost analytics for OpenClaw sessions with multi-model breakdown","archived":false,"fork":false,"pushed_at":"2026-06-10T12:49:51.000Z","size":762,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-10T13:20:49.207Z","etag":null,"topics":["ai-tools","analytics","api-usage","cost-tracking","llm","monitoring"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/escoffier-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"solomonneas","ko_fi":"solomonneas","buy_me_a_coffee":"solomonneas"}},"created_at":"2026-05-23T19:52:36.000Z","updated_at":"2026-06-10T12:50:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/escoffier-labs/usage-tracker","commit_stats":null,"previous_names":["escoffier-labs/usage-tracker"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/escoffier-labs/usage-tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escoffier-labs%2Fusage-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escoffier-labs%2Fusage-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escoffier-labs%2Fusage-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escoffier-labs%2Fusage-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/escoffier-labs","download_url":"https://codeload.github.com/escoffier-labs/usage-tracker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escoffier-labs%2Fusage-tracker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34181555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","analytics","api-usage","cost-tracking","llm","monitoring"],"created_at":"2026-06-11T04:02:43.713Z","updated_at":"2026-06-11T04:02:44.553Z","avatar_url":"https://github.com/escoffier-labs.png","language":"HTML","funding_links":["https://github.com/sponsors/solomonneas","https://ko-fi.com/solomonneas","https://buymeacoffee.com/solomonneas"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/assets/usage-tracker-banner.jpg\" alt=\"Usage Tracker banner\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eUsage Tracker\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eOpenClaw + Claude Code session cost analytics for API spend, OAuth subscription value, and model usage.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/HTML5-E34F26?style=for-the-badge\u0026logo=html5\u0026logoColor=white\" alt=\"HTML5\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Python-3.x-3776AB?style=for-the-badge\u0026logo=python\u0026logoColor=white\" alt=\"Python 3\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/OpenClaw-usage_analytics-ef4444?style=for-the-badge\" alt=\"OpenClaw usage analytics\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/static_page-no_backend-0f766e?style=for-the-badge\" alt=\"Static page, no backend\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/license-MIT-green?style=for-the-badge\" alt=\"MIT license\"\u003e\n\u003c/p\u003e\n\nMachine-wide AI session cost analytics. Single static page plus a tiny Python exporter that reads OpenClaw session transcripts, Claude Code project transcripts, and Codex CLI rollouts, and writes a flat `data/usage.json` the page renders.\n\nSplits 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.\n\n## Quick start\n\n```bash\ngit clone https://github.com/escoffier-labs/usage-tracker.git\ncd usage-tracker\n\n# Build data/usage.json from your OpenClaw + Claude Code sessions\npython3 bin/export_usage.py --since 30d\n\n# Serve the page\npython3 -m http.server 5200\n```\n\nOpen http://localhost:5200.\n\nFor an always-fresh dataset, install the opt-in user-systemd timer (5 minute refresh):\n\n```bash\ncp bin/usage-tracker-export.service ~/.config/systemd/user/\ncp bin/usage-tracker-export.timer   ~/.config/systemd/user/\nsystemctl --user daemon-reload\nsystemctl --user enable --now usage-tracker-export.timer\n```\n\n(Edit the service file's `ExecStart` path to point at wherever you cloned this repo.)\n\n## Billing classification\n\nEach call is classified as `oauth` (subscription burn, billed flat) or `api` (real per-token spend):\n\n- Calls served by a subscription backend are detected from the API id (`openai-chatgpt-responses`, `cli`, `google-gemini-cli`) regardless of provider.\n- Providers in the OAuth set (`openai-codex`, `claude-cli`, `acpx`, `google-gemini-cli` by default) are `oauth`; everything else is `api`.\n- Override per export with `--oauth-providers`. Example: if grok runs on a SuperGrok subscription via device-code OAuth, use `--oauth-providers openai-codex,claude-cli,acpx,google-gemini-cli,xai`.\n- Claude Code records are always `oauth` (Claude Code transcripts carry token counts but no cost; the exporter estimates the API-equivalent cost from a built-in pricing table). Disable the source with `--no-claude-code` or point elsewhere with `--claude-projects PATH`.\n- Codex CLI rollouts (`~/.codex/sessions`) are always `oauth` (ChatGPT subscription); per-call tokens come from `token_count` events and cost is estimated from the same pricing table. Disable with `--no-codex` or point elsewhere with `--codex-sessions PATH`.\n- Models missing from the pricing table export with `costUsd: null`; the page counts them as \"calls missing cost data\" instead of silently pricing them at zero.\n\n## Drag-and-drop fallback\n\nIf `data/usage.json` is missing (e.g., you opened the page on a different machine), drop one or more OpenClaw `*.trajectory.jsonl` files or a previously-exported `usage.json` onto the page. Records are parsed client-side and cached in localStorage.\n\n## What it shows\n\n- **API spend** versus **OAuth value extracted** for the period\n- Per-agent breakdown (main, coder, codex-builder, claude-code, codex-cli, ...)\n- Sessions table grouped by session id, with per-call drill-down\n- Per-model bar chart, stacked by billing type\n- Daily cost time series, stacked by billing type\n- Subscription ROI: monthly subscription costs versus OAuth value extracted\n- Five design variants to choose from\n\n## Architecture\n\n- `bin/export_usage.py` walks `~/.openclaw/agents/*/sessions/*.jsonl` (plain session transcripts; one per session), `~/.claude/projects/*/*.jsonl` (Claude Code), and `~/.codex/sessions/**/*.jsonl` (Codex CLI rollouts), extracts per-call usage, writes a flat array to `data/usage.json`. OpenClaw's `*.trajectory.jsonl` files are NOT used: they only exist for a fraction of runs and undercount usage by an order of magnitude.\n- `index.html` fetches `data/usage.json` on load (drag-and-drop fallback), normalizes records into renderer-friendly aggregates, displays.\n- No backend. localStorage caches the last load and your subscription settings.\n\n## Development\n\n```bash\npython3 -m pytest tests/   # exporter tests\npython3 -m http.server 5200  # page\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescoffier-labs%2Fusage-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fescoffier-labs%2Fusage-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescoffier-labs%2Fusage-tracker/lists"}