# Generations 通用 (图生图&文生图)

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

如果支持参考图，例如 flux-kontext ，参考图url 放 prompt 中空格隔开

## 请求参数

### Header 参数

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

### Body 参数 application/json

```text
model
string
必需
prompt
string
必需
size
string
可选
最终会转换成比例，建议直接使用 aspect_ratio
aspect_ratio
string
可选
21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21
image
array
[string]
部分模型支持
可选
示例
{
"model"
:
"string"
,
"prompt"
:
"string"
,
"size"
:
"string"
,
"aspect_ratio"
:
"string"
,
"image"
:
[
"string"
]
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/v1/images/generations' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "string",
    "prompt": "string",
    "size": "string",
    "aspect_ratio": "string",
    "image": [
        "string"
    ]
}'
```

## 返回响应

### 🟢 200 成功

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

#### 响应结构

```text
object
```

#### 示例

```json
{}
```
