Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

burnix

Nix the burn. Hard spend caps and per-session attribution for LLM API calls.

Your provider's spending limit is an alert, not a brake. burnix sits between your code and the API and refuses requests once you hit the cap — before the money is gone, not after.


Why

Provider-side cost controls were built for pre-AI cloud usage, and they fail in the ways that matter most:

  • A developer set a $250 cap and received a $10,138 bill overnight.
  • An AWS customer with anomaly detection enabled was charged $30,141 for a single Bedrock inference run. No alert ever fired.
  • Teams four months into 2026 discovered they were 3x over their entire annual token budget.

The common thread isn't that models are expensive. It's that spend was observable after the fact and unenforceable in the moment — provider caps run off billing pipelines that lag by minutes to hours. That was fine when the worst case was a forgotten VM at $4/hour. An agent in a retry loop outruns the billing system entirely.


Install

npm install -g @burnix/cli

Usage

Wrap any command that makes LLM API calls:

burnix --cap 5.00 -- npm run agent
burnix  session 7f2a91  cap $5.00
  ├─ claude-sonnet-4-6    142 calls   $3.18
  └─ gpt-5.1               18 calls   $0.42
     total $3.60 / $5.00  ███████▒░░  72% (+$0.30 in flight)

The bar has two segments: solid for settled spend, a lighter shade for cost still reserved on in-flight requests. The percentage is settled spend only — reservations are pessimistic and don't inflate the headline number, but they do count toward the cap, so the shaded segment is how much closer they're pushing you to it.

When the cap is reached, the next request is refused and the wrapped process exits non-zero:

burnix  CAP REACHED  $5.02 / $5.00
burnix  request blocked — session 7f2a91 terminated

With Claude Code

burnix --cap 10.00 -- claude

Watch first, cap later

burnix --watch -- npm run agent

Tracks spend without blocking anything. Useful for finding out what your agent actually costs before you set a limit.

Burnix

burnix demo

Concurrency

Parallel requests are the normal case for agents, and they're where naive cost tracking fails: twenty simultaneous calls all read the same "spent" value before any of them completes, so all twenty pass the check.

burnix reserves the worst-case cost of each request before it goes out, then reconciles against actual token usage when the response returns. In-flight requests are visible to each other, so the cap holds under parallel load.


What it does not do

  • Does not proxy through our servers. Runs locally. Your keys and prompts never leave your machine.
  • Does not estimate final costs. Reservations are pessimistic worst-case; recorded cost comes from actual token counts in API responses.
  • Does not replace your provider dashboard. It enforces and attributes. Reconcile against the real invoice.
  • Does not support every provider. Anthropic and OpenAI at launch.

Known limitations

  • Node children only. Interception works by injecting a require-hook via NODE_OPTIONS and patching global fetch, so Python and Go subprocesses pass through untracked.
  • Cross-process races are narrowed, not eliminated. Two separate Node processes sharing one session can still interleave. The window is microseconds rather than seconds.
  • Prices are hardcoded and will drift from provider pricing.
  • Requires the SDK to use global fetch. Verified against @anthropic-ai/sdk 0.116.0.

Status

Early. Built because provider caps don't hold and I wanted one that does.

If it breaks, open an issue — I read all of them.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages