r/AI_Loops • • 14h ago

An overnight Vertex AI job spent C$75,951 before a card decline stopped it. Where the spend guard has to live in an unattended loop

0 Upvotes

An overnight Gemini 2.5 Flash batch job on Vertex AI spent C$75,951 before anything stopped it, and the thing that stopped it was the owner's credit card declining. That's the account a developer posted in r/googlecloud this week (265 upvotes, now also on the HN front page). Every Google alert he had set up arrived after the money was gone.

His timeline:

  1. Spend ramps around 10pm Eastern. Google's cost anomaly docs say early signal alerts for Gemini API and Vertex AI arrive "with an expected latency of 20 to 40 minutes from the time of usage." His first anomaly email came 9h42m later, and it couldn't name the product yet.
  2. Around 5am, C$36K of startup credits ran out with no notice, and spend crossed his C$286 monthly budget. His 50, 80 and 100 percent budget emails never came.
  3. 11:34am, a C$8,600 auto charge declines on his card. That's what killed the job.
  4. 1:50pm, the 100 percent forecasted and 120 percent budget emails arrive, over two hours after he had shut everything off.

This is his account and Google hasn't answered it publicly that I could find. The lag itself is in Google's own docs, though. Normal budgets run on actual spend, which the Budget API docs say "typically takes up to 24 hours" to calculate. So a Pub/Sub kill switch wired to a budget, the setup Google's own docs suggest for automated cost control, fires on the same late number.

If you run loops overnight, three layers, fastest first:

  1. Count inside your own loop, if the job is your own loop of API calls. Every Gemini response carries usage metadata. Multiply tokens by list price per call, keep a running total and stop the loop at a hard number. Zero billing lag, and it's the only layer that sees spend the moment it happens.
  2. Provider spend cap as the backstop. Google made spend caps GA on Oct 30. They run on gross estimated cost and trigger within minutes for AI services. The docs are clear on the limits: enforcement "isn't instant and any cost overages are billed as normal", one cap covers one project and one service, credits are ignored in the math, and Provisioned Throughput is never halted. Eligible services today are Gemini API, Vertex AI (now Gemini Enterprise Agent Platform), Cloud Run and Cloud Run functions.
  3. Budget alerts are receipts. Useful for the monthly picture, too slow to stop anything.

If you hand Google a batch job and walk away, layer 1 doesn't exist, so the cap is your only real guard.

The cheap habit from this: before an unattended run, write down the number at which you'd want to be woken up, and put that number in the loop code itself.

Original post: https://www.reddit.com/r/googlecloud/comments/1yazk1p/ Anomaly latency (archived docs): https://web.archive.org/web/20260915110059/https://docs.cloud.google.com/billing/docs/how-to/manage-anomalies Spend caps limits: https://docs.cloud.google.com/billing/docs/how-to/budgets-spend-caps Budget API, 24h actual spend: https://docs.cloud.google.com/billing/docs/how-to/budget-api-overview