See what your AI coding agents cost

One command reads the usage logs Claude Code, Codex and other agents already keep on your machine. Try it with no account. Sign up only if you want to track it over time.

1

See what your agents cost, right now

Run this in any terminal. It reads the usage logs your coding agents already keep on this machine and prices them at API rates. No account, and nothing leaves your machine.

npx mytokentracker

What you get (last 30 days)

  Agent         API value   Tokens   Days
  -----------   ---------   ------   ----
  Claude Code   $2,402.06    6.12B      7
  Codex            $10.67     6.9M      1

"API value" is what the same tokens would cost at pay-as-you-go API prices, not what a subscription charges you.

Is your plan worth it?

npx mytokentracker --plan 200

Compares that API value with a $200/month plan over the same days.

Look further back

npx mytokentracker --days 90

Only as far as your agents kept their logs (see the limits below).

Needs Node.js 20 or newer. Works on macOS, Linux and Windows.

2

Track it over time (with an account)

Once you have an account, one more command connects this machine. It uploads the history your agents still hold, then syncs every 30 minutes in the background, so your dashboard, plan-value receipt and weekly trends stay current.

npx mytokentracker init

It asks for your API token (from Settings after you sign in) with hidden input, so it never lands in your shell history.

Create an account

Which agents it reads

Any of these that you use on this machine, through ccusage, which reads the logs each agent writes locally:

Claude Code Codex Gemini CLI GitHub Copilot CLI OpenCode Amp Goose Qwen Kimi Droid and a few more

Not covered: editor assistants such as Cursor or Windsurf, and chat in a browser (ChatGPT, claude.ai). They do not leave usage logs on your machine.

Good to know before you start

  • History goes back only as far as your agents kept it. Claude Code deletes its logs after about 30 days by default, so that is usually all there is to import. To keep more from now on, raise cleanupPeriodDays in ~/.claude/settings.json.
  • Daily totals, synced every 30 minutes. The CLI sends one total per day, agent and model. Your dashboard shows cost by day and model, but the per-project and per-session views stay empty for this data, and it is not a live, minute-by-minute feed.
  • Windows needs one extra step. init saves your token but cannot set up the background sync. Add a Task Scheduler job that runs npx -y mytokentracker sync --quiet every 30 minutes.
  • Each machine connects separately. Run init on every computer you code on. They all add up on one dashboard.

Commands

npx mytokentracker Local report for the last 30 days. Uploads nothing.
npx mytokentracker init Connect this machine: saves your token, uploads history, sets up the 30-minute sync.
npx mytokentracker sync Upload now instead of waiting. Add --dry-run to see what would be sent.
npx mytokentracker status Show the connection, the last sync and the schedule.
npx mytokentracker uninstall Remove the schedule and the saved token. Your dashboard data stays.

Options: --days <n>, --plan <usd>, --no-schedule, --quiet. npm i -g mytokentracker adds the short alias mtt.

Tracking your own app's API calls instead? Other ways to send usage

The CLI covers coding agents. For calls your own code makes to OpenAI, Anthropic, Gemini, Mistral or any other provider, send usage directly. Each needs your API token in MTT_TOKEN.

Python

curl -O https://mytokentracker.io/mtt.py

from mtt import track_openai, track_anthropic
track_openai(resp, use_case="chat")

Node

curl -O https://mytokentracker.io/mtt.mjs

import { trackOpenAI } from "./mtt.mjs";
trackOpenAI(resp, { use_case: "chat" });

Any language (events API)

curl -X POST https://mytokentracker.io/api/v1/events \
  -H "Authorization: Bearer $MTT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"provider":"openai","model":"gpt-4o","input_tokens":1200,"output_tokens":350}'

Full reference in the API docs.