DEV Community

Henry Godnick
Henry Godnick

Posted on

Tracking Token Spend Across Claude Code, Codex CLI and Cursor on One Mac

One tool was manageable. Three is how solo developers lose the plot: Claude Code for agentic refactors, Codex CLI for quick terminal tasks, Cursor for inline edits—each with its own meter, plan, or API key. The Mac becomes a bundle of progress bars you never look at until something rate-limits mid-flow.

You do not need a finance department. You need one glanceable total and a weekly habit.

Inventory what you actually run

Make a three-line list (honest beats complete):

Claude Code — seat / API — heavy agent sessions
Codex CLI  — API key     — terminal one-shots
Cursor     — sub         — tab complete + chat
Enter fullscreen mode Exit fullscreen mode

Add anything else that burns tokens on the same machine (ChatGPT desktop, local proxies, CI that uses your key). If it can surprise you, it belongs on the list. Revisit the inventory when you install a new AI CLI—most cost leaks start as "just testing."

One visible surface beats three dashboards

Cloud dashboards are accurate and ignored. While you are in a coding trance, only something in the menu bar or a status line gets seen.

Options people actually stick with:

  • A menu bar usage app that understands multiple AI CLIs.
  • Shell prompts that show the active key or project (helps attribution, not totals).
  • A Friday export into a single CSV or note.

Ideal combo: live glance plus Friday number. If you only keep one, keep the live glance; it changes behavior the same day.

TokenBar is aimed at that menu-bar glance for Claude, Codex, and related usage on macOS ($15 lifetime; built on the MIT-licensed open-source CodexBar). Disclosure: I built TokenBar. Pair it with whatever Cursor's account page shows so you do not double-count or miss the IDE side.

Attribute by project, not by vibes

When two client folders and a side project share a machine:

  1. Use different API keys or at least different env files per client.
  2. Name git worktrees and terminal tabs with a project prefix.
  3. Once a day, peek at which tool burned the most—not every token, just the winner.

If everything shares one key, you can still approximate with time blocks ("morning = client A") but do not pretend it is accounting. For invoices, approximation without a written method becomes an argument.

A 10-minute Monday setup

# Per-project env (example)
cd ~/work/client-a && echo 'export ANTHROPIC_API_KEY=...' >> .envrc
cd ~/work/personal && echo 'export ANTHROPIC_API_KEY=...' >> .envrc

# Confirm which tools are installed
which claude codex cursor 2>/dev/null
Enter fullscreen mode Exit fullscreen mode

Pin TokenBar (or your meter) on the menu bar. Disable duplicate meters that you never check—noise trains you to ignore all of them. Put the Friday review on the calendar so it survives busy weeks.

Weekly review questions

Every Friday, five minutes:

  1. Which tool took most of the spend?
  2. Did any session look like a loop or stuck retry?
  3. Did personal and billable work share a key by mistake?
  4. Any limit hit that blocked shipping?

Write three lines in a ai-spend.md note. Patterns show up by week three. If the same spike repeats, fix the workflow (context size, hooks, concurrency) before you change plans again.

Failure modes

  • Watching Cursor but ignoring CLI agents — agents often dominate cost.
  • Resetting keys without labeling them — last month's CSV becomes fiction.
  • Optimizing price before measuring — switch plans only after two quiet weeks of numbers.
  • Three overlapping meters — pick one primary glance and demote the rest.

One Mac can run three AI coding tools without financial fog. Put spend where your eyes already go, separate keys when money matters, and keep a tiny Friday ritual. That is the whole system.

How the three tools usually split spend

Patterns many solo Mac setups see after a few weeks of honest logging:

  • Cursor — steady, relatively predictable; the subscription hides per-token noise, so the risk is complacency, not surprise invoices.
  • Codex CLI — often cheap per task; cost creeps when you script loops or paste huge logs.
  • Claude Code — can dominate the week whenever you leave a long agent unsupervised or reload giant contexts.

Your mix will differ. The point of cross-tool tracking is noticing when the mix changes—for example, a week where Codex suddenly rivals Claude because a new script is polling. Without one glance surface, that shift shows up only as a vague feeling that "AI got expensive."

Alerting without noise

You do not need real-time pages. You need:

  • A visual cue when today's burn is unusually high (menu bar color or a number you recognize).
  • A hard cap on API keys used for experiments.
  • A personal rule: no new agent session after you have already hit a limit once that day—go outside or write the PR by hand.

Automation that emails you every $1 is worse than no automation. Prefer thresholds you will actually respect.

Top comments (0)