Prerequisites
- A Google AI Studio account with an API key
- Billing or quota enabled for Gemini image and/or Imagen models on your key
- For edit/compose: source images as base64 (data URL prefixes accepted)
- project_contributor access in AgentRuntime
Connect in AgentRuntime
Get a Google AI Studio API key
Create a key at aistudio.google.com/apikey. Enable the image models you plan to use.
Create a connection
Go to Connections and click New custom connection to create an API key connection with
APIKey. Set DefaultModel (e.g. gemini-2.5-flash-image) if desired.Add geminiimage MCP instance
Go to MCP, click Add instance for geminiimage, wire your connection on Instance config, set the profile active, and save.
gemini_edit_image and gemini_compose_images require Gemini image models. Imagen models (imagen-4-*, imagen-3-*) support text-to-image via predict but not edit/compose handlers.What you can build
- Brand assets —
gemini_text_to_imagewith Imagen aspect ratios for ads and social formats. - Photo retouching — Product photo base64 →
gemini_edit_imagewith “remove background” or style prompts. - Collage generation — Multiple reference images →
gemini_compose_imageswith layout instructions. - Multimodal reports — LLM writes caption → image tool → append to Google Slides or Docs.
Tools
| Tool | Description |
|---|---|
gemini_text_to_image | Generate from prompt (Gemini generateContent or Imagen predict) |
gemini_edit_image | Edit a base64 image with a text prompt (Gemini models only) |
gemini_compose_images | Combine multiple input images per prompt (Gemini models only) |
Example
Generate a square marketing image with Imagen:Configuration
| Key | Required | Description |
|---|---|---|
APIKey | Yes | Google AI Studio API key |
DefaultModel | No | Default when tools omit model (e.g. gemini-2.5-flash-image) |
APIBase | No | Gemini API base URL |
Troubleshooting
| Issue | Fix |
|---|---|
| Imagen rejected on edit | Use Gemini model for gemini_edit_image and gemini_compose_images |
| Empty image in response | Check safety filters; simplify prompt; verify model ID spelling |
| Wrong aspect ratio | Set aspect_ratio for Imagen; Gemini generateContent ignores Imagen-only fields |
| Quota errors | Review AI Studio quotas; reduce concurrent workflow image steps |
Related
- Integrations quickstart
- OpenAI Images connector — alternative image generation
- Connector catalog
- Troubleshooting