Cutting Your LLM Bill: Tools That Measure, Compress, and Route
The first surprise on an agent-heavy workflow is not that it costs money. It is that the bill has no obvious owner: a coding agent re-reads the same file thirty times, a subagent stalls past the prompt-cache window and the whole conversation is re-billed at write rate, a trivial rename goes to a frontier model because nothing decided otherwise. None of that shows up as a single expensive call. It shows up as a monthly number nobody can attribute.
The tools below address that at three different points: measuring where the money actually goes, reducing what each call carries, and routing work to the cheapest model that can still do it. Eleven of them are catalogued here, with live star counts and licences, because "which of these is actually maintained" turns out to be the question the READMEs answer least well — one entry in this list has over eleven thousand stars and an archived repository.
Some links to project repositories carry a referral parameter. It costs you nothing, changes nothing about what appears here, and the ordering below is by problem area, not by whether a link earns anything.
The eleven tools at a glance
Star counts, languages and licences were read from the GitHub API on 2026-08-20.
| Tool | What it does | Language | License | ★ |
|---|---|---|---|---|
| wattage | Prices waste from an OpenTelemetry trace, eight detectors | Python | Apache-2.0 | 21 |
| frugon | Replays your call logs and models what routing would have saved | Python | MIT | 210 |
| claude-pulse | Local dashboard of spend by hour, day and week | JavaScript | MIT | 244 |
| claude-thermos | Keeps the prompt-cache window alive so it is not rebuilt at write rate | Python | MIT | 211 |
| lowfat | Filters verbose command output before it reaches the context | Rust | Apache-2.0 | 568 |
| pxpipe | Renders bulky prompt sections as PNG images | TypeScript | MIT | 7212 |
| wayfinder-router | Offline router that picks a model from prompt shape | Rust | Apache-2.0 | 411 |
| Millwright (ex-foreman) | Self-hosted gateway routing to the cheapest allowed model | Rust | Apache-2.0 | 45 |
| UltraCode-Shim | Runs a deep-reasoning mode against a backend you already pay for | Python | MIT | 421 |
| cursor-bridge | Drives Claude Code against an existing Cursor subscription | Rust | MIT | 63 |
| TensorZero | Unified gateway with observability and evaluation — repository archived | Rust | Apache-2.0 | 11721 |
What counts as a cost tool here
Anything that changes what you pay for the same work. That covers three mechanisms and deliberately excludes a fourth.
It includes measurement (you cannot cut what you cannot attribute), payload reduction (the same task, fewer tokens over the wire), and routing (the same task, a cheaper model). It excludes making the model faster, which is a different problem with a different toolchain: a local-inference benchmark tells you whether your GPU is being used, not whether you are overpaying an API. Speed and spend get conflated constantly, and mixing them produces a list that helps with neither.
Where to start, and why the order matters
The three mechanisms are not interchangeable, and doing them in the wrong order wastes the effort. Measurement first, because every intuition about which call was expensive is a guess until a trace says otherwise — and because the two cheapest wins in practice, a missed cache window and a re-read file, are invisible in any per-call view. Payload reduction second, because it is local, reversible, and does not change which model answers. Routing last, because it is the only one of the three that changes the answer and not just the price of it: a prompt sent to a smaller model may come back worse, and you want a measured baseline before you can tell.
The failure mode of doing it backwards is familiar. Routing goes in first because it promises the largest number, quality drops somewhere unquantified, nobody can prove whether the saving was worth it, and the whole effort gets reverted along with the parts that were free.
Knowing where the money goes
wattage reads a captured agent trace in OpenTelemetry GenAI format, prices exactly where tokens were burned, and names the waste pattern behind each dollar — eight detectors, each with a prescribed fix. It is the only tool here that answers "why" rather than "how much".
frugon points at your existing call logs in OpenAI request/response format and models what you would have saved by switching or routing models. It runs entirely locally: logs never leave the machine, and provider keys go straight to the provider.
claude-pulse reads Claude Code’s own session logs read-only and turns them into spend by hour, day, and week, plus live context fill. Zero dependencies, nothing leaves the machine.
claude-thermos is the narrowest and the most quietly expensive problem in this section: the prompt cache has a five-minute TTL, so when the main agent waits on a subagent for longer, the whole conversation is re-sent and re-billed at write rate instead of being served from cache at a tenth of the input price. The tool keeps that window alive.
Sending less for the same result
lowfat filters verbose command output and file content before it reaches the agent’s context — six built-in filters for git, docker, grep, find, ls, tree, plus a post-read hook that strips comments and collapses function bodies. The saving is structural: the agent never pays for what it was never going to read.
pxpipe is the strangest idea in this list and the most-starred: it renders the bulky parts of a request — system prompt, tool docs, older history — as PNG images before the request leaves your machine, exploiting the fact that an image’s token cost is fixed by its pixel dimensions rather than by how much text is packed into it. Dense content packs well; prose does not.
Routing to a cheaper model
wayfinder-router reads the shape of a prompt — length, headings, lists, code, difficulty cues — and decides offline, in microseconds and with zero model calls, whether it should go to a small local model or a large cloud one. It sits behind any OpenAI-compatible client as a one-line base_url change.
Millwright — published as foreman until recently, and renamed since — is a single Rust binary between your agent and any number of providers, keeping keys inside your own network, routing each request to the cheapest model your policy allows, and tracking spend per dollar. At 45 stars it is early — read the code before putting it in the path of production traffic.
UltraCode-Shim and cursor-bridge attack cost from the subscription side rather than the per-token side: both let a harness you already use run against a backend you are already paying for, instead of buying the same capacity twice.
TensorZero is the heavyweight — a unified gateway across providers with sub-millisecond overhead, observability into your own database, and evaluation built in. Its repository is archived as of June 2026. The code is there and the design is worth reading; treat it as a reference implementation rather than a dependency, and check the fork landscape before adopting.
Doing this natively
The tools above sit outside the assistant. Several of the same problems have install-able answers inside it:
- TokenWise — measurement-driven model router: mechanical work to the cheap model, scoped reasoning to the mid tier
- runaway-guard — treats dollar cost as a third complexity dimension; every paid call site gets a written wallet invariant
- Context Window Management — summarisation, trimming, routing, avoiding context rot
- LLM-OPS — production practices for running models as infrastructure
FAQ
Where does the money actually go in an agent workflow?
Rarely into single expensive calls. It goes into repetition — the same file re-read, the same context re-sent, a cache window missed by thirty seconds — and into work sent to a model larger than the task needed. That is why measurement comes first: the intuition about which call was expensive is usually wrong.
Is compressing context safe?
It depends on what is dropped. Filtering command output the agent was never going to read is close to free. Collapsing source bodies, or packing history into images, trades fidelity for price — fine for older turns, risky for the part of the context the current answer depends on. Change one thing at a time and keep a run to compare against.
Do I need a gateway, or is a router enough?
A router decides where a request goes. A gateway also holds the keys, enforces policy, and records what was spent. If the only goal is a smaller bill, a router is less to operate. If more than one person or agent is spending, the gateway is what makes spend attributable at all.
Why does waiting cost money if nothing is being sent?
Because prompt caching is billed on a timer, not on activity. A cached prefix is served at a fraction of the input price only while requests keep arriving inside the cache’s TTL — five minutes, in Claude Code’s case. Go quiet for longer, and the next request rebuilds the cache: the entire conversation history is re-sent and charged at write rate, which is more expensive than a normal input token, not less. This is why a workflow that waits on a slow subagent can cost several times what the same work costs when it runs uninterrupted, with no change in what was actually asked. It is also the single clearest argument for measuring before optimising — no per-call view shows it, because the expensive event is the gap between calls.
Should I use an archived project?
As a reference, often yes. As a dependency in the request path, only with eyes open: archived means no security fixes, no provider updates when an API changes. Star count says the project was popular; the archive flag says nobody is on call for it. Both facts are in the table above, which is why it is there.
Explore 4,500+ AI tools on Spark
Browse catalog