#3636th of 48 in Gateways and observability

cost-xray

Per-source token and cost breakdown of Claude Code and Codex API requests

Stars
5.8k
License
MIT
Last commit
Nov 2026
Language
Python
Stars, last 23 weeks+5,805
2 Jun 2026: 0 stars9 Jun 2026: 0 stars16 Jun 2026: 11 stars23 Jun 2026: 59 stars30 Jun 2026: 131 stars7 Jul 2026: 178 stars14 Jul 2026: 222 stars21 Jul 2026: 262 stars28 Jul 2026: 304 stars4 Aug 2026: 367 stars11 Aug 2026: 426 stars18 Aug 2026: 480 stars25 Aug 2026: 579 stars1 Sept 2026: 631 stars8 Sept 2026: 1,044 stars15 Sept 2026: 1,703 stars22 Sept 2026: 1,871 stars29 Sept 2026: 3,028 stars6 Oct 2026: 3,695 stars13 Oct 2026: 4,283 stars20 Oct 2026: 5,317 stars27 Oct 2026: 5,801 stars3 Nov 2026: 5,803 stars10 Nov 2026: 5,805 stars

0 on 2 Jun 20265,805 on 10 Nov 2026

From GitHub's daily star counts.

Checked on GitHub.

Overview

cost-xray captures the real API traffic from Claude Code and Codex through a local mitmproxy hop. It attributes tokens and dollars to system prompts, tool schemas, MCP servers and individual tool calls, split by cache read, write, fresh and output. Results are browsed in a terminal UI opened with `cx`, and raw traffic is redacted and deduplicated under ~/.cost-xray/.

Who it is for: Developers tracking what Claude Code and Codex send and what it costs

Strengths

  • Reads raw requests, so system prompt and tool schemas are visible, unlike log-based usage tools
  • Prices individual tool calls with cache read/write/fresh split and flags unused MCP servers
  • Local only: binds to 127.0.0.1, no telemetry, secrets redacted before writing to disk
  • Wrapper falls back to running the agent directly if the proxy is down

Weaknesses

  • Only Claude Code and Codex supported; other agents need a new adapter module
  • Claude per-source split is estimated via tiktoken calibration; only the total is exact
  • Forward-only: past sessions are not captured, only runs started after install
  • Codex capture needs a scoped local CA; installer runs via curl-pipe-bash, macOS/Linux only

What it needs

  • no GPU
  • Needs mitmproxy, Claude Code or Codex, systemd (optional, Linux)
  • Models: Claude Code (Anthropic wire), Codex (OpenAI Responses wire)

Quick answers

Is cost-xray open source?

Yes. Its code is on GitHub under the MIT license.

Does cost-xray need a GPU?

No, it runs without one.

Also in Gateways and observability

See all 48
Also in Gateways and observability
RankProjectScore
1OmniRouteLLM gateway routing one OpenAI-compatible endpoint across 372 providers86.5k starsMIT96 out of 100
2headroomCompresses tool outputs, logs and history before they reach the LLM79.4k starsApache-2.092 out of 100
3new-apiGateway that unifies LLM providers behind OpenAI, Anthropic and Gemini APIs51.8k stars+2,216 (+4.5%) in 30 daysAGPL-3.0known advisory in latest version91 out of 100
#4MLflowTracing, evaluation and prompt registry for LLM apps, plus ML tracking Live demo ↗ (opens in a new tab)28.8k stars+450 (+1.6%) in 30 daysApache-2.090 out of 100
#5LiteLLMOpenAI-format gateway and Python SDK for calling 100+ LLM providers63.1k stars+2,260 (+3.7%) in 30 dayscustom license87 out of 100