tokscale  by junhoyeo

CLI tool for tracking AI coding assistant token usage and costs

Created 1 month ago
332 stars

Top 82.7% on SourcePulse

GitHubView on GitHub
Project Summary

A high-performance CLI tool and visualization dashboard for tracking AI coding assistant token usage and costs across multiple platforms. It targets developers and power users seeking to understand and manage their AI-assisted development expenses, offering detailed insights, real-time pricing, and social sharing capabilities.

How It Works

Tokscale employs a native Rust core for high-performance data parsing and aggregation, achieving up to 10x speedup over TypeScript implementations. It reads local session data from various AI coding assistants, aggregates token usage (input, output, cache, reasoning), and calculates estimated costs using LiteLLM's real-time pricing data with OpenRouter fallback. The primary interface is an interactive TUI powered by OpenTUI, offering multiple views and navigation, complemented by a web-based 2D/3D contribution graph visualization.

Quick Start & Requirements

  • Primary install/run: bunx tokscale@latest
  • Prerequisites: Bun runtime is required for the interactive TUI and core functionality. A Rust toolchain is needed for building the native module from source, though pre-built binaries are included.
  • Links: Tokscale.ai (via hero image), GitHub Releases.

Highlighted Details

  • Interactive TUI with 4 views (Overview, Models, Daily, Stats) and keyboard/mouse navigation.
  • Supports multiple platforms: OpenCode, Claude Code, Codex CLI, Cursor IDE, Gemini CLI, Amp, Droid.
  • Real-time pricing lookup via LiteLLM, with OpenRouter fallback and 1-hour caching.
  • Native Rust core for ~10x faster processing and memory optimization.
  • Web visualization featuring 2D and 3D GitHub-style contribution graphs.
  • "Wrapped 2025" command generates shareable year-in-review images.
  • Social platform for leaderboards and public usage profile sharing.

Maintenance & Community

The project lists GitHub contributors and has active development signals (forks, stars, issues). Specific community channels like Discord or Slack are not detailed in the README.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: The MIT license permits commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

Some AI tools automatically delete old session files, necessitating user configuration to preserve history for accurate tracking. Cursor IDE integration requires handling a sensitive session token obtained via browser developer tools. The interactive TUI's reliance on Bun is due to its native Zig modules.

Health Check
Last Commit

18 hours ago

Responsiveness

Inactive

Pull Requests (30d)
73
Issues (30d)
32
Star History
337 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.