My AI Agent Secretly Charged Me NT$4,000 -- The Gemini Free Tier Billing Trap
"I thought it was free." -- Every developer who's ever received a Google Cloud bill
What Happened
On March 7, 2026, I received a budget alert from Google Cloud:
"Your billing account has reached 100% of its budget limit ($10 USD)."
Strange, I thought. All my Gemini API keys were generated from AI Studio -- they should be free, right?
I opened the billing dashboard --
| Item | Amount |
|---|---|
| Usage charges | $127.80 |
| Promotional credit | -$87.89 |
| Actual bill | $39.91 |
7 days. $127 burned. After deducting Google's free trial credits, I still owed $40 (roughly NT$1,260).
And the trend chart looked like this: $0 for the first 11 months, then a sudden spike to $40 in March.
What Was I Running?
I use OpenClaw to run 4 AI Agents that autonomously promote the brand:
- UltraLabTW -- Brand HQ CEO agent
- MindThreadBot -- Threads automation specialist
- UltraProbeBot -- AI security researcher
- UltraAdvisor -- Financial advisor
Daily workload:
| Task | Frequency/Day | Each calls Gemini |
|---|---|---|
| Auto-posting (Moltbook + Discord + Bluesky) | ~13 | Generate 2000-word content |
| Engagement replies (read posts -> generate replies) | ~148 | Read + context + generate |
| Daily reflection + strategy analysis | ~5 | Aggregate all memory files |
| Website scanning (UltraProbe) | ~3 | Read full HTML + analyze |
Looks like fewer than 200 calls per day -- well below the free tier's 1,500 RPD limit.
So where did the money go?
Trap #1: "Free" API Keys That Aren't Actually Free
Google Gemini has two usage modes:
| AI Studio Key | Google Cloud Key | |
|---|---|---|
| Source | aistudio.google.com | console.cloud.google.com |
| Free quota | 1,500 RPD, hard limit | No limit |
| Over quota | 429 rejection | Keeps running, charges everything |
| Billing | $0 | Pay-per-use |
The catch: Even if your key was generated from AI Studio, as long as the underlying Google Cloud project is linked to a billing account, you'll be charged.
My key's project was linked to a billing account.
Google Cloud doesn't charge during the free trial period (it uses credits), but once the trial expires, billing kicks in. My trial happened to expire on March 6, 2026.
So 12 months of $0 -> overnight it started burning money.
Trap #2: Thinking Tokens Are the Silent Killer
Gemini 2.5 Flash is a "thinking model" -- it "thinks" before responding. These thinking tokens are invisible to you, but you still pay for them.
| Token Type | Price/1M tokens | Relative Cost |
|---|---|---|
| Input | $0.075 | 1x |
| Output | $0.30 | 4x |
| Thinking | $3.50 | 47x |
Thinking tokens are 47x more expensive than input tokens.
A simple "read this post and write a reply" task can generate 10,000-50,000 thinking tokens. Across 148 engagement interactions, thinking alone consumes millions of tokens.
Trap #3: Error Retries x No Caching = Money Burning Loop
Digging through the logs, here's what happened in the early hours of March 6:
01:00:41 Generated -> ERROR: Moltbook post failed
01:01:06 Generated -> ERROR: Moltbook post failed
01:01:21 Generated -> ERROR: Moltbook post failed
01:01:41 Generated -> ERROR: Moltbook post failed
01:02:21 Generated -> ERROR: Moltbook post failed
01:02:41 Generated -> ERROR: Moltbook post failed
01:03:01 Generated -> ERROR: Moltbook post failed
Retrying every 20 seconds. Each retry called Gemini again to generate entirely new content.
Gemini's $3.50/1M thinking tokens kept burning. Not a single Moltbook post went through.
Money spent, nothing accomplished.
The Fix
1. Unlink Billing (Stop the Bleeding Immediately)
Google Cloud Console -> Billing -> Account Management -> Your project -> Unlink billing account.
This way, even if the key is still in use, going over quota will just return a 429 rejection -- no charges.
2. Verify All Keys Are on Free Tier
Go to the AI Studio API Keys page and confirm each key shows "Free tier", not "Set up billing".
3. Fix the Retry Logic
When a post fails, don't call the LLM again -- just retry the HTTP request with the same already-generated content.
You Might Be Affected Too
If any of the following apply to you, go check your Google Cloud billing right now:
- Used AI Studio but have a linked Google Cloud billing account
- Ever activated the Google Cloud free trial ($300 credits)
- Running any automated scripts that use the Gemini API
How to check: Google Cloud Console -> Billing -> Look for any billing account with an "Active" status.
Conclusion
| Problem | Lesson |
|---|---|
| Key linked to a billed project | Verify the project has no billing link when creating keys |
| Free trial expired | Set budget alerts, or just unlink billing entirely |
| Thinking tokens are 47x more expensive | Watch for hidden costs when using Gemini 2.5 Flash |
| Error retries without caching | Separate "generation" from "delivery" -- only retry delivery on failure |
My current status: 4 Agents still running fully automated, 44 calls per day, $0 on the bill.
The price: $40 in tuition.
If you're also running AI Agent automation, join our Discord to chat about saving money.
Want to check if your AI system has security vulnerabilities? Try UltraProbe -- free scan.
Originally published on Ultra Lab — we build AI products that run autonomously.
Try UltraProbe free — our AI security scanner checks your website for vulnerabilities in 30 seconds: ultralab.tw/probe
Top comments (0)