# Nano-banana(Generations，推荐对接)

**方法**: `POST`
**路径**: `/v1/images/generations`

Nano-banana 和 gemini-2.5-flash-image-preview 的区别
gemini-2.5-flash-image-preview 官方的api模型，没做任何处理，仅支持聊天接口，可能不会返回图片，返回的图片是 base64
nano-banana 我们基于 gemini-2.5-flash-image-preview 专门画图优化的api模型，支持 dalle 格式、返回url，失败不扣费，优化了支持设置图片比例
nano-banana-hd 是高清版4K画质

## 请求参数

### Header 参数

```text
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
model
string
必需
prompt
string
必需
aspect_ratio
enum<string>
可选
枚举值:
4:3
3:4
16:9
9:16
2:3
3:2
1:1
4:5
5:4
21:9
response_format
string
可选
url 或 b64_json
image
array
[string]
可选
参考图数组，url 或 b64_json
示例
{
"prompt"
:
"cat"
,
"model"
:
"nano-banana"
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/v1/images/generations' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "cat",
    "model": "nano-banana"
}'
```

## 返回响应

### 🟢 200 成功

**内容类型**: `application/json`

#### 响应结构

```text
object
```

#### 示例

```json
{}
```
