Open source command-line tool. MIT licensed.

Where your Claude Code money goes, and what’s worth changing.

A command-line tool that reads your Claude Code history, or your team’s Grafana or Datadog telemetry, prices every token with the prompt cache counted, and prints a plain report: where the money went, which changes are worth making, and what the data cannot tell you.

uvx mycroftcompute

Runs on your machine and uploads nothing. Python 3.12 or later, no dependencies.

Works with
  • Claude Code history
  • Grafana Cloud
  • Datadog
Sample team / Reports / 1 to 28 Aug 2026 Sample

Anthropic usage, 1 to 28 August 2026

$15,365.62at list prices

24 developers4 findings

By model

  • claude-opus-5$13,398.84
  • claude-sonnet-5$1,966.78

By request kind

  • main$11,631.10
  • subagent$1,966.78
  • auxiliary housekeeping$1,767.74

By developer

Four findings. The largest ceiling is at most $5,884.62 over the month. Read the findings

01What a report finds

Four findings on a $15,365.62 month.

Each dollar figure is the most a change could be worth, never a promise. The ceilings overlap, so they are never added up. Every finding ends with what your data cannot tell you.

Sample team / 1 to 28 Aug 2026 / Findings Sample
  1. 139.5% of agent spend went to three developersAttribution, not a lever
  2. 211.5% of spend is the agent’s own housekeeping, on claude-opus-5At most $942.80
  3. 3Moving claude-opus-5 to claude-haiku-4-5 would pay off, but not immediatelyAt most $5,884.62
  4. 426.6% of your bill went on writing the prompt cacheAt most $3,764.64
2

11.5% of spend is the agent’s own housekeeping, on claude-opus-5

Fastest to act on: one settings change
  • $1,767.74 of $15,365.62, 11.5%, went to requests the agent raised for itself or marked as needing low effort.
  • No cache on claude-opus-5 for this traffic, so moving it to claude-haiku-4-5 costs nothing to switch.
At most $942.80over this period. A ceiling, not a saving.

NextCheck what model your agent uses for auxiliary and low-effort requests. If it is claude-opus-5, point it at claude-haiku-4-5 and leave the main path alone.

What your metrics backend cannot tell youWhether your agent lets you choose a model for this traffic separately from the main one.

1

39.5% of agent spend went to three developers

  • 24 developers ran agents in this period, for $15,365.62 in total. The top three account for $6,071.90, 39.5% of everything.

The vertical line is the team median, $464.69.

Attribution, not a leverThis finding says where the money went, not that it went somewhere wrong.

NextAsk [email protected] what they have been running agents on. The useful outcome is usually a technique worth spreading rather than a habit worth stopping.

What your metrics backend cannot tell youWhether any of this is a problem. Spend follows work, and the most expensive developer on a team is frequently the most productive one.

3

Moving claude-opus-5 to claude-haiku-4-5 would pay off, but not immediately

  • claude-opus-5 is 87.2% of spend, $13,398.84.
  • Once each session’s cache is warm on claude-haiku-4-5, the same tokens would cost $5,884.62 less over this period. The first request of every session that moves pays to write its cache again, and daily totals do not count sessions, so that cost is not subtracted here.
At most $5,884.62over this period. A ceiling, not a saving.

NextTry the cheaper model in one repository for a week before changing anything broadly. Routing at session boundaries preserves the cache; switching mid-session destroys it and costs more than it saves.

What your metrics backend cannot tell youWhether the cheaper model would do the work. This compares what the same tokens would cost; it is not a judgement about output quality.

4

26.6% of your bill went on writing the prompt cache

  • 811,852,800 tokens were written to the prompt cache, costing $4,092.00 at the five-minute write rate. At the one-hour rate the same writes would cost $6,547.20.
  • 15,713,280,000 tokens were read back from cache, about 19.4 reads for every token written.
At most $3,764.64over this period. A ceiling, not a saving.

NextLook for what rewrites a warm prefix: sessions restarted or cleared often, tools or MCP servers that change mid-session, model switches inside a session, and long pauses.

What your metrics backend cannot tell youHow many of these writes were a warm prefix written again and how many were new context that had to be written once. Only the first kind can be avoided.

Prices checked against each vendor’s own pricing page on 24 Sep 2026. Did not run: repository concentration. Claude Code does not emit a repository label.

Sample report for an invented team. The arithmetic is real.

02The prompt cache

On Claude Code, the cache money is in the writes.

The cache already works, so “turn caching on” is not the saving. Writing it is what costs: every write is billed above list price, 1.25x for five minutes and 2x for an hour.

On the author’s own Claude Code usage

40.7%

of the bill went on writing the cache, at the five-minute rate, while about 96% of input was read from cache.

One developer over two days, read live from Grafana Cloud, 24 and 25 September 2026.

In the sample team

26.6%

of the bill: $4,092.00 at the five-minute rate, $6,547.20 at the one-hour rate.

Finding 4 above, at most $3,764.64 over the month.

A warm cache gets rewritten by new sessionscompactionsmodel switchestools or MCP servers changing mid-sessionlong pauses

Mycroft shows what share of your bill went on writing the cache, and the most that fewer rewrites could be worth.

The cheaper model isn’t always cheaper.

A model switch is one of those rewrites. On a typical agent step the cheaper model costs 3.9x more on the first request, pays back by the sixth, and is 9.4x worse if you keep switching. Every router and dashboard compares list prices; Mycroft counts the cache before it suggests any model change.

Moving a coding agent from Sonnet 4.6 to Haiku 4.5Cumulative input cost, requests after the switch

Cumulative input cost over ten requests after a model switch Staying on Sonnet 4.6 costs $0.045 per request. Switching to Haiku 4.5 costs $0.177 on the first request, 3.9 times more, then $0.015 per request, so it pulls ahead on request 6 and reaches $0.313 by request 10 against $0.453 for staying. Alternating costs $0.426 every request and reaches $4.260 by request 10, far off this scale.

Switching is ahead by $0.019. It overtook staying on request 6.

One coding-agent step at list prices: about 141,000 cached prompt tokens and 1,000 fresh ones, from published coding-agent workload research. Five-minute cache.
Free, two minutes

What share of your bill went on writing the cache?

One query, run in your own Grafana or Datadog, with nothing to install. It prices every token the way mycroftcompute does, so the answer is a share of dollars, not of tokens.

On the author’s own Claude Code usage it reads 37% at the five-minute rate and 48% at the one-hour rate, over 14 days. Cache writes are 3% of those tokens.

What the number means, and what it could be worth: docs/cache-check.md

Grafana / Explore / Code / Instant
100 *
sum(
  sum by (model) (last_over_time(claude_code_cost_usage_USD_total[14d]))
  *
  (
    1.25 * sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="cacheCreation"}[14d]))
    /
    (
        sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="input"}[14d]))
      + 1.25 * sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="cacheCreation"}[14d]))
      + 5 * sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="output"}[14d]))
      + (
            0.05 * sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="cacheRead", model=~".*claude-opus-5-5.*"}[14d]))
         or 0.025 * sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="cacheRead", model=~".*claude-fable-5-1.*"}[14d]))
         or 0.1 * sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="cacheRead"}[14d]))
        )
    )
  )
)
/
sum(
  sum by (model) (last_over_time(claude_code_cost_usage_USD_total[14d]))
  and on (model)
  sum by (model) (last_over_time(claude_code_token_usage_tokens_total{type="cacheCreation"}[14d]))
)

The result is a percentage at the five-minute write rate. For the one-hour rate, change both 1.25 to 2. Claude Code writes mostly at the one-hour rate, so the true share is between the two.

On Datadog instead
  1. New dashboard, then a Query Value widget, time frame Past 2 Weeks.
  2. Four queries on claude_code.token.usage, each sum, as count, Take the sum: a type:cachecreation, b type:input, c type:cacheread, d type:output.
  3. Hide them and add this formula:

100 * 1.25 * a / (b + 1.25 * a + 0.1 * c + 5 * d)

Mostly on Claude Opus 5.5? Change 0.1 to 0.05 (Fable 5.1: 0.025). For the one-hour rate, change both 1.25 to 2.

Everybody in this market collects and displays. Mycroft judges.

Named after Mycroft Holmes, Sherlock’s cleverer brother, who never gathered the evidence himself. He worked out what it meant.

03The command

No dashboard. A report, in your terminal.

No chart walls and no live tiles: one plain report, and a few flags around it. Run it on your own history in seconds, or point it at a team’s Grafana or Datadog.

  1. 1mycroftcompute

    Your own Claude Code history, read where it lies. Nothing is uploaded.

  2. 2--discover

    For a team backend: the labels its telemetry carries, before any usage is read.

  3. 3The report

    Where the money went, then the findings. Shown above.

  4. 4--db history.db

    The next run opens with what moved since last time.

  5. 5--sample

    An invented 24-developer team, to see the report before running it on your own.

Seconds after pointing it at a backend. A gap becomes a stated limit, not a silent error.
Equal windows, compared. It never calls a shorter month a saving.

Sample report for an invented team. The arithmetic is real.

04What it reads

It reads daily totals. Nothing it could change.

Checked end to end against real Claude Code data, locally and on both backends, in September 2026.

Reads Locally, or read-only from a backend

  • Your own Claude Code session files in ~/.claude/projects, on your machine. Only each message’s token counts, model, date and project are kept.
  • Or a team backend, as daily totals: token counts by model and type, and the labels user.email, query_source, effort.
  • The backend’s own cost figure, to reconcile against.
Grafana Cloud, or any Prometheus-compatible backend

Cloud Access Policy token, metrics:read on one stack. Live-verified, Sep 2026.

Datadog, every site

API key plus an Application key, metrics_read and timeseries_query. Live-verified, Sep 2026.

Never Not sent, not stored

  • Sends anything anywhere. No account, no telemetry, and no network calls except to a backend you name.
  • Stores or prints prompts, responses or code. From a backend it never reads them, or logs and traces.
  • Changes anything.

Stored only if you ask: --db keeps daily totals and findings in a local file, so the next run can compare.

Reconciles against your backend’s own number. Where they differ, the report says why. Usually it is one-hour cache writes, which the metrics do not label.

  • 19models priced, from Anthropic, OpenAI and Google, with cache multipliers and minimums
  • 31daysafter the last price check, the report flags its prices as old
  • 0dependencies: Python’s standard library only
  • 0bytes uploaded, from your machine or your backend

05Install

One command. Nothing to sign up for.

Run it once with uvx, or keep it installed with pipx. Python 3.12 or later; no dependencies.

uvx mycroftcompute

pipx install mycroftcompute

A personal project. MIT licensed. It began as the engine of a product for platform teams and is kept as a tool. Prices are checked by hand, and the report says when they have aged.

Reading a team’s backend

  1. Send Claude Code’s telemetry.A few settings, deployable to the whole team through Claude Code’s managed settings. Grafana needs cumulative counters; Datadog drops them.
  2. Create one read-only credential.Grafana: metrics:read on one stack. Datadog: metrics_read and timeseries_query.
  3. Run --discover.What the telemetry can and cannot support, before any usage is read.
  4. Read two weeks.--days 14 --db team.db, and run it again next month for what moved.
  5. Step by step.docs/team-backends.md, including the two settings that silently lose every number.

06Questions

Questions.

What exactly does it read?

Locally, Claude Code’s own session files in ~/.claude/projects (or $CLAUDE_CONFIG_DIR/projects). It keeps each message’s token counts, model, date and project, and nothing else. From a team backend, daily totals of claude_code.token.usage and claude_code.cost.usage with their labels for model, token type, developer, request kind and effort. It never stores or prints prompts, responses or code.

Does anything leave my machine?

No. There is no account and no telemetry. Run on your own history, it makes no network calls at all; pointed at a backend, it only queries that backend, read-only, with a credential you create and can revoke.

Do I need Grafana or Datadog?

No. With no arguments it reads your own Claude Code history. The backends are for teams that already collect telemetry and want the report across everyone. docs/team-backends.md covers setting one up, including the traps: Grafana needs cumulative counters and silently gets nothing without them; Datadog silently drops them.

Why is every figure “at most”, and why not add them up?

Usage data cannot know everything about how your agent runs, so each dollar figure is the most a change could be worth over the period: a ceiling, never a promised saving.

The ceilings also overlap. In the sample, the housekeeping traffic is inside the claude-opus-5 total that the model-switch finding prices, so a sum would count it twice.

How are the prices kept right?

The table covers 19 models from Anthropic, OpenAI and Google, with cache read and write multipliers, per-model cache minimums and long-context surcharges, checked by hand against each vendor’s own pricing page. It is a personal project, so the table will age between updates; once it is more than 31 days old, the report says so beside the date. List prices only: negotiated or batch rates are lower.

Does it cover Codex, Cursor or Copilot?

Claude Code only. The price table already includes OpenAI and Google models, and the backend readers understand the OpenTelemetry standard for model usage, but only Claude Code has been checked against real data.