All articles
Cost··12 min read

Nobody wants your data. They want your API key.

A leaked key turned into a $30,000 bill overnight. For most small apps the realistic worst case is not a breach, it is an invoice. Why your spend cap probably does not stop your spend, which providers actually halt by default, and the free protection almost nobody has switched on.

The realistic worst case for a small app is not that somebody steals your data. It is that somebody spends your money.

Your user table is worth very little to a stranger. Your API keys are worth whatever your card will authorise, and they can be used within minutes of being found, by someone who never has to look at your app at all.

Thirty thousand dollars, overnight

Chris Raroque, describing what this looks like when it happens to you:

One of my environment variables got leaked, which was an AWS key that just had too many permissions attached to that key. Absolutely no budget cap either. I woke up to a $30,000 bill where someone took the key and then used something called AWS SageMaker to do machine learning training on my key. I got lucky and the bill was waived to about $2,000.

· Chris Raroque

Three separate failures stacked into one invoice. The key leaked. The key could do far more than it needed to. And nothing anywhere was willing to say stop. Remove any one of the three and the story ends quietly.

Most advice about this stops at “set a budget.” The uncomfortable part, which took reading the documentation to find, is that setting a budget frequently does not stop anything.

Your spend cap probably does not cap your spend

Vercel is unusually honest about this in print, so start with them:

Setting a spend amount does not stop usage on its own. To stop incurring costs above your spend amount, turn on Pause Production Deployments.

· Vercel documentation, Spend Management

Turn that on and two more caveats follow, both documented:

Pausing is not instantaneous. Because Vercel checks your spend every few minutes, projects can keep serving traffic and accruing usage for several minutes after you cross the spend amount.

· Vercel documentation, Spend Management

Pausing only affects production deployments. It does not stop AI Gateway API key usage or v0 usage.

· Vercel documentation, Spend Management

That last sentence is the one to sit with. If your app is expensive because it calls a model, pausing your project does not stop the expensive part. Spend Management is also only available on Pro and Enterprise.

This is not a complaint about Vercel, who document their limitations more clearly than most. It is the general shape of the problem: the cap has to live where the invoice is generated, and most people have set it somewhere else, or nowhere.

Who actually stops, by default

Checked on 19 October 2026. The question is not whether a budget feature exists, but whether anything halts without you configuring it.

  • Anthropic: hard stop, on by default. Tier spend caps halt the account. Worth knowing the failure shape because it breaks retries: the 429 carries no retry-afterheader, so an SDK's automatic retries fail repeatedly instead of backing off. Identify it by the error code enforced_spend_limit_reached.
  • OpenAI: hard stop at the tier usage limit, on by default. Your own spend limits are opt-in, and the alert variant explicitly does not stop traffic.
  • Supabase: spend cap on by default on Pro. The only platform here where the protective setting is the default. They are also candid that it is coarse: it covers egress, edge invocations, realtime, storage and logs, but not compute, replicas or PITR. It protects you from an attack, not from your own provisioning.
  • Vercel Hobby: cannot be charged at all. Exceeding included usage disables the feature for about thirty days rather than billing you. Hobby is restricted to non-commercial use, so this is not a strategy, but it is why most hobbyists never see a bill.
  • Cloudflare Workers, Twilio, Google Cloud and Firebase: alerts only.Google's own guidance says budget alerts do not pause services.
  • Netlify: nothing. See below.

The pattern is counterintuitive and worth remembering: the providers most capable of producing a catastrophic bill, the model APIs, have the best defaults. The hosting platforms mostly do not stop.

Raroque is sharp about the ones that offer nothing:

I absolutely hate how Firebase and some services don't do that. It's just so malicious, in my opinion, that they don't have that. But the world's not fair and you sometimes just have to set that up yourself.

· Chris Raroque

The twenty month gap

In early 2024 a developer received a Netlify bill reported at around $104,500. The story is usually told as a DDoS attack that was forgiven. Two parts of that need correcting, and the correction is the interesting bit.

Netlify's own support lead said in the thread: “To be clear, this case was not a malicious DDoS attack.” And the company said at the time that it had assembled a team to address the lack of spending controls.

Twenty months later, their billing documentation says that on plans other than Enterprise there is no direct way to set limits on metered feature usage, aside from not using a feature at all.

Vercel met the same complaint wave and shipped hard caps within weeks. One platform shipped a control, the other shipped a statement. If you are choosing where to put something that could get expensive, that difference tells you more than any feature table.

The incidents that are actually documented

Most surprise-bill stories are screenshots. I went looking for ones with a traceable primary source, and the best two are recent and end in a way people do not expect.

Two Gemini cases on Google's own developer forum in 2026.One reports over €54,000 in about thirteen hours. The other roughly $67,000 in nineteen hours. Both came from unrestricted API keys provisioned through Firebase, and a Google staff member replied in-thread acknowledging the problem and saying they were moving to disable unrestricted keys.

Both refund requests were refused. In the second case Google wrote that the project may have been compromised and that they were unable to make adjustments to the charges.

That is the version worth internalising, precisely because it is not the comforting one. The vendor acknowledged the compromise in writing and still declined. Raroque got his $30,000 reduced to $2,000 and says plainly that he got lucky. Every retelling that ends in forgiveness is teaching you to rely on something nobody has promised.

The counter-example, and the reason to report it anyway: a developer was billed around $1,300 for nearly 100 million unauthorised S3 requests to a bucket that happened to share a name with an open source tool's default configuration. AWS cancelled it, then changed the policy. They now state that bucket owners are never charged for requests returning 403 from outside their account. One person's bill became everyone's fix.

One more thing, in the interest of not doing what I am criticising. The widely circulated Vercel bill figures, including a $96,000 one, trace to tweets rather than written accounts. The main Hacker News link for that story is a tweet with eleven points, whose second comment is somebody pointing out that it is just a tweet. I could not verify any of those numbers, so I am not repeating them as facts.

What is actually billing you

Here is a mechanism that catches people out, because the intuition runs backwards:

Vercel bills Provisioned Memory continuously until the last in-flight request finishes. Vercel bills Active CPU only while your code is actually running. If the request is waiting on I/O, CPU billing pauses but memory billing continues.

· Vercel documentation, Functions usage and pricing

So a function that spends four minutes awaiting a model response uses almost no CPU and looks nearly free on the metric people check. Memory is billed for the entire four minutes regardless. The archetypal AI feature, an agent loop that mostly waits, is exactly the shape that looks cheap and is not.

Which tells you the fix is architectural. Shortening the wall clock helps. Making the code more efficient while it waits does nothing.

Rate limiting is now free, and almost nobody knows

An unauthenticated endpoint that calls a paid model is not a performance risk, it is a billing vulnerability. Vercel has a name for the category: denial of wallet.

The common advice is that Vercel's firewall rate limiting requires Pro. That changed in May 2025. It is now available on all plans, with Hobby including one rate limit rule per project and the first million allowed requests per month. Windows from ten seconds to ten minutes, keyed on IP or browser fingerprint, 429 by default.

One rule, free, about five minutes of configuration. It is the cheapest meaningful protection on this stack and most people believe it is paywalled.

Two honest limits on what it buys, both from the vendors themselves:

  • Vercel counts per region, so traffic spread across regions can exceed the limit you set for any single one.
  • Cloudflare documents a delay of up to a few seconds before counters update, during which excess requests reach your origin.

And structurally: a rate limit bounds the rate of loss, not the total. Only a cap at the meter does that. Use both.

Counting requests in a module-scope Mapis not a rate limiter, though the usual explanation is slightly wrong. Under Fluid compute, module scope genuinely is shared across concurrent invocations on one instance. It still fails because there can be thousands of instances, instances are discarded between traffic, and every deployment resets the count. Vercel's own guidance is to keep counters in an external store.

Two controls that are not about caps

Scope every key to one job.Raroque's leaked key should never have been able to start machine learning jobs. It only could because it was issued broadly, the way starter instructions usually suggest. Assume every key you create will eventually be public, then ask what it can do on its worst day. If the answer is anything beyond its single purpose, issue a narrower one.

Count on the server. A limit enforced in your interface is a suggestion. The endpoint behind it is visible to anyone who opens the network tab and will answer direct requests all day. Counters belong next to the thing being protected, and the same goes for anything else that decides cost: prices, plan tiers and quotas must never arrive from the client. Add a per-IP limit alongside the per-user one, since per-user limits fall to mass account creation.

Raroque's framing of the trade is the right one, and it is the sentence most people need permission to believe:

It is so much better for your app to go down for a little bit than for you to wake up with a $10,000 bill.

· Chris Raroque

Check this before you check anything else

Data breaches are slower, rarer and usually survivable for a small project. A runaway bill arrives overnight, is owed immediately, and does not care how many users you had.

  • Set a hard cap at every provider that sends you an invoice. Not at your host. Your host cannot stop your model spend and says so.
  • Check whether what you set actually halts. If it only sends an email, you do not have a cap, you have a notification.
  • Turn on the free Vercel rate limit rule for anything unauthenticated that costs money per call.
  • Require authentication on model endpoints so there is a unit you can suspend. A limit keyed on IP is weak; one keyed on a user ID is enforceable.
  • Narrow every key to the one thing it does.
  • Shorten wall clock, not CPU. Memory bills for the whole duration of a request that is merely waiting.
  • Do not plan on forgiveness. It happens, it is not policy, and in the two best documented 2026 cases it did not happen.

Find out which of those apply to you

Fourteen questions, about three minutes, runs entirely in your browser. You get a ranked list of what's actually open, with the fix for each.

Run the free check

Sources

Quotations from the two interviews are transcribed from the published videos and lightly condensed for readability.