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

# Gemini 2.5 Flash Image 参数

> 为 gemini-2.5-flash-image 构造不含 imageSize 的 Gemini 原生生成和编辑请求。

提示词和来源图片放在 `contents[].parts[]` 中；输出控制放在
`generationConfig` 中。这个模型最容易出错的地方是多传 `imageSize`。

| 项目                   | 当前规则                     |
| -------------------- | ------------------------ |
| 模型 ID                | `gemini-2.5-flash-image` |
| `imageSize`          | 必须省略                     |
| `aspectRatio`        | 可选；已实测 `1:1`             |
| `responseModalities` | 至少包含 `IMAGE`             |
| `candidateCount`     | 省略或设为 `1`                |
| YingTu 单次价格          | USD 0.020                |

```json theme={"system"}
{
  "contents": [{
    "role": "user",
    "parts": [{"text": "一张主体明确、留白克制的旅行海报"}]
  }],
  "generationConfig": {
    "responseModalities": ["TEXT", "IMAGE"],
    "imageConfig": {"aspectRatio": "1:1"}
  }
}
```

编辑图片时，把真实 MIME 和不带 data URL 前缀的 Base64 字节作为另一个 part：

```json theme={"system"}
{"inlineData": {"mimeType": "image/png", "data": "BASE64_SOURCE_IMAGE"}}
```

<Warning>不要发送顶层 `prompt`、`n`、`resolution`，也不要发送 `imageSize: "1K"`。</Warning>

本次实测返回 PNG，但客户端仍必须按 `inlineData.mimeType` 决定保存格式，并遍历
全部 parts 查找图片。
