Show HN: Costcatch – A CLI tool for Agent cost tracking and Debugging Developer Ronak Rahane released costcatch v0.2.0, an open-source npm CLI tool that records every LLM API call an AI agent makes by wrapping the agent's launch command, requiring no SDK changes or code edits and keeping all data on the local machine. The tool reports per-call model, token and cost figures, tool-result sizes, HTTP status and provider error messages for failed steps, plus warnings for loops, retries, duplicate calls and max_tokens cut-offs, and supports diff, --compare-last and CI gates on cost, calls and errors. costcatch requires Node.js 20.19 or later and Python 3.8 or later for tracing Python agents, and users must run `costcatch init` once to download current model prices. Put costcatch in front of the command that runs your agent. Nothing to add to your code, nothing to sign up for, and nothing leaves your machine. costcatch python my agent.py An AI agent is a loop. Every turn it sends the whole conversation to a model, runs the tools the model asks for, adds their results, and goes again. Both the cost and the bugs hide in that loop: - Costs add up quietly. The history is sent again on every turn, so one big tool result is paid for on every call after it. A silent retry, or an agent stuck repeating itself, multiplies the bill. - Failures hide. The SDK retries a rate limit without telling you. A tool fails and the model works around it. An answer gets cut off at max tokens . The run still "finishes", and all you see is the final answer. - Your provider's dashboard can't help. It shows a daily total per model. It can't tell you which step of which run, which tool, or why. - Most tracing tools need setup first. You wrap your client in their SDK, send your traffic through their proxy, or upload your prompts to their cloud. costcatch runs your agent and records every LLM API call it makes, from outside your code. While the agent runs, each call shows up live in your terminal. When it ends, you get the whole run step by step: the model, tokens and cost of each call, the tools the model asked for and how big their results were, what failed and why, and warnings that point at what to fix. | Question | Where costcatch answers it | |---|---| | Which step failed, and why? | ✗ rows with the HTTP status and the provider's message, and failed tools with their error | | Which step costs the most? | The cost of every step, with a bar, and a warning when one step costs more than the rest together | | Which tool result is bloating every prompt? | The size of every tool result, and a warning for big results sent again and again | | Did the agent loop, retry, or get cut off? | Loop, retry, duplicate and cut-off warnings | | Where did the time go? | Time in LLM calls against time in your own code and tools | | Did my change make it worse? | diff , --compare-last , and CI gates on cost, calls and errors | How it compares: | Approach | Examples | What it asks of you | |---|---|---| | SDK-based tracing | LangSmith, Langfuse, Braintrust | Add their SDK to your code and send traces to their server | | Proxies and gateways | Helicone, LiteLLM Proxy | Point your API base URL at the proxy | | OpenTelemetry | OpenLLMetry, APM vendors | Add instrumentation and run a collector | | costcatch | | Put costcatch in front of your command | costcatch is a tool for the machine you're developing on. It isn't production monitoring, and it works fine next to any of the tools above. The published npm package, v0.2.0, requires Node.js 20.19 or later. To trace Python agents you also need Python 3.8 or later; there's nothing to pip install . npm install -g costcatch costcatch init once: downloads current prices for every model Or run it without installing: npx costcatch python my agent.py . To build it from source: git clone https://github.com/RonakRahane/costcatch.git cd costcatch npm ci npm run build npm link puts the costcatch command on your PATH costcatch init first, once: download current prices for every model costcatch python my agent.py trace a Python agent costcatch node my agent.js trace a Node.js agent Run costcatch init before your first trace, and again now and then to pick up new prices. Without it, costcatch only knows a small bundled price list, so newer models show $?.?? , and costcatch reminds you to run it. This is the full terminal screen from costcatch init . It was captured on November 18, 2026; the fetched model count changes as the public price lists are updated. ██████╗ ██████╗ ███████╗████████╗ ██████╗ █████╗ ████████╗ ██████╗██╗ ██╗ ██╔════╝██╔═══██╗██╔════╝╚══██╔══╝██╔════╝██╔══██╗╚══██╔══╝██╔════╝██║ ██║ ██║ ██║ ██║███████╗ ██║ ██║ ███████║ ██║ ██║ ███████║ ██║ ██║ ██║╚════██║ ██║ ██║ ██╔══██║ ██║ ██║ ██╔══██║ ╚██████╗╚██████╔╝███████║ ██║ ╚██████╗██║ ██║ ██║ ╚██████╗██║ ██║ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ┌────────────────────────────────┬────── v0.2.0 ───────────────────────────────────────┐ │ │ │ │ About │ Commands │ │ Zero-instrumentation LLM │ run trace a script default │ │ agent tracer & cost tracker. │ estimate estimate prompt token cost │ │ Like time , for AI agents. │ show inspect conversation content │ │ │ diff compare two saved traces │ │ Features │ stats aggregated analytics │ │ · live trace in the terminal │ replay re-display a saved trace │ │ · per-call cost tracking │ watch run, always saved │ │ · prompt cost estimation │ clean prune old saved traces │ │ · auto-diff between runs │ init setup & fetch pricing │ │ · CI assertion gates │ │ │ · secret & PII redaction │ Quick Start │ │ │ $ costcatch python3 agent.py │ │ │ $ costcatch node agent.mjs │ │ │ │ └────────────────────────────────┴─────────────────────────────────────────────────────┘ - fetching latest model pricing… ┌──────────────────────────────────────────────────────────────────────────────────────────────┐ │ costcatch init │ │ │ │ ✓ created .costcatch/ ~/oncall-agent/.costcatch │ │ ✓ added .costcatch/ to .gitignore │ │ ✓ fetched latest pricing 5,831 models │ │ │ │ ready · run costcatch --help to see all commands │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ Your program runs as usual and keeps its own output and exit code. costcatch draws a live view of the calls under that output, and prints the full trace when the program exits. The repository has a small demo agent that answers its own API calls from a mock server in the same process. It needs no key and calls no real API, and costcatch prices its calls as if they went to gpt-4o . From the repository root: costcatch node demo scripts/demo agent.mjs costcatch --save node demo scripts/demo agent.mjs save a run costcatch --save node demo scripts/demo agent v2.mjs save a cheaper version of the same agent costcatch diff compare the two saved runs costcatch --save python my agent.py keep the trace in .costcatch/ costcatch show --step 3 read exactly what step 3 sent and got back costcatch --save --compare-last python my agent.py what changed since the last run costcatch stats spend and tools across all saved runs costcatch --max-cost 0.10 --max-errors 0 python my agent.py fail if it costs too much or errors costcatch's own flags go first. Like time and env , everything from your program's name onward belongs to your program. costcatch --save python agent.py saves the trace; costcatch python agent.py --save passes --save to your agent. costcatch warns you when one of its flags ends up in your command. costcatch isn't limited to scripts. Start your backend under costcatch, use your app the way you normally would a browser, your frontend, curl , and every LLM call any request makes shows up in the live view. Press Ctrl+C to stop the server, and costcatch prints the trace of the whole session. Add --save to keep it. php flowchart LR client "Browser, frontend