token-dashboard-claude-analytics
БесплатноБез исполняемых скриптовНе проверенLocal token cost analytics dashboard for Claude Code sessions — reads JSONL transcripts and provides per-prompt cost breakdowns, heatmaps, and usage insights.
от reason-machines★ 99 звёзд на GitHubОб этом скилле
Token Dashboard — Claude Code Analytics
Skill by ara.so — Daily 2026 Skills collection.
Token Dashboard reads the JSONL transcripts Claude Code writes to ~/.claude/projects/ and turns them into per-prompt cost analytics, tool/file heatmaps, cache analytics, project comparisons, and a rule-based tips engine. Everything runs locally — no data leaves your machine.
Installation
git clone https://github.com/nateherkai/token-dashboard.git
cd token-dashboard
python3 cli.py dashboard
No pip install. No Node.js. No build step. Requires Python 3.8+.
Windows:
git clone https://github.com/nateherkai/token-dashboard.git
cd token-dashboard
py -3 cli.py dashboard
Key CLI Commands
# Start the full dashboard UI at http://127.0.0.1:8080
python3 cli.py dashboard
# Populate/refresh the SQLite cache, then exit
python3 cli.py scan
# Print today's totals in the terminal
python3 cli.py today
# Print all-time totals in the terminal
python3 cli.py stats
# Show active optimization tips in terminal
python3 cli.py tips
# Dashboard with options
python3 cli.py dashboard --no-open # don't auto-open browser
python3 cli.py dashboard --no-scan # skip initial scan, use cached DB only
python3 cli.py dashboard --projects-dir /path/to/projects --db /path/to/cache.db
Configuration
Environment Variables
# Change port (default: 8080)
PORT=9000 python3 cli.py dashboard
# Change bind address (WARNING: keep 127.0.0.1 — 0.0.0.0 exposes data on network)
HOST=127.0.0.1 python3 cli.py dashboard
# Custom projects directory
CLAUDE_PROJECTS_DIR=/custom/path python3 cli.py dashboard
# Custom SQLite cache location
TOKEN_DASHBOARD_DB=/custom/path/cache.db python3 cli.py dashboard
Pricing Configuration
Edit pricing.json directly to update model prices or add plans:
{
"models": {
"claude-opus-4-5": {
"input": 15.00,
"output": 75.00,
"cache_write": 18.75,
"cache_read": 1.50
}
},
"plans": {
"api": { "label": "API", "multiplier": 1.0 },
"pro": { "label": "Pro ($20/mo)", "multiplier": 0.0 },
"max": { "label": "Max ($100/mo)", "multiplier": 0.0 }
}
}
Data Sources
Claude Code writes session JSONL files here:
| OS | Path |
|---|---|
| macOS / Linux | ~/.claude/projects/<project-slug>/<session-id>.jsonl |
| Windows | C:\Users\<you>\.claude\projects\<project-slug>\<session-id>.jsonl |
The dashboard only reads these files — never modifies them. It caches results in SQLite at ~/.claude/token-dashboard.db.
Dashboard Tabs
| Tab | What it shows |
|---|---|
| Overview | All-time totals, daily charts, cost by plan, top tools, recent sessions |
| Prompts | Most expensive user prompts ranked by tokens; click to see tool calls and result sizes |
| Sessions | Turn-by-turn view with per-turn tokens and tool calls |
| Projects | Per-project comparison: tokens, sessions, files touched |
| Skills | Most-invoked skills and their token costs |
| Tips | Rule-based suggestions (repeated file reads, oversized tool results, low cache-hit rate) |
| Settings | Switch between API / Pro / Max pricing plans |
API Endpoints
The dashboard exposes JSON endpoints at http://127.0.0.1:8080/api/:
# Overview stats
curl http://127.0.0.1:8080/api/overview
# Most expensive prompts
curl http://127.0.0.1:8080/api/prompts
# Session list
curl http://127.0.0.1:8080/api/sessions
# Single session detail
curl http://127.0.0.1:8080/api/sessions/<session-id>
# Project comparison
curl http://127.0.0.1:8080/api/projects
# Optimization tips
curl http://127.0.0.1:8080/api/tips
Real Code Examples
Scripting Against the SQLite Cache
After running python3 cli.py scan, query the cache directly:
import sqlite3
import os
db_path = os.path.expanduser("~/.claude/token-dashboard.db")
conn = sqlite3.connect(db_path)
# Get top 10 most expensive prompts
cursor = conn.execute("""
SELECT
project_slug,
session_id,
input_tokens,
output_tokens,
cache_read_tokens,
cost_usd,
substr(user_text, 1, 80) as prompt_preview
FROM turns
ORDER BY cost_usd DESC
LIMIT 10
""")
for row in cursor.fetchall():
print(f"${row[5]:.4f} | {row[0]} | {row[6]}")
conn.close()
Get Daily Token Totals
import sqlite3
import os
db_path = os.path.expanduser("~/.claude/token-dashboard.db")
conn = sqlite3.connect(db_path)
cursor = conn.execute("""
SELECT
date(created_at) as day,
SUM(input_tokens) as total_input,
SUM(output_tokens) as total_output,
SUM(cache_read_tokens) as total_cache_read,
SUM(cost_usd) as total_cost
FROM turns
GROUP BY date(created_at)
ORDER BY day DESC
LIMIT 30
""")
for row in cursor.fetchall():
print(f"{row[0]}: ${row[4]:.4f} ({row[1]} in, {row[2]} out, {row[3]} cached)")
conn.close()
Programmatic Scan
Установить token-dashboard-claude-analytics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл token-dashboard-claude-analytics?
Local token cost analytics dashboard for Claude Code sessions — reads JSONL transcripts and provides per-prompt cost breakdowns, heatmaps, and usage insights.
Как установить скилл token-dashboard-claude-analytics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл token-dashboard-claude-analytics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic