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

# Gemini 图片编辑

> 通过 OpenAI Images API 使用 Gemini / Nano Banana 图片编辑能力

> 更新日期：2026-06-06

# Gemini 图片编辑

```
POST /v1/images/generations
```

Gemini / Nano Banana 图片编辑在 Crazyrouter 上统一走 OpenAI Images 兼容入口。用户只需要传 `image_input` URL 和统一参数，服务端会处理 Gemini / Vertex 原生格式转换。

<Warning>
  图片编辑、多参考图这类请求通常耗时较长。生产接入请优先使用主承接线路 `https://api.crazyrouter.com/v1`，完整端点为 `https://api.crazyrouter.com/v1/images/generations`。
</Warning>

***

## 当前建议

1. 新接入优先使用 `nano-banana-2` 或 `nano-banana-pro`
2. 图片输入使用 `image_input`，传 URL 或 URL 数组
3. 不要传 Gemini 原生字段，例如 `generationConfig`、`imageConfig`、`imageOutputOptions`
4. 客户端超时建议设置为 180 秒以上

***

## 请求模板

下面是通过统一 Images API 做参考图编辑的最小请求：

```bash theme={null}
curl -X POST https://api.crazyrouter.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "nano-banana-2",
    "prompt": "把参考图背景改成蓝色，保留主体结构和边缘细节",
    "image_input": [
      "https://example.com/reference.png"
    ],
    "resolution": "1K",
    "aspect_ratio": "1:1",
    "output_format": "png"
  }'
```
