Local web app to explore Claude Code API cost and token usage by day, session, and turn
Project description
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 |
|---|---|---|
Install
pip install claude-code-cost-explorer
Run
ccx
Then open:
http://localhost:5050
You can also choose a port:
ccx --port 5051
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_code_cost_explorer-0.1.3.tar.gz.
File metadata
- Download URL: claude_code_cost_explorer-0.1.3.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b58cd4e9129e165af1de0d54fb750e88346450937437d20d84cf46190cc54a8
|
|
| MD5 |
f7fe2f430818dbe7fad6bd4b8123517b
|
|
| BLAKE2b-256 |
0519e0fc35508f1c9308d71b3be99e194c0f9a06c8ba61c7c1f5692d5a94170b
|
Provenance
The following attestation bundles were made for claude_code_cost_explorer-0.1.3.tar.gz:
Publisher:
publish.yml on ranajoy-dutta/claude-code-cost-explorer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_cost_explorer-0.1.3.tar.gz -
Subject digest:
6b58cd4e9129e165af1de0d54fb750e88346450937437d20d84cf46190cc54a8 - Sigstore transparency entry: 1391448889
- Sigstore integration time:
-
Permalink:
ranajoy-dutta/claude-code-cost-explorer@cbb3d37729157d54291b25e81cd5ee0e5158a8af -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ranajoy-dutta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cbb3d37729157d54291b25e81cd5ee0e5158a8af -
Trigger Event:
release
-
Statement type:
File details
Details for the file claude_code_cost_explorer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: claude_code_cost_explorer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19ec2b0c812d3331a4d8d2b6e30dabdcf7e42c8ca2d83feceba4a268782fc5a0
|
|
| MD5 |
d31a86a2616e39762bd6188c2a592d21
|
|
| BLAKE2b-256 |
ee6ed25db04ca7883915447e4cce371366633de744241a7b0bed6878fdd55a45
|
Provenance
The following attestation bundles were made for claude_code_cost_explorer-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on ranajoy-dutta/claude-code-cost-explorer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_cost_explorer-0.1.3-py3-none-any.whl -
Subject digest:
19ec2b0c812d3331a4d8d2b6e30dabdcf7e42c8ca2d83feceba4a268782fc5a0 - Sigstore transparency entry: 1391448897
- Sigstore integration time:
-
Permalink:
ranajoy-dutta/claude-code-cost-explorer@cbb3d37729157d54291b25e81cd5ee0e5158a8af -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ranajoy-dutta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cbb3d37729157d54291b25e81cd5ee0e5158a8af -
Trigger Event:
release
-
Statement type: