Claude Code usage

cost-xray

Shows what Claude Code sends to the API and what each part of the request costs.

5,814 stars 375 forksUsage & cost trackers Source

Install

From source
git clone https://github.com/tigerless-labs/cost-xray.git

From 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…
Read the full README on GitHub

Details

Language
Python
License
MIT
Last updated
2 November 2026
Topics
claude-codecodex-clicost-trackingobservabilityprompt-cachingproxytoken-counting

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

Browse the most popular Claude Code mods, all usage & cost trackers, or the skills and MCP server directories.