{"id":50443686,"url":"https://github.com/ericrihm/claude-usage-fleet","last_synced_at":"2026-05-31T20:02:10.652Z","repository":{"id":353286805,"uuid":"1218767470","full_name":"ericrihm/claude-usage-fleet","owner":"ericrihm","description":"Multi-account fork — one dashboard for four AI coding profiles, with per-account filtering, side-by-side comparison, and webhook alerts on 5-hour block thresholds","archived":false,"fork":false,"pushed_at":"2026-05-11T14:36:05.000Z","size":1527,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T16:25:06.394Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/ericrihm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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":null,"dco":null,"cla":null}},"created_at":"2026-04-23T07:41:37.000Z","updated_at":"2026-05-11T14:50:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ericrihm/claude-usage-fleet","commit_stats":null,"previous_names":["ericrihm/claude-usage-fleet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ericrihm/claude-usage-fleet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrihm%2Fclaude-usage-fleet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrihm%2Fclaude-usage-fleet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrihm%2Fclaude-usage-fleet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrihm%2Fclaude-usage-fleet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericrihm","download_url":"https://codeload.github.com/ericrihm/claude-usage-fleet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrihm%2Fclaude-usage-fleet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33746514,"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-05-31T02:00:06.040Z","response_time":95,"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":[],"created_at":"2026-05-31T20:02:09.797Z","updated_at":"2026-05-31T20:02:10.644Z","avatar_url":"https://github.com/ericrihm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude Code Usage Dashboard — Fleet Edition\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](LICENSE)\n[![claude-code](https://img.shields.io/badge/claude--code-black?style=flat-square)](https://claude.ai/code)\n\n**Pro and Max subscribers get a progress bar. This gives you the full picture — across every account you run.**\n\nThis is a fork of [phuryn/claude-usage](https://github.com/phuryn/claude-usage) that adds multi-account support: track several `CLAUDE_CONFIG_DIR` profiles in one dashboard, compare them side-by-side, and fire webhooks when any of them approaches its 5-hour block limit. See [CHANGELOG.md](CHANGELOG.md) for the list of additions.\n\nClaude Code writes detailed usage logs locally — token counts, models, sessions, projects — regardless of your plan. This dashboard reads those logs and turns them into charts and cost estimates. Works on API, Pro, and Max plans.\n\n![Claude Usage Dashboard](docs/screenshot.png)\n\n**Created by:** [The Product Compass Newsletter](https://www.productcompass.pm)\n\n---\n\n## What this tracks\n\nWorks on **API, Pro, and Max plans** — Claude Code writes local usage logs regardless of subscription type. This tool reads those logs and gives you visibility that Anthropic's UI doesn't provide.\n\nCaptures usage from:\n- **Claude Code CLI** (`claude` command in terminal)\n- **VS Code extension** (Claude Code sidebar)\n- **Dispatched Code sessions** (sessions routed through Claude Code)\n\n**Not captured:**\n- **Cowork sessions** — these run server-side and do not write local JSONL transcripts\n\n---\n\n## Requirements\n\n- Python 3.8+\n- No third-party packages — uses only the standard library (`sqlite3`, `http.server`, `json`, `pathlib`)\n\n\u003e Anyone running Claude Code already has Python installed.\n\n## Quick Start\n\nNo `pip install`, no virtual environment, no build step.\n\n### Windows\n```\ngit clone https://github.com/phuryn/claude-usage\ncd claude-usage\npython cli.py dashboard\n```\n\n### macOS / Linux\n```\ngit clone https://github.com/phuryn/claude-usage\ncd claude-usage\npython3 cli.py dashboard\n```\n\n---\n\n## Usage\n\n\u003e On macOS/Linux, use `python3` instead of `python` in all commands below.\n\n```\n# Scan JSONL files and populate the database (~/.claude/usage.db)\npython cli.py scan\n\n# Show today's usage summary by model (in terminal)\npython cli.py today\n\n# Show all-time statistics (in terminal)\npython cli.py stats\n\n# Check per-account 5h block usage and fire webhook alerts\npython cli.py alerts\n\n# Scan + open browser dashboard at http://localhost:8080\npython cli.py dashboard\n\n# Custom host and port via environment variables\nHOST=0.0.0.0 PORT=9000 python cli.py dashboard\n\n# Scan a custom projects directory\npython cli.py scan --projects-dir /path/to/transcripts\n```\n\nThe scanner is incremental — it tracks each file's path and modification time, so re-running `scan` is fast and only processes new or changed files.\n\nBy default, the scanner checks both `~/.claude/projects/` and the Xcode Claude integration directory (`~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/projects/`), skipping any that don't exist. Use `--projects-dir` to scan a custom location instead.\n\n---\n\n## How it works\n\nClaude Code writes one JSONL file per session to `~/.claude/projects/`. Each line is a JSON record; `assistant`-type records contain:\n- `message.usage.input_tokens` — raw prompt tokens\n- `message.usage.output_tokens` — generated tokens\n- `message.usage.cache_creation_input_tokens` — tokens written to prompt cache\n- `message.usage.cache_read_input_tokens` — tokens served from prompt cache\n- `message.model` — the model used (e.g. `claude-sonnet-4-6`)\n\n`scanner.py` parses those files and stores the data in a SQLite database at `~/.claude/usage.db`.\n\n`dashboard.py` serves a single-page dashboard on `localhost:8080` with Chart.js charts (loaded from CDN). It auto-refreshes every 30 seconds and supports model filtering with bookmarkable URLs. The bind address and port can be overridden with `HOST` and `PORT` environment variables (defaults: `localhost`, `8080`).\n\n---\n\n## Cost estimates\n\nCosts are calculated using **Anthropic API pricing as of April 2026** ([claude.com/pricing#api](https://claude.com/pricing#api)).\n\n**Only models whose name contains `opus`, `sonnet`, or `haiku` are included in cost calculations.** Local models, unknown models, and any other model names are excluded (shown as `n/a`).\n\n| Model | Input | Output | Cache Write | Cache Read |\n|-------|-------|--------|------------|-----------|\n| claude-opus-4-6 | $5.00/MTok | $25.00/MTok | $6.25/MTok | $0.50/MTok |\n| claude-sonnet-4-6 | $3.00/MTok | $15.00/MTok | $3.75/MTok | $0.30/MTok |\n| claude-haiku-4-5 | $1.00/MTok | $5.00/MTok | $1.25/MTok | $0.10/MTok |\n\n\u003e **Note:** These are API prices. If you use Claude Code via a Max or Pro subscription, your actual cost structure is different (subscription-based, not per-token).\n\n---\n\n## Multi-account setup\n\nIf you run Claude Code under more than one profile (different subscriptions, separate accounts per client, etc.), point each profile at its own `CLAUDE_CONFIG_DIR` and list them in `~/.claude/accounts.json`:\n\n```json\n{\n  \"accounts\": [\n    {\"name\": \"acct1\", \"path\": \"~/.claude-acct1\", \"plan\": \"max_20x\"},\n    {\"name\": \"acct2\", \"path\": \"~/.claude-acct2\", \"plan\": \"max_5x\"},\n    {\"name\": \"acct3\", \"path\": \"/mnt/c/Users/me/.claude-acct3\", \"plan\": \"pro\"},\n    {\"name\": \"acct4\", \"path\": \"/mnt/c/Users/me/.claude-acct4\", \"plan\": \"pro\"}\n  ],\n  \"thresholds\": { \"warn\": 0.75, \"critical\": 0.95 },\n  \"webhooks\": [\n    {\"url\": \"https://ntfy.sh/your-topic-here\", \"on\": [\"warn\", \"critical\"]}\n  ]\n}\n```\n\nCopy `accounts.json.example` for a starting point. When `~/.claude/accounts.json` is absent the fork behaves exactly like upstream — one \"default\" account pointing at `~/.claude/projects/`. `accounts.json` is in `.gitignore`.\n\n- **Paths** accept `~` expansion and both POSIX (`/home/me/...`) and Windows (`C:\\Users\\me\\...`) formats. WSL users can mix WSL-native paths and `/mnt/c/...` paths in the same config — the scanner normalizes via `pathlib.Path`.\n- **Windows-host + WSL distros.** If you run Claude Code inside WSL distros (Kali, Parrot, BlackArch, Ubuntu, …) and the dashboard on the Windows host, point each account at the distro's `.claude` via a UNC path: `//wsl$/\u003cdistro-name\u003e/home/\u003cuser\u003e/.claude`. Forward slashes work; `pathlib.Path` handles UNC transparently on Windows. Distros must be running during the scan — stopped distros emit a SKIP warning and scan continues. See `accounts.json.example` for a four-distro template.\n- **`extra_paths`** (optional per-account list) scans additional transcript roots under the same account name. macOS users who run Claude Code from both the CLI and the Xcode integration can list `~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig` here to pull in both sources.\n- **Plans** are `api`, `pro`, `max_5x`, `max_20x`, or omitted. Plan determines the denominator for the 5-hour block progress bars (`pro ≈ 44k`, `max_5x ≈ 88k`, `max_20x ≈ 220k` tokens per 5h block — community estimates; `api` and omitted have no limit and are never alerted on).\n- **Thresholds** drive the header strip colors (green below `warn`, yellow at `warn`, red at `critical`) and whether `alerts` fires a webhook.\n- **Webhooks** get a JSON POST with `{account, level, usage_fraction, block_reset_at}` when the account first crosses each threshold. Alert state is stored in an `alert_state` SQLite table so re-runs don't re-spam; downgrading below the threshold silently resets so a later re-cross fires again.\n\nRunning `python cli.py scan` walks every configured account and prints a summary table; `python cli.py dashboard` shows all accounts by default with a filter dropdown and a Compare Accounts tab. Schedule `python cli.py alerts` in cron (Linux/macOS) or Task Scheduler (Windows) to get webhooks between manual runs.\n\n**Renaming an account:** if you change an account's `name` in `accounts.json` while keeping the same path, the old name's historical rows stay in the DB (so they still show up in filtered views) and the scanner warns on the next run. Click **Rescan** in the dashboard or delete `~/.claude/usage.db` to rebuild under only the current names.\n\n---\n\n## Files\n\n| File | Purpose |\n|------|---------|\n| `scanner.py` | Parses JSONL transcripts, writes to `~/.claude/usage.db`; `scan_all()` walks every configured account |\n| `dashboard.py` | HTTP server + single-page HTML/JS dashboard with account filter and Compare tab |\n| `cli.py` | `scan`, `today`, `stats`, `alerts`, `dashboard` commands |\n| `config.py` | Loads `accounts.json`; falls back to single-account defaults when missing |\n| `alerts.py` | Per-account block usage, threshold crossings, webhook firing with dedup |\n| `accounts.json.example` | Reference config with 4 profiles and a webhook entry |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericrihm%2Fclaude-usage-fleet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericrihm%2Fclaude-usage-fleet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericrihm%2Fclaude-usage-fleet/lists"}