Gemini handles five PagibleAI actions by default: writing, file descriptions, image generation, inpainting and repainting. Map the key only to the actions you plan to use.
Configure Google Gemini for PagibleAI
Get a Gemini API key
- Sign in to Google AI Studio.
- Open the API keys section and select or import the Google Cloud project for this site.
- Create a key and copy it to your deployment secret store.
- Check the restrictions in the current Gemini API key guide.
Google now issues authorization keys in AI Studio. If you still use a standard key, apply the restrictions described in the guide. Keep every key out of CMS content, browser code, logs and source control.
Add the key to PagibleAI
PagibleAI does not read GEMINI_API_KEY directly. Use it as an alias for each Gemini action you enable:
GEMINI_API_KEY="..."
CMS_AI_WRITE_API_KEY="${GEMINI_API_KEY}"
CMS_AI_DESCRIBE_API_KEY="${GEMINI_API_KEY}"
CMS_AI_IMAGINE_API_KEY="${GEMINI_API_KEY}"
CMS_AI_INPAINT_API_KEY="${GEMINI_API_KEY}"
CMS_AI_REPAINT_API_KEY="${GEMINI_API_KEY}"
Run the command below after editing .env. Then restart Octane, queue workers and any other long-running PHP processes.
php artisan config:clear
Test Gemini
Open a draft page and generate one short paragraph. Next, try one enabled media action with a disposable image. The text or image should appear in the draft editor. If PagibleAI shows No API key, 401 or 403, use the answers below.
Troubleshooting
Why does PagibleAI say “No API key”?
The relevant CMS_AI_*_API_KEY variable is empty. Map it to GEMINI_API_KEY, run php artisan config:clear and restart long-running PHP processes.
Why does Google return 401 or 403?
Check the key's project, status and restrictions in Google AI Studio. Replace a blocked or exposed key.
Why does Google return 429?
The project has reached a request or token limit. Check usage and billing in Google AI Studio, then wait for the limit to reset or change the billing tier.
What if the key was exposed?
Create and deploy a replacement. Disable the old key after the new one works, then check usage for requests you do not recognize.