Image: GitHub
Why it mattersA team paying for Claude Code or Codex can see where each dollar on a turn went. The fix for a 40k-token prompt is a config change.
Every usage tool for Claude Code and Codex reads the local log after a turn ends. That gives you the total cost of a session. It does not tell you which part of the prompt used which tokens. The team at Tigerless Labs released cost-xray to answer that lower question. It reached rank 7 on Trendshift's daily list on 24 October. The repository has 6,320 stars and 384 forks. The licence is MIT. The project was created in June 2026.
What it captures that logs cannot
cost-xray runs a local proxy and reads the real request each agent sends. The README says the system prompt, tool schemas, MCP server blocks and cache blocks never reach the local transcript. The team says these can be about half the context on a real request. The proxy decodes the request and attributes tokens and dollars back to each part. It does this at the level of a single tool call.
How it sees Claude Code and Codex
The README says Claude Code is captured through a reverse proxy and a base-URL override. No local certificate is added. Codex uses a forward proxy with a local certificate authority. The authority is trusted only by the codex command. The proxy binds to a local address and sends no telemetry. API keys and secret-looking fields are redacted before anything is written to disk. The dashboard runs in the terminal. It groups data by agent, project, session, MCP server, tool and call. It also shows cache-read, cache-write, fresh and output dollars for each.
Why the Claude split is an estimate
Claude's tokenizer is private and no open-source copy exists. The README says cost-xray sizes each part with tiktoken. It then applies fixed corrections to thinking blocks and tool schemas. The corrections are pinned against Anthropic's own token-count API when the user is logged in. The rest is scaled so the total matches the provider's own usage number. The total cost is exact. The split between sources inside one request is an estimate.
What a team can decide with the data
A team can see which MCP server adds a 40k-token schema block to every turn. If no tool from it is ever called, that server can be removed from the config. A team can see cache-read dollars dwarf fresh input, which means the stable prefix is working. The README lists six signals of this kind, each paired with the action to take. A small team on a paid Claude Code or Codex plan can read the bill before the next renewal. The dollar total stays honest. The per-source share is a guide, not a legal document.
Source
This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.
Get AI News in your inbox
New developer tools, model and agent releases, and how teams are actually using them to release software. Short, and only when there is something worth reading.
