whereismyai
Cost X-Ray
Cost X-Ray is a local developer tool that captures API traffic for Claude Code and Codex to attribute token usage and costs to specific request sources.
Cost X-Ray tracks AI coding agent usage by capturing local API traffic before it reaches the provider. The tool runs as a local background service, intercepting traffic to identify token consumption and costs associated with system prompts, tool schemas, MCP blocks, and individual model turns. Unlike log-based tools that only analyze completed transcripts, Cost X-Ray inspects the raw request to attribute spending to specific sources. This allows users to identify overhead like configured MCP servers or tool schemas that occupy context windows without being called. The software supports Claude Code and Codex, providing a live terminal UI to inspect sessions by project, agent, or specific tool call. All processing stays local and private, with sensitive fields redacted before storage.
Cost X-Ray at a glance
Key features
- Token cost attribution to individual sources and calls
- Real-time context window occupancy breakdown
- Detection of unused or wasteful MCP server overhead
- Automated capture of Claude Code and Codex API traffic
- Privacy-focused local storage with sensitive field redaction
- Per-turn breakdown of cache read, write, and fresh tokens
- Self-healing proxy wrapper that allows agents to run direct if needed
Use it for
- Identifying which tool schemas bloat the context window
- Analyzing costs of specific MCP servers and tools
- Optimizing prompts by seeing what gets sent in the request prefix
- Troubleshooting expensive sessions by drilling down to individual turns
Companions
Tools that articles about Cost X-Ray recommend using with it, each with its job.
- Claude Code — Built to work with Claude Code.
- Codex — Built to work with Codex.
- Context7 — Provides up-to-date documentation for AI agents and code editors.
- Superpowers — Brainstorm, plan and execute skills for bigger tasks.
- Playwright MCP — Enables LLMs to interact with web pages using structured accessibility snapshots.
- GitHub MCP Server — Reads pull requests, issues and code search on GitHub.
Alternatives to Cost X-Ray
- Claude Code Session Tracker — Monitor Claude Code usage limits and token history in a single local interface.
- Ctxvitals — Measures exact token costs and security risks before agent launch.
- Claude Code Usage Monitor — Tracks token usage, message counts, and session costs with local history and alerts.
- pxpipe — Cuts end-to-end token bills by compressing bulky context into compact PNGs.
- TokenTracker — Monitor AI spending across 43 coding tools in one local, private dashboard.
- What Would It Cost — Tracks historical and live session costs against Anthropic list prices.
- ccusage — Tracks token usage and costs locally across multiple coding agent CLIs.
- mcp-router — Reduces Claude Code tokens by 13% to 44% using tool search and JSON shaping
- Opaline — Track team-wide token costs and coding session analytics.
- Claude Tap — Inspect prompts, tool calls, and token usage locally without a hosted dashboard.
- Compactly — Compacts sessions at natural breaks and shows turn costs and cache expiration.
- CodeBurn — Tracks AI coding token usage and costs locally across 41 tools and agents.
All Cost X-Ray alternatives