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.2.tar.gz (44.7 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.2-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ccexplorer-0.0.2.tar.gz
  • Upload date:
  • Size: 44.7 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.2.tar.gz
Algorithm Hash digest
SHA256 4acfdd01f975b500a343a3b48ce04c9c5cf2e8c216ba915b2f3126912077059c
MD5 d4cfbb64122bc5cc87c77387f59237e8
BLAKE2b-256 6b380a108d2cf53ff48e1a5f40b0abd528683d466c15e0d1ca8409618853bca4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ccexplorer-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 434d7fd024dcd0c5a8b991a90ee3bd96075735fbe9568d6777a303ae875c7757
MD5 d965a61c50fec1b388d13abbef3a6dab
BLAKE2b-256 8951cc092dc8a43cc31141af75d391b5b3255976911eb890e740a198ba6e463e

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