# gemini-3-pro-image (nano banana Pro)

This document introduces the input and output parameters for the API of the `gemini-3-pro-image-preview` (Model ID: `gemini-3-pro-image-preview`) model. Use this for reference when utilizing the API.

---

Only some of the fields used are displayed below. For detailed explanations, please refer to the official documentation [New Features in Gemini 3 Pro Image](https://ai.google.dev/gemini-api/docs/image-generation?hl=en#gemini-3-capabilities).

## Request Parameters

### Request Body

| Field Name                                | Type   | Required | Default Value      | Description                                                                                 |
| ----------------------------------------- | ------ | -------- | ------------------ | ------------------------------------------------------------------------------------------- |
| contents                                  | array  | Required | -                  | The requested content, containing one or more parts.                                        |
| contents.role                             | string | Required | "user"             | The role of the content, fixed as "user" here.                                              |
| contents.parts                            | array  | Required | -                  | Specific parts of the content.                                                              |
| contents.parts.text                       | string | Optional | -                  | Prompt text.                                                                                |
| generationConfig                          | object | Optional | -                  | Generation configuration.                                                                   |
| generationConfig.responseModalities       | array  | Optional | ["TEXT", "IMAGE"]  | Desired response forms, either text or image.                                               |
| generationConfig.imageConfig              | object | Optional | -                  | Image generation configuration.                                                             |
| generationConfig.imageConfig.aspectRatio  | string | Optional | "1:1"              | Image aspect ratio. Supports "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9". |
| generationConfig.imageConfig.imageSize    | string | Optional | "1K"               | Image resolution. Supports "1K", "2K", "4K".                                                |

## Response Parameters

| Field Name                                  | Type     | Description                               |
| ------------------------------------------- | -------- | ----------------------------------------- |
| candidates                                  | `array`  | List of returned candidate content.       |
| candidates.content                          | `object` | Candidate content.                        |
| candidates.content.parts                    | `array`  | Specific parts of content, may contain text and image data. |
| candidates.content.parts.text               | `string` | Text description returned by the model.   |
| candidates.content.parts.inlineData         | `object` | Inline image data.                        |
| candidates.content.parts.inlineData.data    | `string` | Base64-encoded image data.                |
| candidates.content.parts.inlineData.mimeType| `string` | MIME type of data, e.g., "image/png".     |
| candidates.finishReason                     | `string` | Reason for generation ending, e.g., "STOP". |
| usageMetadata                               | `object` | Metadata on token usage.                  |
| error                                       | `Object` | Error information object.                 |

## Examples

### Gemini Compatible Interface

`POST https://api-us-ca.umodelverse.ai/v1beta/models/gemini-3-pro-image-preview:generateContent`

#### Image Generation (Text to Image)

> ⚠️ Note: You must include responseModalities: ["TEXT", "IMAGE"] in the configuration.

<!-- tabs:start -->

##### ** curl **

```bash
curl -s -X POST \
  "https://api-us-ca.umodelverse.ai/v1beta/models/gemini-3-pro-image-preview:generateContent" \
  -H "x-goog-api-key: $MODELVERSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English."}]}],
    "tools": [{"google_search": {}}],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"],
      "imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}
    }
  }' | jq -r '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | head -1 | base64 --decode > butterfly.png
```

##### ** python **

```python
from google import genai
from google.genai import types
import os

client = genai.Client(
    api_key=os.getenv("MODELVERSE_API_KEY", "<MODELVERSE_API_KEY>"),  # Your API_KEY
    http_options=types.HttpOptions(
        base_url="https://api-us-ca.umodelverse.ai"
    ),
)

prompt = "Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English."
aspect_ratio = "1:1"  # "1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"
resolution = "1K"  # "1K", "2K", "4K"

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=prompt,
    config=types.GenerateContentConfig(
        response_modalities=["TEXT", "IMAGE"],
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio, image_size=resolution
        ),
    ),
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif image := part.as_image():
        image.save("butterfly.png")
```

<!-- tabs:end -->

### Response Example

```json
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Here is the anatomical sketch of a dissected Monarch butterfly in Da Vinci style..."
          },
          {
            "inlineData": {
              "data": "iVBORw0KGgoAAAANSUhEUgAA...",
              "mimeType": "image/png"
            }
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "candidatesTokenCount": 1315,
    "totalTokenCount": 1331
  }
}
```

```json
{
  "error": {
    "message": "error_message",
    "type": "error_type",
    "param": "request_id",
    "code": "error_code"
  }
}
```