> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixroute.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 3 Pro Image Preview

> Gemini 3 Pro Image Preview: 画像生成モデル。MixRouteでのリクエスト例とパラメータ。

Gemini 3 Pro Image Previewは、以下で説明するネイティブ画像APIを通じて利用できます。

ネイティブのGemini Content/Part構造を使用します。IMAGE出力をリクエストし、レスポンスをテキストのみのチャット補完として扱うのではなく、返された画像パートを読み取ってください。

<Tip>
  [ネイティブ画像パラメータ](/ja/api-reference/endpoint/nano-banana) | [ストリーミングレスポンス](/ja/api-reference/endpoint/nano-banana-stream)
</Tip>

`POST https://api.mixroute.ai/v1/models/gemini-3-pro-image-preview:generateContent`

## 例

環境変数`MIXROUTE_API_KEY`にMixRouteのキーを設定してください。リクエストは`Authorization: Bearer ...`を使用します。編集前に、元画像のプレースホルダーをアクセス可能な画像またはローカルファイルに置き換えてください。

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/models/gemini-3-pro-image-preview:generateContent" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "A clean product photograph of a red ceramic mug on a white background."
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    }
  }
}'
```

### Python

```python theme={null}
import json
import os
import requests

payload = json.loads(r'''
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "A clean product photograph of a red ceramic mug on a white background."
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "1:1",
      "imageSize": "1K"
    }
  }
}
''')
response = requests.post(
    "https://api.mixroute.ai/v1/models/gemini-3-pro-image-preview:generateContent",
    headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
    json=payload,
    timeout=180,
)
response.raise_for_status()
result = response.json()
import base64
from pathlib import Path

image_index = 0
for candidate in result.get("candidates", []):
    for part in candidate.get("content", {}).get("parts", []):
        if part.get("thought"):
            continue
        inline = part.get("inlineData")
        if inline and inline.get("data"):
            extension = {"image/png": "png", "image/jpeg": "jpg", "image/webp": "webp"}.get(inline.get("mimeType"), "bin")
            Path(f"image_{image_index}.{extension}").write_bytes(base64.b64decode(inline["data"]))
            image_index += 1
        elif "text" in part:
            print(part["text"])
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.