Skip to content
EN

FLUX.1 [Dev] 图片生成图片

方法: POST路径: /fal-ai/flux-1/dev/image-to-image

原始图片的公网 URL。(必填)

请求参数

Header 参数

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

Body 参数 application/json

text
image_url
string
必需
原始图片的公网 URL。(必填)
示例:
https://fal.media/files/koala/Chls9L2ZnvuipUTEwlnJC.png
prompt
string
必需
文本提示,用于描述需要生成哪种风格或内容(必填)
示例:
a cat dressed as a wizard with a background of a mystic forest.
strength
number
可选
初始图片风格保留程度,越高保留越多(默认0.95,推荐)
>= 0.01
<= 1
默认值:
0.95
num_inference_steps
integer
可选
生成采样步数,步数越多,图片质量可能越高但速度更慢(默认40)
>= 10
<= 50
默认值:
40
guidance_scale
number
可选
控制生成图片与 prompt 的契合程度,数值越高越接近prompt(默认3.5)
>= 1
<= 20
默认值:
3.5
seed
integer
|
null
可选
随机种子 — 用于结果复现,同样参数和 seed 会得到一致结果。可为空
sync_mode
boolean
可选
是否启用同步模式。如果为 true,接口会等待图片生成完毕后返回。建议异步(false)
默认值:
false
num_images
integer
可选
要生成的图片数量(默认1张,最多4张)
>= 1
<= 4
默认值:
1
enable_safety_checker
boolean
可选
是否启用安全检测,过滤不安全内容(默认true)
默认值:
true
示例
{
"image_url"
:
"https://fal.media/files/koala/Chls9L2ZnvuipUTEwlnJC.png"
,
"prompt"
:
"a cat dressed as a wizard with a background of a mystic forest."
,
"strength"
:
0.95
,
"num_inference_steps"
:
40
,
"guidance_scale"
:
3.5
,
"seed"
:
0
,
"sync_mode"
:
false
,
"num_images"
:
1
,
"enable_safety_checker"
:
true
}

请求示例代码

Shell

bash
curl --location --request POST '/fal-ai/flux-1/dev/image-to-image' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "image_url": "https://fal.media/files/koala/Chls9L2ZnvuipUTEwlnJC.png",
    "prompt": "a cat dressed as a wizard with a background of a mystic forest.",
    "strength": 0.95,
    "num_inference_steps": 40,
    "guidance_scale": 3.5,
    "seed": 0,
    "sync_mode": false,
    "num_images": 1,
    "enable_safety_checker": true
}'

返回响应

🟢 200 成功

内容类型: application/json

响应结构

text
object

示例

json
{}