Most usage tools read local logs. That shows the total cost of a call or session, but it misses the request-time context assembled before the model is invoked: system prompts, tool schemas, MCP blocks, tool results, cache reads/writes, and previous thinking blocks. cost-xray captures the actual local API traffic for Claude Code and Codex, then attributes tokens and dollars back to the sources inside the request. It shows not just how much a turn cost, but why it cost that much.
No reviews yetBe the first to leave a review for Cost X-ray
Maker
📌
We built Cost X-ray because “this coding session cost $X” is not enough.
AI coding agents assemble a large amount of context before every model call: system prompts, tool schemas, MCP definitions, previous messages, tool outputs, cache reads and writes, and reasoning blocks. Most of that is invisible in ordinary usage logs, so it is difficult to understand what is actually consuming the context window—or which parts are driving the bill.
Cost X-ray captures the local API traffic generated by Claude Code and Codex, then attributes tokens and cost back to the individual sources inside each request. You can inspect context-window occupancy, drill into specific tools and MCP servers, and identify things like unused schemas, oversized tool results, or repeated cache writes.
The project evolved from a simple cost dashboard into a lower-level observability tool. Instead of only answering “How much did the session cost?”, we wanted it to answer “What exactly did the model receive, and why did this turn cost that much?”
Everything runs locally, sensitive fields are redacted before storage, and no telemetry is sent. It currently supports Claude Code and Codex on macOS and Linux.
We would love to hear what you discover in your own agent workflows—especially unexpected sources of context or cost.