Problem Summary:
My application (Selifu Studio) has been using the Gemini API successfully for months in production. A few days ago, after recent updates to Google Cloud / AI Studio, all API calls in production started returning 403 PERMISSION_DENIED errors.
Environment:
- Production: Google Cloud Run (us-west1)
- Development: Works perfectly with the same API key
- Billing: Active and confirmed
Error received:
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent: [403 Forbidden] PERMISSION_DENIED: Your API key does not have the required permissions.
What I’ve tried:
- Created a brand new project (gen-lang-client-0279643527) with billing linked
- Created a new API key with no restrictions in the new project
- Enabled the Generative Language API in the project
- Tested multiple models: gemini-2.5-flash, gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash - all return 403
- The same key works fine in AI Studio but NOT when called from Cloud Run
Question: Has something changed recently with how API keys work in Cloud Run environments? Could this be related to recent infrastructure changes at Google? Why does the same key work in AI Studio/development but not in Cloud Run production?
Any help would be greatly appreciated. This is blocking a production application.