This nodejs proxy server lets you run your AI Studio Gemini application unmodified, without exposing your API key in the frontend code.
Prerequisites:
- Google Cloud SDK / gcloud CLI
- (Optional) Gemini API Key
-
Download or copy the files of your AI Studio app into this directory at the root level.
-
If your app calls the Gemini API, create a Secret for your API key:
echo -n "${GEMINI_API_KEY}" | gcloud secrets create gemini_api_key --data-file=- -
Deploy to Cloud Run (optionally including API key):
gcloud run deploy my-app --source=. --update-secrets=GEMINI_API_KEY=gemini_api_key:latest