# FLUX.1 Kontext [Max]

**方法**: `POST`
**路径**: `/fal-ai/flux-pro/kontext/max`

提示词，对图片进行的编辑描述。例如：'把甜甜圈放在面粉旁边'

## 请求参数

### Header 参数

```text
Content-Type
string
可选
示例:
application/json
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
prompt
string
必需
提示词，对图片进行的编辑描述。例如：'把甜甜圈放在面粉旁边'
示例:
Put a donut next to the flour.
seed
integer
可选
随机种子，保证同样输入下生成一致的图片。可选
guidance_scale
number
可选
CFG 值，控制模型对prompt的遵循度，默认 3.5，可选，范围1-20。
默认值:
3.5
sync_mode
boolean
可选
同步模式，true时等待图片生成完成并直接返回图片，false时通过CDN获取图片。默认 false
默认值:
false
num_images
integer
可选
生成图片数量，取值1-4，默认1
>= 1
<= 4
默认值:
1
safety_tolerance
enum<string>
可选
安全容忍等级，1最严格，6最宽松，默认2
枚举值:
1
2
3
4
5
6
默认值:
2
output_format
enum<string>
可选
图片格式，jpeg 或 png，默认 jpeg
枚举值:
jpeg
png
默认值:
jpeg
aspect_ratio
string
可选
图片宽高比，可选如：21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21
image_url
string
必需
要编辑的图片URL，必填，建议使用公开可访问的图片链接
示例:
https://v3.fal.media/files/rabbit/rmgBxhwGYb2d3pl3x9sKf_output.png
示例
{
"prompt"
:
"Put a donut next to the flour."
,
"seed"
:
0
,
"guidance_scale"
:
3.5
,
"sync_mode"
:
false
,
"num_images"
:
1
,
"safety_tolerance"
:
"2"
,
"output_format"
:
"jpeg"
,
"aspect_ratio"
:
"string"
,
"image_url"
:
"https://v3.fal.media/files/rabbit/rmgBxhwGYb2d3pl3x9sKf_output.png"
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/fal-ai/flux-pro/kontext/max' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "Put a donut next to the flour.",
    "seed": 0,
    "guidance_scale": 3.5,
    "sync_mode": false,
    "num_images": 1,
    "safety_tolerance": "2",
    "output_format": "jpeg",
    "aspect_ratio": "string",
    "image_url": "https://v3.fal.media/files/rabbit/rmgBxhwGYb2d3pl3x9sKf_output.png"
}'
```

## 返回响应

### 🟢 200 成功

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

#### 响应结构

```text
status
string
必需
request_id
string
必需
response_url
string
必需
status_url
string
必需
cancel_url
string
必需
queue_position
integer
必需
```

#### 示例

```json
{
    "status": "IN_QUEUE",
    "request_id": "551a32da-52b2-4be8-bf2f-bfb7cce2b324",
    "response_url": "https://queue.fal.run/fal-ai/flux-1/requests/551a32da-52b2-4be8-bf2f-bfb7cce2b324",
    "status_url": "https://queue.fal.run/fal-ai/flux-1/requests/551a32da-52b2-4be8-bf2f-bfb7cce2b324/status",
    "cancel_url": "https://queue.fal.run/fal-ai/flux-1/requests/551a32da-52b2-4be8-bf2f-bfb7cce2b324/cancel",
    "queue_position": 0
}
```
