How an AI Coding Agent Ran Up an Unexpected GCP Bill Overnight
Iwan Efendi6 min

An AI coding agent ran up an unexpected Google Cloud bill overnight. Here is why, how GCP credits really work, and the courtesy credit Google approved.
I was thrilled when my monthly Google Developer Program benefit arrived: a fresh allotment of Google Cloud credits (~IDR 181,835 / $12 USD) active on my billing account until April 2027. Naturally, I wanted to put these credits to good use. I set up an API key on Google Cloud's Vertex AI Platform to test out Gemini models directly inside OpenCode, my daily terminal coding assistant.
Everything felt smooth and responsive. But when I checked my Google Cloud Billing dashboard the next morning, my stomach dropped.
A raw usage spike of IDR 301,839 ($20 USD) had occurred overnight. Even with Google's automatic discounts shaving off half the cost, I was staring at an unexpected net charge of IDR 150,924 ($10 USD). Worse yet, my developer credits sat untouched at a 100% balance.
Here is the full post-mortem of how an autonomous debugging loop quietly burned through millions of tokens, the critical billing account pitfall that caught me off guard, and the exact steps I took to mitigate future leaks and secure a one-time courtesy waiver from Google Cloud Support.
If you use AI coding assistants like OpenCode, Aider, or Cline, you already know their power: they do not just answer questions; they read files, inspect error traces, run shell commands, and edit code autonomously.
However, that autonomous loop has a hidden financial cost when debugging tricky errors.
During my evening session, OpenCode was attempting to resolve a multi-file dependency error. To give it maximum reasoning power, I had selected
Because agentic coding tools resend the cumulative conversation history and every inspected file on every single turn, a debugging session that takes 15–20 iterations easily transmits tens of millions of cumulative tokens.
When paired with a flagship-tier model like
Figure 1: The sudden cost spike in Google Cloud Billing driven by Gemini 4 Argon during autonomous error-fixing loops.
High token consumption was only half the problem. I had assumed my Google Developer Program promotional credits would absorb the usage.
When I opened Google Cloud Console's Billing Account Management, the real root cause became crystal clear:
Figure 2: Billing account management showing the cost disparity between my primary credited account (Firebase One) and my secondary account (Firebase Two).
During troubleshooting, another confusing puzzle arose in Google AI Studio (
Because OpenCode talks to the Vertex AI backend through the
Figure 3: The confusing Cloud Prepay warning in Google AI Studio, which applies only to direct Gemini API endpoints, not Vertex AI.
Here is what I changed, plus one safeguard I recommend:
Because this was an honest first-time configuration mistake by a verified Google Developer Program member, I decided to contact Google Cloud Billing Support to request a courtesy adjustment.
Navigating to a human agent can be tricky through automated support bots. Here is the exact path that worked:
The Culprit: Context Window Loops on Heavy Models
Gemini 4 Argon—a flagship heavy-reasoning model available on Vertex AI.
Here is a simplified, illustrative example (not my exact measurements) of how the context grows on every turn of an agentic debugging session:
| Turn | What gets sent to the model | Approx. input tokens |
|---|---|---|
| 1 | System prompt + 2 files | ~25,000 |
| 2 | Turn 1 history + error stack trace + tool output | ~45,000 |
| 3 | Turns 1–2 history + 3 more files read | ~110,000 |
| 4 | Cumulative context + compiler failures | ~220,000 |
| 5 | Full project snapshot re-evaluated | ~310,000+ |
Gemini 4 Argon, raw charges accumulated to IDR 40,800 on a single model run, culminating in a daily raw spend of IDR 301,839.
Model Tiering Matters in Agentic Coding
Flagship models (
Gemini 4 Argon, Claude Opus) are designed for architectural reviews and deep reasoning. Running them inside autonomous agentic loops where context windows expand uncontrollably will drain developer credits in a matter of hours.
Zoom
The Billing Trap: The Two-Account Mix-Up
Firebase One(Primary Account): Contained my active Developer Program credit batch of IDR 181,835 with rolling validity through April 7, 2027.Firebase Two(Secondary Account): An older billing account with IDR 0 in credits, linked directly to my personal debit card.
SnipGeek) on Google Cloud Console, it had automatically defaulted to Firebase Two.
Google Cloud tracks billing strictly at the project-to-billing-account link level. Because promotional credits attached to Firebase One cannot retroactively cross over to cover usage on Firebase Two, every token generated by OpenCode was billed directly to my secondary account.

Zoom
Architectural Clarity: AI Studio Prepay vs Vertex AI Postpay
aistudio.google.com). The dashboard flashed a persistent warning:
"A credit balance above $0 is required to resume service. Eligible GCP credits will automatically apply to usage first."This led me to believe my credits were broken. In reality, Gemini can be reached through two different Google products, and the warning only applies to one of them:
| Google AI Studio | Vertex AI (Google Cloud) | |
|---|---|---|
| Endpoint | generativelanguage.googleapis.com | aiplatform.googleapis.com |
| Key prefix I saw | AIzaSy... | AQ. |
| Billing check | Requires a balance above $0 | Uses your Cloud Billing account |
| Used by OpenCode | No | Yes (google-vertex) |
google-vertex provider, the AI Studio warning was a red herring. My developer credits worked fine in Google Cloud; the project was simply attached to the wrong billing account. Once I moved it, Vertex AI usage on Firebase One was fully offset by the credits.

Zoom
4 Steps to Fix It and Prevent a Repeat
1
Re-Link Project to the Credited Billing Account
Open Google Cloud Console - My Projects Billing. Locate your project (SnipGeek), click the three vertical dots (⋮), select Change billing, and switch it to your primary billing account (Firebase One).2
Confirm Zero Active Projects on Secondary Accounts
Inspect the old billing account (Firebase Two) and make sure it has no active projects attached. With no projects linked, no new charges can accrue on it.3
Lock OpenCode to Cost-Effective Flash Models
Switch your default coding model from flagship tiers to lightweight ones:google-vertex/gemini-3.8-flash: a fast, capable daily driver that costs far less than flagship models.google-vertex/gemini-4-hydrogen: the lightest option, good for quick refactors.
4
Set Up Budget Alerts (Recommended)
In Cloud Console, open Billing > Budgets & alerts forFirebase One and create a budget of around IDR 150,000 with email alerts at 50%, 80%, and 100%. This catches a runaway session before the credits run out and your card is charged.Requesting a One-Time Courtesy Waiver from Google Support
- Open the Google Cloud Support Console while viewing the affected project.
- Under the left navigation, select Billing support (or click Cases > Create Case).
- Click Get billing support to launch the Billing Assistant widget.
- When the AI bot provides a generic policy explanation, explicitly prompt:
"Yes, please connect me to a support rep to assist me with this." - In the 140-character details box, summarize the issue cleanly:
"One-time courtesy waiver request for accidental IDR 150K charges on Firebase Two due to setup mistake. Google Dev Program member."
The Result: A 75% Courtesy Adjustment Approved
I was connected to a live support representative named Emman. After reviewing the steps I had already taken (re-linking the project, confirming the old account had no projects, and switching to cheaper models), Emman documented the case and submitted an official request for a one-time courtesy goodwill adjustment. Within two days of our chat, the internal billing team completed their review and approved a one-time courtesy credit of IDR 113,193 (about 75% of the invoice), leaving a remaining balance of IDR 46,887 (~$2.90 USD) on the secondary account. It was not the full waiver I asked for, but Emman said the request had been advocated for as strongly as possible, and I was happy to take it:Case Number: 77705774
Net Invoice (After Google's Discounts): IDR 150,924.00
Approved Courtesy Adjustment: -IDR 113,193.00 (~75%)
Remaining Balance: IDR 46,887.00 (~$2.90 USD)
Status: Approved (final outcome of the review)Figure 4: Navigating to Google Cloud Billing Support and receiving live chat confirmation from Emman (Case 77705774).
What Helped My Case
Emman's first follow-up question was what I had already done to stop further charges. Arriving with a clear root cause and concrete fixes made the request much easier to advocate for. Approval is never guaranteed, though: I got about 75%, not the full amount.
Key Takeaways
- Autonomous coding agents burn tokens exponentially: Always start a new chat session after resolving a bug to prevent historical error traces from inflating subsequent prompt costs.
- Default to Flash models: Keep
gemini-3.8-flashorgemini-4-hydrogenas your daily driver. ReserveArgonorOpusfor deliberate, high-leverage architectural prompts. - Double-check project billing associations: Never assume a new GCP project inherits the billing account of your developer perks. Always verify the link in
Billing > Projects. - Be polite and structured when disputing charges: If you experience an accidental charge, document your mitigation steps immediately and reach out to support. Google Cloud's billing team is remarkably understanding when approached professionally.
Topics
Topics in this article
Explore related topics and continue reading similar content.
Share this article
Discussion
Preparing the comments area...