Skip to main content

Claude Code Cost Explorer

A local Flask web app for exploring Claude Code usage by day, session, and turn. It reads Claude Code JSONL logs from your machine, summarizes token usage, and estimates API cost without sending data anywhere.

No API key is needed. No database is used. No frontend build step is required.

What It Shows

Drill down: Day → Session → Turn

  • 💬 Conversation turns → full messages + collapsible thinking
  • 🛠️ Tool calls → [tool: Bash], [3 tools: Read, Write, Glob] → inputs + raw output

At each level it shows cost and token summaries. Turn detail pages can show the full user message, assistant content blocks, collapsible thinking blocks when present in the source log, and tool call inputs/results.

Home Sessions Detail
Home Sessions Detail

Install

pip install claude-code-cost-explorer

Run

ccx

Then open:

http://localhost:5050

You can also choose a port:

ccx --port 5051

If you want to view usage for a specific Claude root directory instead of your local ~/.claude/ directory, set CLAUDE_DIR:

CLAUDE_DIR=/path/to/claude_home ccx

Requirements

  • Python 3.10 or newer
  • Claude Code installed and used at least once
  • A local ~/.claude/projects/ directory containing Claude Code session JSONL files

How It Works

Claude Code Cost Explorer scans:

~/.claude/projects/*/*.jsonl

For each valid session file, it parses assistant records with token usage, associates them with the preceding user prompt or tool result, estimates cost from the model pricing table, and renders the result through local Flask/Jinja pages.

Session Naming Tips

Session titles come from Claude Code session metadata. Deliberate names make the session list much easier to scan when comparing costs across similar work.

How When
claude -n "my-feature" At startup
/rename my-feature During a conversation
Press R in the /resume picker After the fact

If you do not name a session, Claude assigns a random slug.

Development

uv run pytest -q
uv run ruff check .
uv run ruff format .

The project intentionally stays small: Flask, standard Python modules, Jinja templates, and tests.

License

MIT

Metadata

Release files for claude-code-cost-explorer 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-code-cost-explorer 0.1.7
File Size Uploaded
claude_code_cost_explorer-0.1.7.tar.gz 519.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-code-cost-explorer 0.1.7
File Interpreter ABI Platform
claude_code_cost_explorer-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 568.6 kB

Release files / claude_code_cost_explorer-0.1.7.tar.gz

Download URL claude_code_cost_explorer-0.1.7.tar.gz
Size 519.2 kB
Tags Source
SHA-256 checksum
How to use checksums
437de22973062ba05ccce4dc9781771c8b1f63b374e009e3d1c36c833d90c18a
BLAKE2b-256 checksum
How to use checksums
a8835e5839477d4ccd30f5fb9d079b7a3839a3a4eb37761225e290d4e204f037
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / claude_code_cost_explorer-0.1.7-py3-none-any.whl

Download URL claude_code_cost_explorer-0.1.7-py3-none-any.whl
Size 49.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92f4bbd8932b8cc44061d96671d9ded4c344b68801e48395cf40976120bfca90
BLAKE2b-256 checksum
How to use checksums
8b9c9e05fedced64c9cee3f4204246d6bcd99a448ff6c54e8dc5e0dc4d2b2541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page