Cost-xray: Seeing What My AI Coding Agent Actually Sends to the API
说明与用途
cost-xray 让开发者了解 AI 编码代理请求中哪些部分消耗了令牌和费用,提供详细分析和优化能力。
问题
Developers lack visibility into the detailed cost drivers of AI coding agents, seeing only total session cost without knowing which parts of the request consume tokens and money.
结果
cost-xray provides fine-grained visibility into AI coding agent request traffic, enabling developers to pinpoint cost drivers, optimize prompts and tool usage, and reduce unnecessary token consumption.
工作流
- Install cost-xray via one-line installer
- Select target agent (Claude Code, Codex, or both) during setup
- Run your coding agent normally (e.g., codex or claude)
- After coding, launch the dashboard with
cx - Navigate the dashboard: agent → project → session → category → MCP server → tool → per-turn call
- Review detailed views to see context-window occupancy and per-source cost
- Use insights to optimize agent configuration (remove unused schemas, adjust caching, limit tool outputs)
证据
cost-xray is a local tool for inspecting AI coding-agent requests.
The capture layer uses mitmproxy as a local hop. It records redacted request and response data under ~/.cost-xray/.
After that, open a new terminal and use your agent normally: codex or claude, then open the dashboard: cx
- 记录日期: 2026-09-05T14:20:35.736Z