cost-xray is a cost-tracking proxy that intercepts and analyzes API traffic for Claude Code and Codex to show exactly what each part of a request costs.
The tool solves the problem that standard usage logging only reports total costs per call or session, missing the request-time context that actually drives expenses: system prompts, tool schemas, MCP blocks, tool results, cache reads and writes, and thinking blocks. cost-xray captures the actual local API traffic between your coding agent and the API, then attributes tokens and dollars back to their sources within each request. It shows not just how much a turn cost, but why—breaking down costs by system prompt, cached content, MCP servers, tool results, and other components that occupy the context window.
The tool is designed for developers using Claude Code or Codex who want visibility into what their agents are actually sending to the API. It requires no API keys, account setup, or configuration changes to your agent—it works as a transparent local proxy that intercepts traffic automatically. Installation prompts you to select which agent to capture, and after setup, you run your agent exactly as before with no flags or base-URL changes. The tool operates forward-only, capturing new runs but not past history. A terminal UI lets you drill from agent and project down through sessions, categories, MCP servers, and individual tool calls, with each cell showing cache splits and costs. You can pause capture anytime, and the service runs in the background with auto-start on boot and self-healing behavior.
Development activity shows consistent engagement with the problem space. The project maintains active support for multiple coding agents rather than focusing on a single platform. Documentation covers installation details, systemd integration, manual setup modes, and troubleshooting for different environments. The tool prioritizes transparency by operating as a local-only service with no telemetry, and provides configuration flexibility through environment variables and editable settings files.