Gemini Image connector

Generate, edit, and combine images with Google Gemini and Imagen models.

On this page

The geminiimage connector uses Google AI Studio image models. Your workflow can create an image from a text prompt, edit an existing image with instructions, or combine several images into one.

Prerequisites

  • A Google AI Studio API key with access to the image models you want to use.
  • For editing and combining: the source images as base64 text. A data URL prefix is accepted.
  • The project_contributor role or higher in your workspace, which lets you manage connections and MCP instances. See Roles and permissions.

Connect in AgentRuntime

  1. Create a Google AI Studio API key

    Go to aistudio.google.com/apikey, create an API key, and copy it.

  2. Add the connector to your workspace

    Click MCP in the sidebar, then Add connectors. Find Gemini Image in the App catalog, select it, and click Add to workspace. The instance now appears on the MCP connectors page. See MCP instances.

  3. Add your credentials to a profile

    Open the new instance to reach Instance config. Under Profiles for this connector, click New profile, enter a Display name, and on the Type secrets on this screen tab fill in api_key (your AI Studio key) and, optionally, default_model. Set Status to Active — can be used in workflows and click Save. Then click Use this profile for workflows.

  4. Test it

    In Workflow Studio, add the gemini_image_text_to_image tool from your Gemini Image instance (use Browse platform MCP if it is not listed), fill in its arguments, and run the workflow. A successful step means the connection works. A short prompt is enough.

Note

To reuse the same credentials in more than one profile, save them first under Connections → New custom connection, using the exact key names from Configuration, then choose Use a saved connection on the profile instead.

What you can build

  • Brand assets. gemini_image_text_to_image with an Imagen model and an aspect_ratio makes ad and social images.
  • Photo edits. gemini_image_edit_image takes a product photo and an instruction such as "remove the background".
  • Collages. gemini_image_compose_images combines several reference images using a prompt.
  • Illustrated reports. An LLM writes a caption, an image tool creates the picture, and a later step adds both to a document.

Tools

The Required arguments column lists the fields the tool's input schema marks as required. Some of them are optional in practice; if you have nothing to set, pass an empty value such as "", [], {}, or false.

Editing and composing work with Gemini image models only (gemini-2.5-flash-image or gemini-3-pro-image-preview). Imagen models (imagen-4-*, imagen-3-*) work for text-to-image only, and are the only ones that use number_of_images, aspect_ratio, and negative_prompt.

ToolAccessWhat it doesRequired arguments
gemini_image_compose_imagesWriteCompose one or more base64-encoded input images using a text prompt and Gemini generateContent.prompt, images
gemini_image_edit_imageWriteEdit a base64-encoded image using a text prompt and Gemini multimodal generateContent.prompt, image_base64
gemini_image_text_to_imageWriteGenerate an image from a text prompt using Gemini or Imagen image models.prompt

Example

Generate a square image with an Imagen model.

{
  "id": "gemini-image",
  "type": "mcp",
  "name": "Generate product image",
  "tool_name": "gemini_image_text_to_image",
  "tool_args": {
    "prompt": "Minimal flat illustration of a cloud workflow, blue and white",
    "model": "imagen-4.0-generate-001",
    "aspect_ratio": "1:1",
    "number_of_images": 1
  },
  "timeout_s": 120
}

Configuration

KeyRequiredDescription
api_keyYesGoogle AI Studio API key.
default_modelNoModel used when a tool call omits model. Default gemini-2.5-flash-image.
api_baseNoGemini API base URL. Default https://generativelanguage.googleapis.com/v1beta.

Troubleshooting

ProblemWhat to do
An Imagen model is rejected on edit or composeUse gemini-2.5-flash-image or gemini-3-pro-image-preview for gemini_image_edit_image and gemini_image_compose_images.
aspect_ratio has no effectIt only applies to Imagen models. It is ignored for Gemini models.
Quota or permission errorsCheck the key's access to the model and your quota in Google AI Studio.
No image comes backCheck text_response in the result for an explanation, then simplify the prompt and confirm the model name.
Edit this pageagentruntime-io/agentruntime-docs