Hi Everyone,
Starting June 19, 2026, the Gemini API will stop accepting requests from unrestricted API keys to prevent unauthorized usage and billing risks.
If your Google Cloud project has the Gemini API enabled and contains unrestricted keys, please restrict them immediately.
What to do:
- Option 1 (Restrict existing keys): Go to Google Cloud Credentials, select your key, and under API restrictions, restrict it to Gemini API (generativelanguage.googleapis.com).
- Option 2 (New keys): Generate new restricted keys in Google AI Studio and update your code.
Note: Keys generated directly in AI Studio are restricted to the Gemini API by default.