> ## 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

> Gemini 3 Pro Image：图片生成模型。包含 MixRoute 调用示例与参数。

Gemini 3 Pro Image 是 Google 推出的图片生成模型。

可通过 MixRoute 的 Gemini 原生端点调用 `gemini-3-pro-image`，同时支持 OpenAI 兼容端点。

## 核心能力

* 文生图 - 根据文本生成图片
* Gemini 原生 API - 使用 generateContent
* 图片输出 - 在 responseModalities 中请求 IMAGE
* 内容片段 - 使用 Gemini 多模态输入结构

## 输出规格

| 属性   | 取值                                              |
| ---- | ----------------------------------------------- |
| 端点   | `/v1/models/gemini-3-pro-image:generateContent` |
| 输出模态 | `IMAGE`                                         |
| 响应   | Gemini content parts 中的图片数据                     |

## 快速示例

### Gemini 原生 API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/models/gemini-3-pro-image:generateContent" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "contents": [
        {
          "parts": [
            {
              "text": "A minimal red circle centered on a white background"
            }
          ]
        }
      ],
      "generationConfig": {
        "responseModalities": [
          "TEXT",
          "IMAGE"
        ]
      }
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        "https://api.mixroute.ai/v1/models/gemini-3-pro-image:generateContent",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={'contents': [{'parts': [{'text': 'A minimal red circle centered on a white '
                                               'background'}]}],
              'generationConfig': {'responseModalities': ['TEXT', 'IMAGE']}},
    )

    print(response.json())
    ```
  </Tab>
</Tabs>

### OpenAI 兼容 API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/chat/completions" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gemini-3-pro-image",
      "messages": [
        {
          "role": "user",
          "content": "Explain quantum entanglement in simple terms."
        }
      ],
      "max_tokens": 256
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    response = client.chat.completions.create(
        model="gemini-3-pro-image",
        messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
        max_tokens=256,
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Streaming">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    stream = client.chat.completions.create(
        model="gemini-3-pro-image",
        messages=[{"role": "user", "content": "Write a short poem about the sea."}],
        max_tokens=256,
        stream=True,
    )

    for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")
    ```
  </Tab>
</Tabs>

## 参数

| 参数                                    | 类型     | 必填 | 说明                |
| ------------------------------------- | ------ | -- | ----------------- |
| `contents`                            | array  | 是  | 提示词与可选多模态内容片段。    |
| `generationConfig.responseModalities` | array  | 是  | 包含 IMAGE 以请求图片输出。 |
| `generationConfig`                    | object | 否  | 其他生成参数。           |
