Skip to main content

Local-first Cost Explorer for Claude Code sessions -- slice your spend by tool, project, session, model

Project description

ccexplorer

Local-first Cost Explorer for Claude Code sessions. Walks ~/.claude/projects/<project>/<session>.jsonl, aggregates token usage, and renders an AWS-Cost-Explorer-style interactive HTML report so you can slice your spend by tool, project, session, model, and time.

Status: alpha -- v0.0.1 ships the cce build static-HTML path. CLI query subcommands (get-cost-and-usage, get-dimension-values) and the Trusted-Advisor-style recommendations engine are next.

Why

ccusage already does cost calculation well. ccexplorer adds two things the existing tools don't:

  1. Tool/agent attribution. Apportions each assistant turn's cost across its tool_use blocks so you can see which tools the money actually went to (and how much went to non-tool conversation).
  2. A slice-and-dice surface. Same query model as AWS Cost Explorer -- time-period x granularity x metrics x group-by x filter -- so you can answer questions like "today's voicemode tool calls, grouped by session" without writing SQL.

A recommendations engine ("Trusted Advisor for Claude Code") is the next layer on top -- top-N tool over-use, repeat-read detection, cache-write premium, etc.

Privacy

100% local. The tool never makes a network call. The report is a single HTML file with your data embedded as JSON; it loads Chart.js from a CDN but nothing else leaves your machine.

Install

# Zero-install run
uvx ccexplorer

# Or install persistently
pip install ccexplorer

Usage

# Walk ~/.claude/projects, build /tmp/cce.html, open it in your browser
cce build

# Custom output path, no browser launch
cce build --output ~/cce-report.html --no-open

# Different projects root (rarely needed)
cce build --projects-root /path/to/.claude/projects

Run with no subcommand and you get cce build with default flags -- the "just show me the pretty thing" path.

What the report shows

  • Total spend, with breakdowns by tool, project, session, model, and day
  • Tool vs non-tool token-cost split (often surprising -- ~50% of long sessions is non-tool conversation)
  • Cache-write / cache-read / input / output split (cache writes are often the largest line item on Opus sessions)
  • AWS-Cost-Explorer-style sidebar: time-range presets (1d / 7d / 30d / All), group-by dropdowns, filter chips, advanced toggles

Roadmap

  • cce get-cost-and-usage (CLI flagship, mirrors aws ce)
  • cce get-dimension-values (enumerate tools / projects / models)
  • AGENT dimension (extract sub-agent type from Agent tool calls)
  • TAG support (sidecar <session>.tags.json or cce tag command)
  • COST_CATEGORY rules engine
  • cce serve (live local server, no rebuild on every change)
  • cce advise -- recommendations engine

Acknowledgements

Idea and voice-spec: Mike Bailey (@mbailey) -- including the $46k of his own session data we validated against. Research, prototype, write-up: Cora 7. A "How this got built" page is forthcoming -- this project is transparent about its AI-pair-programming origin.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccexplorer-0.0.1.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccexplorer-0.0.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file ccexplorer-0.0.1.tar.gz.

File metadata

  • Download URL: ccexplorer-0.0.1.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for ccexplorer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b655497660977888bca823ddf23fe7754f5ca9f76d81186c32451d4d661c6de9
MD5 e44447a9957988516431c782bc8e569e
BLAKE2b-256 1c6211ea2f2a42b0bc970bccd1870d2b0ae469371d8a687ad82e44eede392ea2

See more details on using hashes here.

File details

Details for the file ccexplorer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ccexplorer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for ccexplorer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3cb5a2ce14f71a147ebc78db1946c92107c4772e6272d5ce7abf9f6396f6c341
MD5 5b3c174fefabc9997e5f7a14c2bda276
BLAKE2b-256 69de065b6ee9c945fa8e4714c39e326abca80c4af28782a37ad10cc47f921d1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page