-
Notifications
You must be signed in to change notification settings - Fork 2
Dashboard
An interactive Streamlit view over your extracted data: cost breakdowns, the
session-depth meta-analysis, per-model and per-category charts, and quota
trends. Charts are Apache ECharts (via streamlit-echarts) on a dark theme,
and most charts cross-filter the whole board on click (and the time trend on
a date brush).
It is an optional extra (it pulls in Streamlit, Apache ECharts, pandas and NumPy), so it is not installed by the core tool.
Want to see it first? The public live demo runs this exact dashboard on a synthetic dataset — no install, no real data.
# editable checkout (uv)
uv sync --extra dashboard
prompt-analytics dashboard # reads ./output by default
# straight from PyPI, no install
uvx --with "prompt-analytics-for-claude-code[dashboard]" prompt-analytics dashboard
# or pip
pip install "prompt-analytics-for-claude-code[dashboard]"
prompt-analytics dashboard(Use double quotes around the [dashboard] extra — single quotes are passed
through literally by cmd.exe and break the install.)
The dashboard command runs streamlit run on the bundled app and serves on
http://localhost:8501 by default; if the port is taken it picks the next
free one and prints the URL. Any extra flags are forwarded straight to Streamlit,
so prompt-analytics dashboard --server.port 8599 changes the port; you can also
set defaults in a .streamlit/config.toml — see the
Streamlit docs.
The dashboard renders already-extracted CSVs, so run prompt-analytics extract (or run) first. If you start an extract while the dashboard is
open, the cache keys on the CSV mtimes — a browser refresh shows the new data.
Resolution order:
-
CCA_DEMO=1— the bundled syntheticdemo_data/dataset, with a "Demo data" banner. This is what the public live demo runs. -
CCA_DATA_DIR— an explicit directory of CSVs. -
--output-dir DIRon thedashboardcommand (exported to the app asPROMPT_ANALYTICS_OUTPUT_DIR). - Default:
./output.
# Linux / macOS
CCA_DEMO=1 prompt-analytics dashboard # synthetic demo data
CCA_DATA_DIR=/path/to/csvs prompt-analytics dashboard
prompt-analytics dashboard --output-dir ./out # a specific extract# Windows (PowerShell) — the `VAR=x cmd` prefix syntax does not exist there
$env:CCA_DEMO = "1"; prompt-analytics dashboard
$env:CCA_DATA_DIR = "C:\path\to\csvs"; prompt-analytics dashboard
prompt-analytics dashboard --output-dir .\out
Remove-Item Env:CCA_DEMO # unset when doneAll charts share one visual identity: color semantics live in
dashboard/theme.py (stable colors per token type, per model family, per
category) and the ECharts render layer in dashboard/echarts.py. Pages price
everything on the primary provider (the first in pricing.yml, anthropic by
default); the multi-provider grid stays available in the CLI.
Most categorical charts emit a cross-filter on click (project / model / category) and the time trend filters a date range by brush; a click surfaces an "Explore →" button into the Explorer page on the current selection.
| Page | Shows |
|---|---|
| Home | KPI cards + cost-split donut, then cost over time stacked by model (click a model → filter) with a Day/Week/Month toggle. |
| Usage | Cost by token type per day/week (date brush + click → date filter), cache-read headline + non-cache volume bars, subagent cost, and the spend punchcard (weekday × hour). |
| Models | Two donuts (token volume / cost by model), per-prompt cost distribution by model (box plot), and cost by model over time (Day/Week/Month toggle). Every chart emits the model filter on click. |
| Sessions | Horizontal cost pareto by project (click → project filter), a cost treemap (click a tile → Explorer), prompts/session, and a box plot of cost/session by model. |
| Session depth | KPI deep-vs-opener cost multiplier, a box plot of one prompt's cost by depth band, and 2×2 small-multiples of the input-side token mix — the differentiating analysis. |
| Prompts | Twin bars (count + cost per category, with median $/prompt), a complexity histogram, and box plots (cost by category / by complexity). Clicking a category filters the board (needs categorize). |
| Explorer | The detail page: drill day → session → prompt with a cumulative-cost timeline; respects the global cross-filters. Reached from the "Explore →" button and from treemap tiles. |
| Optimize | The prescriptive story: an avoidable-$ headline and three cards (long-pause cache rewrites, compact-earlier lever, compaction-is-cheap reassurance). |
| Quotas |
Quota windows first (utilization gauges, trend with reset windows, countdowns — need snapshot), then the cost story: plan break-even and Cost via GitHub Copilot (AI credits: subscription + overage beyond the allowance). |
| How it works | The trust argument displayed: dedup, ccusage reconciliation, pricing-at-read-time, categorization — and the cost inputs (per-token rate grid, Claude plans, Copilot credit allowances). |
The dashboard reads config.yml from the active data directory. Create the
default with prompt-analytics config init. One section so far:
features:
categorization: true # gate the Prompts page
prompt_text: true # whether extract stored full prompt text
quota_snapshot: true # gate the Quotas pageMissing keys fall back to these defaults. A features flag set to false hides
the corresponding page; it does not delete any data.
See CLI Commands for the same data in the terminal, and Codebase Guide for how the dashboard layer is wired.