Skip to content

AI coding cost and token tracking

AtoAxis records how many tokens your coding agents consume and what that usage is estimated to cost, broken down by project and by day. Input, output and cache tokens are kept apart, prices are versioned and effective-dated, and any figure that cannot be derived from reported usage and a known price is returned as unknown rather than as zero.

What AI cost tracking measures

A coding agent bills on tokens, not on the time you spent watching it work. Duration answers “how long was this session”; token usage answers “what did this session consume”. Both are recorded here, on the same timeline, so a project can be read as time spent and as spend incurred.

The four token classes

  • Input tokens: what was sent to the model
  • Output tokens: what the model generated
  • Cache read tokens: prompt content served from cache, billed at a lower rate
  • Cache write tokens: content written into the cache, billed at a higher rate

They are stored separately because they are priced separately. Collapsing them into one number makes a cache-heavy session look identical to one that re-sent its whole context, and those two sessions do not cost the same.

3D token cubes in project trays beside a balance scale and abstract usage ledger
Concept illustrationUnderstand the usage behind the estimate.

How usage reaches your account

Usage events arrive on a dedicated endpoint that carries identifiers and counts only. There is no prompt, response, patch, file path or source-code field in the payload.

POST /api/v1/ai/usage
[
  {
    "usage_event_id": "msg_01ExampleProviderMessageId",
    "ai_session_id": "your-session-id",
    "occurred_at": "2026-08-23T04:15:00Z",
    "agent": "claude-code",
    "provider": "anthropic",
    "model": "your-model-name",
    "prompt_count": 1,
    "input_tokens": 18450,
    "output_tokens": 1220,
    "cache_read_tokens": 96300,
    "cache_write_tokens": 4100,
    "token_source": "reported"
  }
]

Events are keyed by the provider’s own message id, so replaying a transcript cannot double-count a session. Bundled hooks read this from each agent’s local transcript; you can also post it from your own wrapper.

Track Claude Code token usage and other agents

  • Claude Code, Codex CLI, Gemini CLI, Kilo Code and Kimi Code CLI have bundled hooks that read their local transcripts
  • Any other tool can post to the same endpoint directly
  • Cursor and Copilot need a provider-specific adapter before their usage can be attributed

A tool with no hook and no adapter is not reported as zero usage. It is simply absent, and the coverage figures show how much of the period that absence accounts for.

How estimated cost is calculated

Cost is derived, never guessed. Each provider and model pair has price rows with an effective window, so an event is priced with the rate that was actually in force when it happened rather than with today’s rate.

The rules that keep the number honest

  • Pricing is selected by provider and model together, never by model name alone — two providers can publish the same model label at different rates
  • Each price row carries an effective-from date and a version, so a repricing does not silently rewrite last month
  • Amounts are held in micro-USD to avoid rounding drift across millions of events
  • An unknown provider or model produces an unknown cost, not a cost of zero

The shipped catalogue covers Anthropic list prices. Usage from a provider with no price row still reports its tokens — you keep the consumption figure and lose only the money figure.

Claude Code cost per project, alongside every agent

Usage events carry the agent’s workspace context, reduced to a project name before it leaves your machine, so spend can be grouped the same way coding time is.

When an event has no explicit project

  • If every other event in that session belongs to one project, the event inherits it
  • If the session touched more than one project, the event stays unattributed rather than being copied into all of them

The second rule is why a project total can be lower than the account total. Splitting an ambiguous session across projects would make every project look more expensive than it was, and there would be no way to tell which part was invented.

Coverage instead of false precision

Attribution, tokens and estimated spend each carry their own coverage percentage, and a value that cannot be derived is returned as null with that coverage attached.

GET /api/v1/dashboard/analytics
{
  "tokens":          { "total": 1204300, "coverage_percent": 92.4 },
  "estimated_spend": { "amount_microusd": 3184500, "coverage_percent": 74.1, "currency": "USD" },
  "coverage":        { "attribution_percent": 88.0, "token_percent": 92.4, "cost_percent": 74.1 }
}

A dashboard that renders an unknown as 0 is telling you something it does not know. Reading “74% priced” tells you how far to trust the total, and a subscription plan that never exposes per-call pricing is visibly out of scope rather than quietly counted as free.

What is never collected

  • Prompts, model responses and conversation transcripts
  • Source file contents and patches
  • Absolute paths — only the final directory name is used as the project label

The usage stream is numeric and identifier-only by design. Prompt length is counted locally and only the character count is sent; the prompt text itself is discarded on your machine.

Limits worth knowing

  • Estimated cost is a list-price estimate, not an invoice, and will not match a bill that includes negotiated or subscription terms
  • A subscription plan with no per-call pricing produces tokens without a cost figure
  • Usage arrives only from agents with a hook or an adapter
  • Historical events keep the price that was effective when they happened; changing the catalogue does not restate them

What does AI cost tracking tell you, and what can it not?

It reports the tokens your coding agents consumed and their estimated cost by project and day. An estimate that cannot be derived is shown as unknown, not as zero.

A 30-second tour recorded from this website: the time-ring overview, the Human + AI split, the AI coding tracker and planned pricing.

Key takeaways

Token classes:
Input, output, cache-read and cache-write tokens are kept apart.
Pricing:
Each provider and model has effective-dated price rows.
Privacy:
Usage events carry identifiers and counts, never prompts or responses.
Coverage:
Tokens and estimated spend each report their own coverage percentage.

How should you read a project’s estimated spend?

Illustrative example, not customer data: a project shows 1,204,300 tokens with 92.4% token coverage and estimated spend with 74.1% coverage. Read the spend as a lower bound for the priced part of the period. The remaining usage has tokens but no price evidence, so it is not added as zero.

How to read coding activity metrics
SignalWhat it supportsWhat it cannot prove
Editor heartbeatsRecorded coding activityAll working time
Attributed changesReported source of changesCode quality or time saved
This comparison separates what the data supports from conclusions it cannot establish.

Recommendation

Use cost tracking to compare agents and projects over the same range, and check the priced-token coverage before quoting a total. Your data stays metadata only: prompts are counted locally and only their character count is sent.

Trade-offs to weigh

On the other hand, cost is an estimate from list prices. Subscription plans, negotiated discounts and providers without a price row are not reflected, so treat spend as a basis for comparison rather than as an invoice.

“A metric that cannot be established should say so instead of rendering as zero.”

— Jitwisut Thobut, Founder & developer, AtoAxis

Sources and review

Written and reviewed by , Founder & developer of AtoAxis. Reviewed . Product claims describe our implementation; examples are illustrative, not customer research.

84% of developers use or plan to use AI tools in development, yet 46% distrust the accuracy of AI output and 33% trust it (Stack Overflow Developer Survey 2025). Source.

AI cost and token FAQ

How do I track Claude Code token usage?

Turn on the bundled Claude Code hook, for example with AtoAxis: Set Up AI Tracking in VS Code. It reads Claude Code’s local transcript and posts input, output, cache read and cache write tokens per event, grouped by session, project and day.

How is the estimated cost of an AI coding session calculated?

Reported tokens are multiplied by the price that was in effect for that provider and model when the event happened. Prices are versioned and effective-dated, and an unknown provider or model yields an unknown cost rather than zero.

Can I see Claude Code cost per project?

Yes. Each project in the dashboard shows reported tokens and estimated spend summed across Claude Code and every other agent that reports usage, each with its coverage. The shipped catalogue has Anthropic list prices, so tokens from a provider without a price row show no cost rather than zero. A session spanning several projects stays unattributed instead of being copied into each.

Which coding agents report token usage?

Claude Code, Codex CLI, Gemini CLI, Kilo Code and Kimi Code CLI have bundled hooks. Any other tool can post to the same endpoint. Cursor and Copilot need a provider-specific adapter first.

Will the estimate match my provider invoice?

No. It is a list-price estimate from reported usage. Negotiated rates, subscription bundles and provider-side adjustments are not visible to it, which is why coverage is reported alongside every total.

Are prompts or responses stored to calculate cost?

No. The usage stream carries identifiers and numeric counts only. Prompt length is counted on your machine and the text is discarded.