Tokei: The Open-Source Tool That Makes AI Coding Costs Visible in Your Menu Bar
June 9, 2026 · 6 min read
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/output | Token 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 |
|---|---|---|---|---|
| Tokei | Yes | Local only | Yes | Install and forget |
| Anthropic dashboard | ~5min delay | Cloud | Anthropic only | Manual check |
| OpenRouter usage page | ~1min delay | Cloud | OpenRouter only | Manual check |
| Manual spreadsheet | No | Local | Yes | High |
| Monthly bill review | No | Cloud | Per-provider | Low 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?
Related Articles
MiniMax M3 Released: Open-Source Model Beats GPT-5.5 on Coding at 1/20 the Inference Cost
MiniMax M3 launched today with 59% on SWE-Bench Pro, surpassing GPT-5.5 and Gemini 3.1 Pro. Its MSA sparse attention architecture cuts per-token compute to 1/20 of previous generation. Open weights included.
AI Model Context Protocol (MCP): Hidden Token Costs of Tool Calls
MCP enables AI coding agents to call external tools, but each tool adds thousands of tokens to every request. We quantify the overhead and show how to minimize hidden costs from tool descriptions, function formatting, and response parsing.
AI Coding Cost Tracking Tools Compared: Tokei vs Manual Logging vs API Dashboards
Compare three approaches to tracking AI coding spend: Tokei automated tracking, manual spreadsheet logging, and provider API dashboards. Find the right method for your team size and budget.