{"id":50723342,"url":"https://github.com/mazulo/claude-cost-compare","last_synced_at":"2026-06-10T02:02:51.721Z","repository":{"id":360507798,"uuid":"1250466314","full_name":"mazulo/claude-cost-compare","owner":"mazulo","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-26T18:42:30.000Z","size":651,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-26T19:09:09.393Z","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/mazulo.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-05-26T16:54:40.000Z","updated_at":"2026-05-26T18:42:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mazulo/claude-cost-compare","commit_stats":null,"previous_names":["mazulo/claude-cost-compare"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mazulo/claude-cost-compare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazulo%2Fclaude-cost-compare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazulo%2Fclaude-cost-compare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazulo%2Fclaude-cost-compare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazulo%2Fclaude-cost-compare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mazulo","download_url":"https://codeload.github.com/mazulo/claude-cost-compare/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazulo%2Fclaude-cost-compare/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34133406,"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-10T02:00:07.152Z","response_time":89,"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-06-10T02:02:51.016Z","updated_at":"2026-06-10T02:02:51.716Z","avatar_url":"https://github.com/mazulo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# claude-cost-compare\n\n**Daily Claude spend, before/after windows, and model routing health — in your terminal.**\n\n[![PyPI](https://img.shields.io/pypi/v/claude-cost-compare?style=flat-square\u0026logo=pypi\u0026logoColor=white)](https://pypi.org/project/claude-cost-compare/)\n[![Python](https://img.shields.io/pypi/pyversions/claude-cost-compare?style=flat-square\u0026logo=python\u0026logoColor=white)](https://pypi.org/project/claude-cost-compare/)\n[![CI](https://img.shields.io/github/actions/workflow/status/mazulo/claude-cost-compare/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/mazulo/claude-cost-compare/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)\n\nTurn local [ccusage](https://github.com/ryoppippi/ccusage) data into three Rich tables: daily cost, split-window comparison, and per-model verdicts.\n\n**Not a ccusage fork** — an interpretation layer on top. ccusage reports what you spent; this CLI adds before/after windows, mix shifts, and routing health verdicts.\n\n[Quick start](#-quick-start) · [Demo](#-demo) · [ccusage vs this tool](#-ccusage-vs-this-tool) · [Install](#-install) · [Usage](#-usage) · [How it works](#-how-it-works)\n\n\u003c/div\u003e\n\n---\n\n## ✨ Why this exists\n\nClaude Code usage can spike fast — especially when Opus routing leaks or Sonnet/Haiku tiers stop doing their job. This CLI answers three questions at a glance:\n\n| Question | Table |\n|----------|-------|\n| What did I spend each day? | **Daily cost** — cost, tokens, model mix |\n| Did things change after a date? | **Before vs After** — avg/day, totals, mix shift |\n| Are models routed correctly? | **Real Signal** — Opus / Sonnet / Haiku verdicts |\n\nNo cloud upload. Reads your local ccusage JSON and prints a terminal report.\n\n---\n\n## 🔀 ccusage vs this tool\n\n| | [ccusage](https://github.com/ryoppippi/ccusage) | **claude-cost-compare** |\n|---|-----|-----|\n| **Role** | Usage analytics — read local logs, report spend | Interpretation layer — explain *what changed* and *if routing looks healthy* |\n| **Scope** | Many agents, daily/weekly/monthly/session views | Claude Code focus: before/after split + model mix verdicts |\n| **Output** | Descriptive tables \u0026 totals | Daily cost + **Before vs After** + **Real Signal** (Opus/Sonnet/Haiku) |\n| **Install both?** | ✅ Required (data source) | ✅ Optional companion on top |\n\nUse ccusage for *“what did I spend?”* Use this when *“did something break after I changed config on Tuesday?”*\n\n---\n\n## 🖥 Demo\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/assets/demo.svg\" alt=\"claude-cost-compare terminal output showing daily cost, before/after comparison, and model health verdicts\" width=\"920\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003csub\u003eSample fixture output · \u003ccode\u003e--range 7 --cutoff 2026-05-08\u003c/code\u003e\u003c/sub\u003e\n\u003c/p\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eSame output as plain text\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nclaude-cost-compare --range 7 --cutoff 2026-05-08\n```\n\n```\nCLAUDE DAILY COST  ·  2026-05-06 → 2026-05-26\n┌─────────────┬────────┬───────────┬────────┬───────────┬──────┬────────┬──────┐\n│ Date        │ Era    │      Cost │ Tokens │ Mix       │ Opus │ Sonnet │ Haiku│\n├─────────────┼────────┼───────────┼────────┼───────────┼──────┼────────┼──────┤\n│ 2026-05-06  │ Before │     $2.68 │   3.2M │ ████████… │ 100% │     0% │   0% │\n│ 2026-05-08  │ Today  │    $80.88 │ 117.9M │ ████████… │  97% │     0% │   3% │\n│ 2026-05-09  │ After  │     $9.92 │  12.1M │ ████████… │  45% │    55% │   0% │\n└─────────────┴────────┴───────────┴────────┴───────────┴──────┴────────┴──────┘\n\nBEFORE vs AFTER  ·  Split at 2026-05-08\nREAL SIGNAL      ·  Post-2026-05-08 · per-model routing verdicts\n```\n\n\u003c/details\u003e\n\n---\n\n## 🚀 Quick start\n\n**1. Install ccusage** (peer dependency — reads your local usage data):\n\n```bash\nnpm install -g ccusage\n```\n\n**2. Install the CLI:**\n\n```bash\npip install claude-cost-compare\n# or\nuv tool install claude-cost-compare\n```\n\n**3. Run:**\n\n```bash\nclaude-cost-compare --range 5\n```\n\n---\n\n## 📦 Install\n\n### PyPI / uv\n\n```bash\npip install claude-cost-compare\nuv tool install claude-cost-compare\nuvx claude-cost-compare --help          # run without installing\n```\n\n### Homebrew\n\n```bash\nbrew tap mazulo/claude-cost-compare https://github.com/mazulo/claude-cost-compare\nbrew install claude-cost-compare\nnpm install -g ccusage                  # still required\n```\n\nOne-liner (no tap):\n\n```bash\nbrew install https://raw.githubusercontent.com/mazulo/claude-cost-compare/main/Formula/claude-cost-compare.rb\n```\n\n### Requirements\n\n- Python **3.11+** (pip/uv) or Homebrew\n- [ccusage](https://www.npmjs.com/package/ccusage) on your `PATH` (v18+; v20 `period` JSON field supported)\n\n---\n\n## 📖 Usage\n\n```bash\n# Last 5 days vs today (default)\nclaude-cost-compare --range 5\n\n# 7-day window split at a specific date\nclaude-cost-compare --range 7 --cutoff 2026-05-13\n\n# Full billing period from a start date\nclaude-cost-compare --since 2026-05-01 --cutoff 2026-05-13\n\n# Daily summary only — skip comparison tables\nclaude-cost-compare --summary --since 2026-05-01\n\n# Plain output (also respects NO_COLOR)\nclaude-cost-compare --plain --range 5\n```\n\n### Flags\n\n| Flag | Short | Description |\n|------|-------|-------------|\n| `--range` | `-r` | Days before cutoff for the \"before\" window (default: `5`) |\n| `--cutoff` | `-c` | Before/after split date `YYYY-MM-DD` (default: today) |\n| `--since` | `-s` | Explicit start date — overrides `--range` |\n| `--summary` | | Daily cost table only |\n| `--plain` | | Disable color |\n\n---\n\n## 🧠 How it works\n\n```mermaid\nflowchart LR\n  A[ccusage JSON] --\u003e B[Parser]\n  B --\u003e C[Window stats]\n  C --\u003e D[Before / After deltas]\n  C --\u003e E[Model verdicts]\n  D --\u003e F[Rich terminal report]\n  E --\u003e F\n```\n\n1. **Fetch** — shells out to `ccusage daily` for JSON (NVM-aware discovery; supports `date` and v20 `period` rows).\n2. **Parse** — normalizes dates, costs, and per-model breakdowns.\n3. **Analyze** — splits records at `--cutoff`, computes averages and mix shifts.\n4. **Verdict** — flags Opus routing leaks, low Sonnet share, Haiku usage patterns.\n5. **Render** — Rich tables with era labels, mix bars, and color-coded costs.\n\n---\n\n## 🛠 Development\n\n```bash\ngit clone https://github.com/mazulo/claude-cost-compare.git\ncd claude-cost-compare\nuv sync --dev\nuv run pytest\nuv run claude-cost-compare --range 5\n```\n\nRegenerate the README demo SVG after UI changes:\n\n```bash\nuv run python scripts/export_demo.py\n```\n\n---\n\n## 🚢 Releasing\n\nBump `version` in `pyproject.toml` and `src/claude_cost_compare/__init__.py`, push to `main`, then run the **Publish** workflow from GitHub Actions. It will:\n\n1. Run tests and publish to PyPI\n2. Update the Homebrew formula checksum\n3. Create a git tag and GitHub Release\n4. Refresh Homebrew Python resources on macOS\n\nDetails: [docs/RELEASING.md](docs/RELEASING.md)\n\n---\n\n## 📄 License\n\nMIT — see [LICENSE](LICENSE).\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\nBuilt for Claude Code power users who want spend visibility without leaving the terminal.\n\n**[⭐ Star on GitHub](https://github.com/mazulo/claude-cost-compare)** if this saves you from an Opus routing surprise.\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazulo%2Fclaude-cost-compare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmazulo%2Fclaude-cost-compare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazulo%2Fclaude-cost-compare/lists"}