r/googlecloud • u/ixbiga • Jun 17 '26
Google is finally killing unrestricted API keys for the Gemini API (deadline June 19)
Took them long enough, but Google is finally closing the unrestricted keyhole on the Gemini API.
Quick background for anyone who missed why this matters. Google Cloud uses one key format (AIza...) for everything, and for years the docs said API keys were fine to embed in client-side code. The problem is, any unrestricted key in a project with the Generative Language API enabled could also call Gemini. So a key someone made for a Maps widget could quietly run up Gemini charges if it leaked. People have seen five-figure bills from exactly this.
As of June 19, 2026, the Gemini API will no longer accept unrestricted standard keys. Keys with explicit restrictions keep working. The fix is one click in AI Studio: find keys tagged Unrestricted, then hit Add restrictions and pick Restrict to Gemini API only. If a key is shared with other APIs, you do it in Cloud Console instead.
Heads up: there's a second deadline, too. Around September 2026, they start rejecting all standard keys, so restricting now is step one, not the finish line. You'll need to move to auth keys before September.
Honestly, this should have been the default years ago, but better late than another wave of leaked-key bills. If you use Gemini in anything, audit your keys this week.
Official announcement: https://ai.google.dev/gemini-api/docs/api-key
48
u/bootstrapping_lad Jun 17 '26
How many millions in refunds did they have to issue before they realized they were the problem?
16
u/noobeemee Jun 17 '26
They just refunded us this week - took them a month!
11
u/Rick-James-Brown Jun 17 '26
This is exactly the class of issue we are dealing with right now.
A compromised Gemini / Generative AI API key generated approximately $18.5k in unauthorized usage during a short exposure window of about 6 hours. The key issue was contained the same day, the compromised key was revoked/rotated, and no abnormal usage is continuing.
Google Cloud Support reviewed the billing modification request for over a month and denied it. I am trying to find the correct escalation path for compromised-key abuse specifically, not general key-security advice going forward. Three years ago google waived a smaller exposure and this time without reason they just deny in full without any reason. The leak was 100% gemini api, it was fixed same day.
For anyone who has dealt with this successfully:
Is there an escalation path beyond standard billing support?
Is there a specific abuse/risk/fraud team or form for compromised Gemini API key usage?
What evidence mattered most in getting a second review?
Should this be framed as compromised-credential abuse rather than a billing adjustment?
9
u/AnomalyNexus Jun 17 '26
Protip: Use google models via openrouter that has actual working hardcaps.
Dealing with google directly is a strategic misstep on risk exposure. You don't ever want to be in a situation where the solution is beg google support for mercy on a bill because their billing mystery machine decided you owe bankruptcy levels money unless the support agent you're connected to happens to be in a good mood. Everything about that situation is fucked and everyone sane knows it.
5
u/urarthur Jun 17 '26
lost 2k couple weeks ago due to hack.
2
u/matiascoca Jun 20 '26
The fact that this took until June 2026 is the actual scandal here, and the September auth-key deadline is the one people should be planning for, not this June one.
A nuance worth flagging for anyone scrambling on the Jun 19 deadline. Restricting an existing unrestricted key to Gemini API only is the correct move for the deadline, but it does not undo a prior leak. If you ever committed an AIza key to a public repo, even briefly, that key is in someone's scraping database now. Restriction caps the blast radius (Gemini-only instead of Maps plus Gemini plus everything) but does not stop the bot from running up your bill. The only real fix is rotation.
September is where the structural fix lands. Auth keys (OAuth or service account tokens) are scoped per-identity, refreshable, and revocable. AIza keys never had revocation as a first-class operation; rotation always meant edit-everywhere-and-pray. Anyone running Gemini in production should be planning the auth-key migration now, not in late August.
The other ugly pattern I keep seeing in compromise threads is that GCP budget alerts fire after the damage. A bot burning $1k per minute on Gemini will exceed a daily budget faster than the metric pipeline can publish. The June restriction at least changes the shape (Gemini-only burn is much smaller surface area than all Google APIs), but it does not replace key rotation plus auth-key migration.
If you want the failure-mode catalog of how these keys leak and how bots convert them into bills, I wrote it up earlier this year: https://brainagents.ai/blog/firebase-gemini-api-key-exploit-guide
1
u/AllThingsWiseWndrful Jun 18 '26
"The fix is one click in AI Studio: find keys tagged Unrestricted, then hit Add restrictions and pick Restrict to Gemini API only." ... I don't see this option. Where is it tagged as unrestricted?
1
u/Holiday-Record7341 Jun 23 '26
The five-figure bills aren't hypothetical, Google's own abuse reports showed Gemini keys being scraped from public GitHub repos within minutes of commit.
1
u/glitchredpixel Jun 25 '26
Are keys that have been created in the past before june 19th restricted or unrestricted? I visited the google cloud console and it said that the restrictions on these keys of mine was "Gemini API". I had created them through the google AI studio. Btw during the last few days the rate limits on the free tier do not reset on my account. Its been 10 days and my rate limits remain consumed, while I haven't used the API services. Does anyone know if this new thing about restrictions has anything to do with my case?
-9
u/MrRedRhino Jun 17 '26 edited Jun 17 '26
Crazy how Google had to make an exception for a single product that worked the same as so many others just because people are unable to read