Token Tracker
Token Tracker
v1.8
Architecture & Design Principles

About Token Tracker

A local-first telemetry workstation engineered to give developers granular, project-level visibility into AI spending across agentic IDEs and CLI tools.

Local-First & Privacy-Preserving

No accounts • No remote servers • No cloud telemetry

Your source code, prompt contents, and file paths represent critical intellectual property. Token Tracker was designed from day one with a strict zero-cloud architecture:

  • 100% Local Processing: Ingestion parsers, cost calculators, and SQLite storage run entirely on your local CPU.
  • Zero Telemetry Transmitted: The application does not contain remote tracking libraries, analytics SDKs, or external logging endpoints.
  • Offline Operational: Functions completely without internet connectivity. Perfect for air-gapped enterprise environments.
Technical Pipeline

How Token Tracker Works

Automated ingestion flow from local disk files to interactive dashboard without modifying your developer environment.

PIPELINE 01
File System Event Observers
Chokidar and low-overhead OS file watchers monitor known tool directories (%USERPROFILE%\.claude, AppData\Cursor, .gemini\antigravity, etc.) for write activity.
PIPELINE 02
Incremental Streaming Parsing
Parsers read new entries via byte-offset cursors, avoiding re-reading entire gigabyte-scale JSONL log files or locking active SQLite WAL databases.
PIPELINE 03
Local SQLite Aggregation
Records are ingested into a local SQLite database (%APPDATA%\token_tracker\database.sqlite) with indexed project tags and denormalized daily summaries.
PIPELINE 04
Reactive Desktop UI & Budget Alerts
Electron IPC events broadcast data updates to the React interface, while the background budget engine checks thresholds and sends native OS notifications.
Data Integrity

Exact vs. Estimated Provenance

Different coding assistants persist session data in different formats. Token Tracker explicitly categorizes all records into three clear provenance tiers:

Exact Provider Usage
Exact
Applies to: Claude Code, Antigravity, Cline, Direct APIs

Extracted directly from API response usage blocks (input_tokens, output_tokens, cache_read_input_tokens, cache_creation_input_tokens). 100% precision with exact provider invoice parity.

Local BPE Calculation
Estimated
Applies to: Cursor Chat, Windsurf Cascades, Raw Markdown

When an IDE only persists conversation text without token usage metadata, Token Tracker runs local BPE tokenizers (js-tiktoken using cl100k_base or o200k_base encodings) to compute accurate estimates entirely offline.

Loopback Proxy Interception
Captured
Applies to: Custom inference routing, Local proxy

Captured in real-time by routing developer tools through a lightweight local loopback proxy (127.0.0.1) that snoops response stream trailers without modifying or delaying request payloads.

Get Started with Token Tracker

Install the desktop app and inspect your local session logs in under two minutes.