If you’re using multiple models, the bill gets messy fast. The fix is to track usage at the agent and model level, then convert tokens to dollars with the actual per-1M-token prices, not vibes.
The good news is you don’t need to instrument every request by hand. You can read the logs your coding agents already keep locally, compute a 30-day cost table, and only sync daily totals if you want a dashboard.
Why multi-model spend gets hard to reason about
Claude Code, Copilot, raw API calls, and a couple of side tools can all be active in the same week. Each one may use different models, different token mixes, and different pricing rules. If you only look at a single vendor dashboard, you miss the cross-tool picture, which is usually the one you actually care about.
The core problem is that cost is not just “how many tokens did I use.” It’s also which model handled them, whether the workload was mostly input or output, and whether cached or reasoning tokens are part of the mix. That’s why a blended view matters. The AI Cost Index is useful for the macro view, but your own usage is what tells you what you’ll actually pay.
Here’s the practical mental model:
- Track usage by agent, model, and use-case.
- Convert tokens to dollars using per-1M-token prices.
- Separate actual cost from estimated cost when the provider bill is incomplete.
- Watch daily totals, not just monthly surprises.
The pricing math that actually matters
LLM pricing is always quoted per 1,000,000 tokens, so the math is straightforward once you keep the unit straight. The formula is:
(tokens / 1,000,000) × price_per_million
For models with separate input and output prices, compute each side separately. If you’re estimating from a blended basket, use the blended figure as a shortcut, but only when you’re comfortable with the approximation.
| Model or basket | Input price per 1M | Output price per 1M | What to use it for |
|---|---|---|---|
| gpt-4o | $2.5 | $10 | General-purpose OpenAI workload |
| claude-sonnet-4-5 | $3 | $15 | Higher-quality Anthropic coding and reasoning |
| gemini-2.5-flash | $0.3 | $2.5 | Low-cost, fast Google workload |
| deepseek-chat | $0.28 | $0.42 | Very low-cost chat-style usage |
| AI Cost Index Frontier basket | $4.64 blended | Macro benchmark, 3:1 input:output | |
Notice what’s missing here, a fake “per token” number. Don’t do that. A price like $0.004 per token would be off by a million. The only sane unit is per 1M tokens.
Worked example: one week of mixed model usage
Let’s say a small team ships with three different models in the same week:
- gpt-4o: 600,000 input tokens and 120,000 output tokens
- claude-sonnet-4-5: 200,000 input tokens and 80,000 output tokens
- gemini-2.5-flash: 1,000,000 input tokens and 50,000 output tokens
Now do the math model by model.
gpt-4o
Input cost: 600,000 / 1,000,000 × $2.5 = $1.50
Output cost: 120,000 / 1,000,000 × $10 = $1.20
Total: $2.70
claude-sonnet-4-5
Input cost: 200,000 / 1,000,000 × $3 = $0.60
Output cost: 80,000 / 1,000,000 × $15 = $1.20
Total: $1.80
gemini-2.5-flash
Input cost: 1,000,000 / 1,000,000 × $0.3 = $0.30
Output cost: 50,000 / 1,000,000 × $2.5 = $0.125
Total: $0.425
Weekly total: $2.70 + $1.80 + $0.425 = $4.925
That number is useful because it tells you where the money went. In this example, the expensive part is not the cheapest model’s heavy input volume. It’s the higher output rate on the more capable models. That’s the kind of detail you miss if you only stare at raw token counts.
If you want a macro benchmark for sanity checks, compare your own blended usage to the State of AI view and the current basket prices. If your internal mix is far above the frontier basket, you probably have a lot of high-output work or a model mix skewed toward premium providers.
What to compare across tools and teams
If you’re choosing between coding assistants or trying to understand why one workflow feels pricier, don’t compare just one headline number. Compare the shape of the spend.
| What to compare | Why it matters | What usually surprises people |
|---|---|---|
| Daily totals per agent | Shows which tool is actually active | One “small” agent can dominate usage |
| Input vs output tokens | Output-heavy tasks often cost more than expected | Long answers and verbose reasoning inflate spend |
| Model mix | Premium models can raise cost fast | Fallbacks and retries quietly move traffic upward |
| Success rate | Failed runs still consume tokens | Cheap failures are still expensive at scale |
For developers, the useful question is not “which model is cheapest?” It’s “which model gives me the best result for the cost of the task I’m actually trying to complete?” That’s why a value lens matters, and why the value-for-money view is more actionable than raw price alone.
How to track this without leaking your prompts
The simplest way to start is local-first. Run npx mytokentracker and it reads the usage logs coding agents already keep on your machine, then prints a 30-day cost table at API prices. Your usage data never leaves the machine in that mode.
If you want a dashboard, create a free account and run npx mytokentracker init. It asks for the API token, uploads history, and then syncs every 30 minutes. Only daily totals per agent and model are uploaded, never prompts, code, or file names. It works with Claude Code, Codex, GitHub Copilot CLI, Antigravity, OpenCode, Amp, Qwen Code and more.
For teams building their own integrations, there are drop-in wrappers for OpenAI, Anthropic, Gemini, and Mistral. In Python that’s track_openai, track_anthropic, track_google, and track_mistral. In Node it’s trackOpenAI and the equivalent helpers. Any other provider can be sent through a single POST to the events API.
That matters because you can standardize on one telemetry shape even if your stack is messy. You get cost, input/output/cache/reasoning tokens, latency, and success, broken down by provider, model, platform, and use-case. When you need the live catalog, use live prices for 4,906 models instead of hardcoding stale numbers into a spreadsheet.
FAQ
Do I need to connect every provider manually?
No. If you’re using supported coding agents, the local logs are usually enough to get started. For application code, the wrappers handle the common providers, and anything else can be posted to the events API in one place.
What’s the difference between actual cost and estimated cost?
Actual cost is what the provider bill says when it’s available. Estimated cost uses a daily-synced price catalog when the bill is incomplete or when you’re looking at local usage before reconciliation. Both are useful, but they answer slightly different questions.
Why not just watch the vendor dashboard?
Because vendor dashboards are siloed. They don’t tell you how Claude Code compares with Copilot, or how one project compares with another across multiple models. A local, cross-provider view gives you the full picture without exposing prompts or code.
If you want the simplest next step, install it and look at your own 30-day table first: track your AI spend locally.