AI Cost Estimator

Estimate your AI coding costs

← Back to Blog

Tokei: The Open-Source Tool That Makes AI Coding Costs Visible in Your Menu Bar

June 9, 2026 · 6 min read

Computer monitor displaying analytics dashboard with charts and metrics

The Problem: You Don't Know What You're Spending

Most developers using AI coding tools have no idea what they spend per session. Subscription tools like Cursor hide usage behind flat fees. API-based tools like Claude Code or Aider show token counts in logs, but nobody reads logs mid-flow. The result: developers hit billing surprises at month-end, or worse, develop unconscious habits that waste tokens — pasting entire files as context, running agents in loops without constraints, or using frontier models for tasks where Haiku at $0.80/$4 per MTok would suffice.

Tokei solves this by putting your running cost total directly in your macOS menu bar. No browser tabs, no dashboards, no context switching. Just a number that updates in real-time as you code.

How Tokei Works

Tokei's architecture is deliberately minimal. It reads local log files that AI coding tools already generate — no API keys needed, no network calls made. Your usage data never leaves your machine.

Supported tool Log source Data extracted
Claude Code~/.claude/logs/Input/output tokens, model, cache hits
Grok CLI~/.grok/usage/Token counts, model variant
Aider.aider.history / .aider.input/outputToken counts per model
OpenCode~/.opencode/logs/Request/response tokens

Tokei watches these files via filesystem events (FSEvents on macOS), parses new entries, multiplies by the model's pricing, and updates the menu bar. CPU usage is negligible because it only activates on file changes.

Why Visibility Changes Behavior

Research on energy consumption shows that real-time feedback reduces usage by 5–15% without any conscious effort. The same principle applies to token spending. When developers see "$2.40 today" ticking up in their menu bar, they naturally:

  • Think twice before pasting a 5,000-line file as context
  • Switch to cheaper models for simple tasks (Haiku for formatting, Sonnet 4.6 for routine code)
  • Notice when an agent enters a retry loop and intervene earlier
  • Set mental daily budgets ("I'll stay under $10 today")

One beta tester reported a 30% reduction in monthly Claude Code spend simply from having Tokei visible. They didn't change their workflow — they just became aware of which habits were expensive.

Comparison: Tokei vs. Other Cost Tracking Methods

Method Real-time Privacy Multi-tool Effort
TokeiYesLocal onlyYesInstall and forget
Anthropic dashboard~5min delayCloudAnthropic onlyManual check
OpenRouter usage page~1min delayCloudOpenRouter onlyManual check
Manual spreadsheetNoLocalYesHigh
Monthly bill reviewNoCloudPer-providerLow but reactive

Setup: Under Two Minutes

Tokei is distributed as a Homebrew cask for macOS. Installation is straightforward:

1. Install via Homebrew: brew install --cask tokei-monitor

2. Launch Tokei from Applications. It appears in your menu bar immediately.

3. Configure pricing in the dropdown. Default prices match current API rates: Claude Opus 4.8 at $5/$25, Sonnet 4.6 at $3/$15, GPT-5.5 at $3/$15.

No API keys, no accounts, no configuration files. It auto-detects which tools you use based on log file presence.

Privacy Architecture

Tokei makes zero network calls. The binary is fully self-contained. It reads local files, computes costs locally, and displays them locally. No telemetry, no analytics, no update pings. You can verify this by running it with Little Snitch or checking its network entitlements — it requests none.

This matters because AI coding logs contain your actual code context, file paths, and prompts. Sending this data anywhere — even anonymized — creates unnecessary risk. Tokei's design makes this concern irrelevant.

Limitations and What's Coming

  • macOS only currently — Linux support is in development
  • No subscription tool tracking — Cursor and Copilot don't expose token-level usage in local logs
  • Pricing updates are manual — you need to update rates when providers change pricing
  • No team aggregation — it's a personal tool, not an admin dashboard

The roadmap includes daily/weekly trend charts, per-project cost attribution (based on working directory when tokens were consumed), and configurable alerts when daily spend exceeds a threshold. All computed locally.

Who Should Use This

Tokei is most valuable for developers who use API-billed tools (Claude Code, Aider, OpenCode) and want passive cost awareness without changing their workflow. If you're on a flat-rate subscription and never exceed limits, the value is lower. But if you've ever been surprised by a $200+ monthly API bill, a persistent menu bar number would have caught that pattern in the first week.

Want to calculate exact costs for your project?