Claude Code usage
cost-xray
Shows what Claude Code sends to the API and what each part of the request costs.
Install
git clone https://github.com/tigerless-labs/cost-xray.gitFrom the README
cost-xray See what your AI coding agent actually sends to the API — and what each part costs. 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. Home — every session by agent · project · session, with token and dollar totals Drill a session — context-window occupancy (top) and per-source cost, down to each MCP server (bottom) Requirements - A supported coding agent — Claude Code or Codex - macOS or Linux - No API keys, no account, no config changes to your agent — capture is a transparent local hop Install The installer asks which agent(s) to capture — Claude Code, Codex, or both — and prompts even under curl … | bash. - Skip the prompt (e.g. CI): set COST_XRAY_AGENTS=claude|codex|all. - Already cloned the repo? Run ./install.sh. Then open a new terminal and run claude / codex exactly as before — capture is automatic, no flags and no base-URL change. It's forward-only: runs started in that new shell are captured, not past history. Open the live TUI from anywhere: Capture runs as a background service (auto-start on boot, self-healing, port-adaptive) and doesn't change what your agent does, its results, or its cost — pause anytime with cx stop. See docs/install.md for systemd details, GUI agents (Cursor base-URL setup), manual (no-systemd) mode, and troubleshooting. Usage cx is the whole CLI and works from any directory. Change…
Details
- Repository
- tigerless-labs/cost-xray
- Language
- Python
- License
- MIT
- Last updated
- 2 November 2026
- Topics
- claude-codecodex-clicost-trackingobservabilityprompt-cachingproxytoken-counting
- Listed in
- jqueryscript/awesome-claude-code
FAQ
What is cost-xray?
Shows what Claude Code sends to the API and what each part of the request costs. It is a usage for Claude Code, from tigerless-labs/cost-xray on GitHub.
How do I install cost-xray?
Clone tigerless-labs/cost-xray from GitHub and follow the setup steps in its README.
Is cost-xray popular?
tigerless-labs/cost-xray has 5,814 GitHub stars and 375 forks, and is included in 1 curated Claude Code list. It was last updated on 2 November 2026.
More usage & cost trackers
CodeBurn
12kgetagentseal/codeburn
Local tool that tracks token usage and cost across Claude Code and dozens of other coding agents.
Loop Engineering
12kcobusgreyling/loop-engineering
Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.
ccusage
19kccusage/ccusage
CLI that analyses Claude Code's local JSONL logs to report token usage and cost by day, month and session.
Failproofai
7.8kFailproofAI/failproofai
Observability and enforcement for AI agent harnesses. Capture every run and runtime reliability with policy enforcement.
Claude Code Usage Monitor
8.8kMaciek-roboblog/Claude-Code-Usage-Monitor
Real-time terminal monitor for Claude Code token usage with burn-rate predictions and limit warnings.
abtop
3.8kgraykode/abtop
htop-style terminal monitor for Claude Code and Codex sessions, tokens, context window and rate limits.
Browse the most popular Claude Code mods, all usage & cost trackers, or the skills and MCP server directories.