token-dashboard  by nateherkai

Analyze Claude Code token usage and costs locally

Created 6 days ago

New!

271 stars

Top 94.9% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a local dashboard for analyzing Claude Code's token usage and costs. It transforms raw JSONL transcripts into detailed analytics, including per-prompt costs, tool/file heatmaps, and session insights. Designed for Claude Code users, it offers a privacy-first, local-only solution to understand and optimize AI interaction expenses without sending any data externally.

How It Works

The dashboard scans Claude Code's session transcripts stored locally. It processes these logs using Python's standard library, maintaining a local SQLite cache. A built-in HTTP server then serves this data to a frontend built with vanilla JavaScript and ECharts, enabling live updates via server-sent events. This architecture prioritizes privacy and avoids external dependencies or complex build processes, offering a self-contained analytics solution.

Quick Start & Requirements

  • Install/Run: Clone the repository, navigate to the directory, and run python3 cli.py dashboard.
  • Prerequisites: Python 3.8+, Claude Code installed and used at least once, and a modern web browser. No pip install or Node.js is required.
  • Links: GitHub Repository (implied), Contributing Guide, Known Limitations.
  • Setup: Initial scan may take 20-60 seconds on heavily used machines.

Highlighted Details

  • Privacy-Centric: All processing and data storage are strictly local; no telemetry or external API calls are made for user data.
  • Comprehensive Analytics: Offers insights into prompt costs, tool/file usage, cache effectiveness, project comparisons, and provides a rule-based tips engine for optimization.
  • Real-time Updates: The dashboard refreshes automatically every 30 seconds using server-sent events.
  • Accurate Costing: Deduplicates streamed responses to align with actual API billing, providing more realistic cost figures than simple row summation.

Maintenance & Community

The repository includes a CONTRIBUTING.md file outlining development guidelines. No specific details regarding maintainers, sponsorships, or community channels (like Discord/Slack) are provided in the README.

Licensing & Compatibility

The project is released under the MIT license, which generally permits commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

Users should consult docs/KNOWN_LIMITATIONS.md for specific caveats, particularly regarding the "Skills" tab. Running multiple instances concurrently can lead to SQLite database conflicts. The accuracy note highlights potential discrepancies if compared to tools that sum every raw log entry rather than deduping API messages.

Health Check
Last Commit

5 days ago

Responsiveness

Inactive

Pull Requests (30d)
5
Issues (30d)
3
Star History
271 stars in the last 6 days

Explore Similar Projects

Feedback? Help us improve.