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

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

url 或 b64\_json

## 请求参数

### 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
1:4
4:1
8:1
1:8
response_format
string
可选
url 或 b64_json
image
array
[string]
可选
参考图数组，url 或 b64_json
image_size
enum<string>
可选
仅 nano-banana-2 支持
枚举值:
1K
2K
4K
512px
示例
{
"prompt"
:
"cat"
,
"model"
:
"gemini-3.1-flash-image-preview"
}
```

## 请求示例代码

### 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": "gemini-3.1-flash-image-preview"
}'
```

## 返回响应

### 🟢 200 成功

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

#### 响应结构

```text
object
```

#### 示例

```json
{}
```
