Per-prompt cost & token analytics for Claude Code — built with Streamlit (CLI + dashboard, fully local)

I built a Streamlit dashboard to analyze every prompt I send to Claude Code — directly from local JSONL logs. No API key, no data leaves the machine.

It combines a CLI + interactive dashboard (using Apache ECharts via streamlit-echarts) with:

  • cost and token tracking per prompt and per project
  • session-level aggregation
  • auto-categorization of prompts by type
  • and more (usage patterns, cost insights, etc.)

Live demo (fake data, no login): https://prompt-analytics-demo.streamlit.app

Run it locally on your real Claude usage in 3 commands:

uv tool install “prompt-analytics-for-claude-code[dashboard]”
prompt-analytics run --categorize
prompt-analytics dashboard

Streamlit note: streamlit-echarts only registers properly via a real streamlit run (AppTest shows an empty registry), and cross-filtering relies on chart selection events.

Feedback very welcome — still early (0.x).

Nice app! Should be super useful.

Useful angle — especially keeping everything local to the JSONL logs. One thing that trips Claude Code cost dashboards is mixing list-price units: Anthropic’s current Haiku 5.5 card is $0.10 / $0.50 per million input/output under a 100K prompt (cache reads $0.01/M), while Sonnet 5.5 sits at $2 / $10 with $0.20/M cache reads, and the whole request jumps 5× once you cross the 100K prompt band on Haiku. If the dashboard prices every line at a single “Claude” rate, cache-heavy agent turns look several times too expensive (or too cheap) compared with the vendor invoice. Worth tagging each log row with model id plus cache-read vs cache-write vs fresh input so the per-prompt chart matches what Anthropic actually bills.