We Stress-Tested AI Spend Limits. Here's Where They Held and Where They Slipped.

If you sell AI features and bill your customers for usage, a budget limit is a promise about your margins. We wanted to know how well that promise holds when things get messy: parallel calls, oversized responses, backend outages, restarts, and hundreds of customers at once. So we tested two tools, LiteLLM, the popular open-source proxy, and Revenium, a commercial AI cost platform.

The short answer: configured well, LiteLLM held every budget we set to within about 2.5%, even through a database outage. But several of its safest behaviors are off by default, and on the default setup we saw spend go unrecorded, budgets handed back after a restart, and customers slipping one call past their limit. Revenium's accounting was accurate to a fraction of a cent, but its enforcement works from a copy of the rules it refreshes on a timer, so overshoot grew with how fast a customer was spending.

The full set of tests cost under $2 in OpenAI usage. Here's what we did and what we found.

How we tested

We wrote a small Python harness that sends calls to gpt-4o-mini on behalf of test customers, each with its own spend limit, and logs every call's cost, latency and whether it was blocked. Most tests used a $0.05 budget per customer, small enough to cross in about 35 calls. Every test started with a fresh customer at $0, and a stop-loss in the harness aborted any run that reached three times its budget.

The tests:

  1. Calls one at a time until the customer is blocked.
  2. A 20-call burst, fired at once after spending 90% of the budget.
  3. One large call near the limit, allowed up to 16,000 output tokens.
  4. A cancelled stream, to see whether partial output is counted.
  5. Backend outages: stopping LiteLLM's database, or cutting Revenium's connection, partway through a run.
  6. 250 customers at once, each with a tiny budget, to see how limits behave at the scale of a real SaaS product.

Results at a glance

Overshoot past a $0.05 budget, by test Horizontal bar chart. The same figures are in the table below. Overshoot past a $0.05 budget, by test Revenium LiteLLM (default setup) Calls one at a time · LiteLLM 2.4% Calls one at a time, 60 s refresh · Revenium 117% Calls one at a time, 10 s refresh · Revenium 14.5% 20-call burst · LiteLLM 2.5% 20-call burst, 10 s refresh · Revenium 51% One large call near the limit · LiteLLM 15.6% One large call near the limit · Revenium 4.8% Cut off while under budget · Revenium at least 198%
Overshoot past a $0.05 budget, by test
TestToolOvershoot past budget
Calls one at a timeLiteLLM2.4%
Calls one at a time, 60 s refreshRevenium117%
Calls one at a time, 10 s refreshRevenium14.5%
20-call burstLiteLLM2.5%
20-call burst, 10 s refreshRevenium51%
One large call near the limitLiteLLM15.6%
One large call near the limitRevenium4.8%
Cut off while under budgetReveniumat least 198%
Our test harness, October 2026. gpt-4o-mini, $0.05 budget per test customer. LiteLLM shown on its default setup.

Two things don't fit in a chart. Revenium's recorded spend matched our own tally to within $0.00004 in normal operation, so its accounting is solid; its overshoot comes from timing. And with Redis and its fail-closed setting turned on, LiteLLM's default-setup gaps closed: the large call was rejected before it reached OpenAI, and nothing was lost in an outage.

What held up

LiteLLM handled concurrency better than we expected. We predicted a 20-call burst would sail past the budget, since each call would check the same counter before any of them finished. Instead, only 4 of the 20 got through. Reading the source explains why: before forwarding a call, LiteLLM reserves its worst-case cost (input tokens plus max_tokens) against the customer's budget, and every new call sees the reservations of calls still in flight. When a call finishes, the reservation settles to the real cost. A cancelled stream was settled to its input cost, which is close to what it actually cost.

LiteLLM's fail-closed setting stops oversized calls. With fail_closed_budget_enforcement: true, a call whose worst-case cost didn't fit the remaining budget was rejected in 25 ms, before it reached OpenAI.

LiteLLM with Redis survived every outage we tried. With REDIS_HOST/REDIS_PORT set and use_redis_transaction_buffer: true, spend recorded while Postgres was down was re-queued and written once it came back, and a customer over budget stayed blocked after a proxy restart. With 250 customers active at once, every one was blocked right on schedule.

The proxy is cheap in latency. LiteLLM added about 28 ms at the median and 114 ms at the 95th percentile, small next to the model's own response time.

Revenium's books were accurate. In normal operation, its recorded spend matched ours to within $0.00004, and once it blocked a customer, it kept blocking them even after we cut its connection.

Where limits slipped

LiteLLM, on its default setup

All four disappeared with Redis and the fail-closed setting turned on. Several related LiteLLM issues are open, including #35529, #34238 and #43732; we haven't reproduced those.

Revenium

If you run one of these today

LiteLLM

Revenium

Caveats

Check your own setup

We turned these tests into a free, open-source tool, stipend-check. Point it at your LiteLLM proxy and in about two minutes it reports which safe settings are off and runs a small live test with a throwaway customer, capped at five cents. For Revenium it checks your settings and that the SDK can actually read your rules, with no spend. Get stipend-check on GitHub.

What we're building

The tests left us with a bigger question. Enforcement is the last step; before it, a company billing customers for AI usage needs to know what each customer actually costs, which customers are unprofitable or abusing a free tier, and whether its pricing makes sense. That's what we're working on, under the name Stipend.

If you sell AI usage to your customers and any of this sounds familiar, we'd like to hear how you handle it today. We're looking for a few design partners to try early versions and shape what we build.

Become a design partner