# Gemini Images (Nano Banana) (/docs/integrations/gemini-images)

Generate and edit images with Gemini's Nano Banana models. Start with the [runnable example](https://github.com/basementstudio/xmcp/tree/main/examples/gemini-images-http).

## Configure access

Create an API key in [Google AI Studio](https://aistudio.google.com/apikey). The default model is `gemini-nano-banana-2.1`; set `GEMINI_IMAGE_MODEL` to use another, such as `gemini-3-pro-image`.

```bash
GEMINI_API_KEY=your-provider-credential
MCP_API_KEY=your-separate-client-secret
```

MCP clients send `MCP_API_KEY` as `x-api-key` on every request, compared in constant time. The server is stateless: it keeps no sessions and no job records. The server calls the Gemini Interactions API at `https://generativelanguage.googleapis.com/v1beta/interactions` with the `x-goog-api-key` header. Requests are never retried, because a retry would bill a new image. All authorized MCP clients share the same provider account and its credits.

## Available tools

| Tool             | Purpose                                             |
| ---------------- | --------------------------------------------------- |
| `generate-image` | Generate an image from a prompt.                    |
| `edit-image`     | Edit or combine up to 4 images sent as base64 data. |

## Results

The tool returns each image inline as MCP image content, with a JSON summary first.

Images come back in the response, so there are no jobs. Source images for `edit-image` are sent inline as base64, up to about 5 MB each, because this server never downloads client-supplied URLs. The example raises xmcp's request body limit to 30 MB to fit four of them. The server waits up to two minutes for an image. If Gemini declines a prompt and returns no image, the tool returns an error.

## Run the example

Follow the [example README](https://github.com/basementstudio/xmcp/tree/main/examples/gemini-images-http#run-locally) for installation and startup. Its tests replace every provider request with a local fake, so they need no credentials.

Tested against the Gemini image generation guide on November 24, 2026.
