Tutorials illustration

Tutorials

How to track AI spend across Claude, GPT, and Gemini

Track real AI spend across Claude, GPT, and Gemini, with token math, model comparisons, and a practical setup that doesn’t leak code.

November 1, 2026 · 6 min read · By MyTokenTracker

Back to Blog

If you’re using more than one model, the bill gets fuzzy fast. The fix is simple: track tokens, convert them at per-1M-token prices, and compare cost by provider, model, and task instead of guessing from invoices.

The annoying part is that each tool reports usage differently. The useful part is that you can normalize all of it into one cost view, then ask better questions like, “Which agent burned tokens on this feature?” and “Did the cheaper model actually save money?”

Why multi-provider AI spend gets hard to see

Claude Code, GPT-based tools, Gemini-based tools, and raw API calls all produce usage in different shapes. One dashboard may show messages, another shows requests, another shows tokens, and some tools hide the whole thing behind a subscription. If you’re shipping real work, that’s not enough detail.

The core problem is that the same task can look cheap in one place and expensive in another. A model with low input pricing can still get pricey if it emits long answers, retries often, or sits inside a workflow that keeps rebuilding context. That’s why a single “AI spend” number is mostly useless unless you can break it down by provider, model, platform, and use-case.

This is also why the AI Cost Index matters. It gives you a common yardstick for comparing model families without getting lost in plan names or UI labels. For broader pricing context, the live model price list is the place to check current per-1M-token rates.

The only math that matters: per 1M tokens

LLM prices are quoted per 1,000,000 tokens, so the formula is straightforward:

cost = (input_tokens / 1,000,000) * input_price_per_1M + (output_tokens / 1,000,000) * output_price_per_1M

That means you should ignore per-request vibes and do the arithmetic directly. Here’s a worked example using only real figures.

Suppose a workflow uses gpt-4o-mini with 900,000 input tokens and 100,000 output tokens. The prices are $0.15 input per 1M tokens and $0.6 output per 1M tokens.

Input cost  = 900,000 / 1,000,000 * $0.15 = $0.135
Output cost = 100,000 / 1,000,000 * $0.6  = $0.06
Total       = $0.195

Now compare that with gpt-4o for the same token mix, at $2.5 input per 1M and $10 output per 1M:

Input cost  = 900,000 / 1,000,000 * $2.5 = $2.25
Output cost = 100,000 / 1,000,000 * $10  = $1.00
Total       = $3.25

Same token volume, very different bill. That’s why token normalization is the only sane way to compare tools.

How the current pricing landscape looks

For quick orientation, here’s a small comparison using only the figures we know are current.

Model or basketInput price per 1MOutput price per 1MNotes
AI Cost Index, Frontier basket$4.64 blended, 3:1 input:outputNormalized frontier benchmark
AI Cost Index, Budget basket$0.74 blended, 3:1 input:outputNormalized budget benchmark
claude-3-5-haiku$0.8$4Anthropic
claude-sonnet-4-5$3$15Anthropic
claude-opus-4-1$15$75Anthropic
deepseek-chat$0.28$0.42DeepSeek
gemini-2.5-flash$0.3$2.5Google
gemini-2.5-pro$1.25$10Google
gpt-4o-mini$0.15$0.6OpenAI
gpt-4o$2.5$10OpenAI

A few practical takeaways jump out. First, output is often the expensive side of the bill. Second, the cheapest input rate does not automatically mean the cheapest workflow, because output-heavy tasks can reverse the ranking. Third, blended baskets are useful when you want a quick benchmark, but actual usage still depends on your prompt shape.

If you want a broader market lens, the State of AI page is a good companion to pricing data, because it helps you separate model hype from actual usage economics.

What to track if you want the real answer

The right tracking setup should answer four questions without making you export spreadsheets every week:

  • How many input, output, cache, and reasoning tokens did each agent use?
  • Which provider and model handled the work?
  • How much did it cost, actual or estimated?
  • Did the run succeed, and how long did it take?

Those dimensions matter because “AI spend” is not just a dollar number. A model that is cheap per token but fails often can cost more in retries, latency, and developer time than a more expensive model that gets the job done cleanly.

This is also where use-case labels help. If you can separate “code generation”, “debugging”, “planning”, and “refactor” traffic, you’ll quickly see which workflows are token hogs. That makes it much easier to decide whether to switch models, tighten prompts, or split a task into smaller steps.

How to track this without leaking your code

If you want a fast start, run npx mytokentracker. It reads the usage logs coding agents already keep locally, prints a 30-day cost table at API prices, and keeps usage data on your machine. No account is needed for that local view.

If you want a synced dashboard, create a free account and run npx mytokentracker init. It asks for the API token, uploads history, then syncs every 30 minutes. It works with Claude Code, Codex, GitHub Copilot CLI, Antigravity, OpenCode, Amp, Qwen Code, and more. Only daily totals per agent and model are uploaded, never prompts, code, or file names.

There are also drop-in wrappers for direct API work. In Python, use track_openai, track_anthropic, track_google, and track_mistral. In Node, the equivalents are trackOpenAI and friends. If you use some other provider, a single POST to the events API is enough to send usage.

The point is not just to log spend, it’s to make cost visible at the same level as latency and success. When you can see all three together, it becomes obvious which workflows need optimization and which are already fine.

What good tracking changes in practice

Once you have normalized tracking, a few things usually happen fast:

  • You stop arguing about “which model is cheaper” in the abstract and start comparing actual runs.
  • You notice where output tokens are doing the damage, especially in verbose assistants.
  • You catch retries, failed tool calls, and long context rebuilds that were invisible before.
  • You can set budgets per project or use-case instead of one giant AI line item.

That last point is the one most developers want, even if they don’t say it out loud. A side project, a production agent, and a weekend vibe coding session should not share the same cost bucket. They have different economics, different failure modes, and different tolerance for expensive answers.

For teams that care about the economics of model choice, the public value-for-money view is a useful way to think about cost versus output quality without reducing everything to raw price.

FAQ

Do I need an account just to see my local AI spend?

No. npx mytokentracker reads local usage logs and prints a 30-day cost table at API prices on your machine. Your usage data stays local unless you choose to sync.

What exactly gets uploaded if I sync?

Only daily totals per agent and model are uploaded. Prompts, code, and file names are not uploaded.

Can I track providers outside Claude, OpenAI, Google, and Mistral?

Yes. If a provider is not covered by the wrappers, you can send events with a single POST to the events API and still keep the same cost view.

If you want the full install and sync flow, start with the install guide.