官方文档:https://replicate.com/black-forest-labs/flux-fill-dev
POST
/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions创建任务 black-forest-labs/flux-fill-dev
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"input": {
"mask": "https://replicate.delivery/pbxt/M0hxLu8a1YBcybWuumSsfoEec8ooer6JZ2fR28vuM1U0CN9m/74b40bb1-364a-461a-bec5-200a38c7bc87.png",
"image": "https://replicate.delivery/pbxt/M0hxMJeO7wFCMr7QYNZsjRxzHhz6ntlLllMteRQNsRD7f3Nf/flux-fill-dev.webp",
"prompt": "a spaceship",
"guidance": 30,
"lora_scale": 1,
"megapixels": "1",
"num_outputs": 2,
"output_format": "webp",
"output_quality": 80,
"num_inference_steps": 28
}
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | Header | string | 否 | - | Bearer {{YOUR_API_KEY}} |
input | JSON body | object | 否 | - | - |
input.mask | JSON body | string | 否 | 一张黑白图像,用于描述需要修复的图像部分。黑色区域将被保留,白色区域将被修复。 | - |
input.image | JSON body | string | 是 | 待修复的图像。可包含 Alpha 蒙版。如果图像宽度或高度不是 32 的倍数,则会缩放至最接近的 32 倍数。如果图像尺寸超出 1440x1440 的范围,则会缩小以适应 1440x1440 的尺寸 | - |
input.prompt | JSON body | string | 是 | 提示生成图像。 | - |
input.guidance | JSON body | integer | 否 | 图像生成的引导信息。默认值:30。最小值:0,最大值:100。 | - |
input.lora_scale | JSON body | integer | 否 | 确定主 LoRA 的适用强度。对于基础推理,合理的结果介于 0 到 1 之间。对于 go_fast,我们对此值应用 1.5 倍乘数;通常情况下,将基础值按此倍数缩放时,性能会很好。您可能仍需要进行实验,以找到适合您特定 LoRA 的最佳值。默认值:1。最小值:-1,最大值:3。 | - |
input.megapixels | JSON body | string | 否 | 生成图像的近似像素数。使用 match_input 匹配输入的大小(上限为 1440x1440 像素),默认值:“1”。 | - |
input.num_outputs | JSON body | integer | 否 | 要生成的输出数量。默认值:1。最小值:1,最大值:4。 | - |
input.output_format | JSON body | string | 否 | 输出图像的格式。默认值:“webp”。 | - |
input.output_quality | JSON body | integer | 否 | 保存输出图像时的质量,范围为 0 至 100。100 为最佳质量,0 为最低质量。与 .png 输出无关。默认值:80 | - |
input.num_inference_steps | JSON body | integer | 否 | 去噪步数。建议范围为 28-50,步数越少,输出质量越低,但速度越快。默认值:28。最小值:1,最大值:50。 | - |
返回响应 (200)
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
id | 响应 JSON | string | 是 | - | - |
model | 响应 JSON | string | 是 | - | - |
version | 响应 JSON | string | 是 | - | - |
input | 响应 JSON | object | 是 | - | - |
input.aspect_ratio | 响应 JSON | string | 是 | - | - |
input.input_image | 响应 JSON | string | 是 | - | - |
input.output_format | 响应 JSON | string | 是 | - | - |
input.prompt | 响应 JSON | string | 是 | - | - |
input.prompt_upsampling | 响应 JSON | boolean | 是 | - | - |
input.safety_tolerance | 响应 JSON | integer | 是 | - | - |
logs | 响应 JSON | string | 是 | - | - |
output | 响应 JSON | null | 是 | - | - |
data_removed | 响应 JSON | boolean | 是 | - | - |
error | 响应 JSON | null | 是 | - | - |
status | 响应 JSON | string | 是 | - | - |
created_at | 响应 JSON | string | 是 | - | - |
urls | 响应 JSON | object | 是 | - | - |
urls.cancel | 响应 JSON | string | 是 | - | - |
urls.get | 响应 JSON | string | 是 | - | - |
urls.stream | 响应 JSON | string | 是 | - | - |
urls.web | 响应 JSON | string | 是 | - | - |
响应示例
{
"id": "tv3jnp73n1rmc0crb54b3srz94",
"model": "black-forest-labs/flux-fill-dev",
"version": "hidden",
"input": {
"guidance": 30,
"image": "https://replicate.delivery/pbxt/M0hxMJeO7wFCMr7QYNZsjRxzHhz6ntlLllMteRQNsRD7f3Nf/flux-fill-dev.webp",
"lora_scale": 1,
"mask": "https://replicate.delivery/pbxt/M0hxLu8a1YBcybWuumSsfoEec8ooer6JZ2fR28vuM1U0CN9m/74b40bb1-364a-461a-bec5-200a38c7bc87.png",
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a spaceship"
},
"logs": "",
"output": null,
"data_removed": false,
"error": null,
"status": "starting",
"created_at": "2025-07-30T03:03:25.864Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/tv3jnp73n1rmc0crb54b3srz94/cancel",
"get": "https://api.replicate.com/v1/predictions/tv3jnp73n1rmc0crb54b3srz94",
"stream": "https://stream.replicate.com/v1/files/bcwr-epcf2nmmvkvxq7trerel6zuoiwzyoji3ifhkuu3lf7rtdzh3i6ca",
"web": "https://replicate.com/p/tv3jnp73n1rmc0crb54b3srz94"
}
}来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 495899857,
"name": "创建任务 black-forest-labs/flux-fill-dev",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [
{
"type": "customScript",
"data": "// 将接口返回数据,封装成自己需要的结构\r\nvar resp = {\r\n response: pm.response.json().data[0].url\r\n}\r\n\r\n// html 模板字符\r\nvar template = `<html><img src=\"{{response}}\" /></html>`;\r\n\r\n// 设置 visualizer 数据。传模板、解析对象。\r\npm.visualizer.set(template, resp);",
"defaultEnable": true,
"enable": true,
"id": "mCVzgeqC6Ic49th7CPk1QO5xeyVoSikx"
}
],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档:https://replicate.com/black-forest-labs/flux-fill-dev",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"mask": {
"type": "string",
"description": "一张黑白图像,用于描述需要修复的图像部分。黑色区域将被保留,白色区域将被修复。"
},
"image": {
"type": "string",
"description": "待修复的图像。可包含 Alpha 蒙版。如果图像宽度或高度不是 32 的倍数,则会缩放至最接近的 32 倍数。如果图像尺寸超出 1440x1440 的范围,则会缩小以适应 1440x1440 的尺寸"
},
"prompt": {
"type": "string",
"description": "提示生成图像。"
},
"guidance": {
"type": "integer",
"description": "图像生成的引导信息。默认值:30。最小值:0,最大值:100。"
},
"lora_scale": {
"type": "integer",
"description": "确定主 LoRA 的适用强度。对于基础推理,合理的结果介于 0 到 1 之间。对于 go_fast,我们对此值应用 1.5 倍乘数;通常情况下,将基础值按此倍数缩放时,性能会很好。您可能仍需要进行实验,以找到适合您特定 LoRA 的最佳值。默认值:1。最小值:-1,最大值:3。"
},
"megapixels": {
"type": "string",
"description": "生成图像的近似像素数。使用 match_input 匹配输入的大小(上限为 1440x1440 像素),默认值:“1”。"
},
"num_outputs": {
"type": "integer",
"description": "要生成的输出数量。默认值:1。最小值:1,最大值:4。"
},
"output_format": {
"type": "string",
"description": "输出图像的格式。默认值:“webp”。"
},
"output_quality": {
"type": "integer",
"description": "保存输出图像时的质量,范围为 0 至 100。100 为最佳质量,0 为最低质量。与 .png 输出无关。默认值:80"
},
"num_inference_steps": {
"type": "integer",
"description": "去噪步数。建议范围为 28-50,步数越少,输出质量越低,但速度越快。默认值:28。最小值:1,最大值:50。"
}
},
"required": [
"image",
"prompt"
],
"x-apifox-orders": [
"mask",
"image",
"prompt",
"guidance",
"lora_scale",
"megapixels",
"num_outputs",
"output_format",
"output_quality",
"num_inference_steps"
]
}
},
"x-apifox-orders": [
"input"
]
},
"examples": [
{
"value": "{\n \"input\": {\n \"mask\": \"https://replicate.delivery/pbxt/M0hxLu8a1YBcybWuumSsfoEec8ooer6JZ2fR28vuM1U0CN9m/74b40bb1-364a-461a-bec5-200a38c7bc87.png\",\n \"image\": \"https://replicate.delivery/pbxt/M0hxMJeO7wFCMr7QYNZsjRxzHhz6ntlLllMteRQNsRD7f3Nf/flux-fill-dev.webp\",\n \"prompt\": \"a spaceship\",\n \"guidance\": 30,\n \"lora_scale\": 1,\n \"megapixels\": \"1\",\n \"num_outputs\": 2,\n \"output_format\": \"webp\",\n \"output_quality\": 80,\n \"num_inference_steps\": 28\n }\n }",
"mediaType": "application/json",
"description": ""
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [],
"cookie": [],
"header": [
{
"id": "GTujCrB2It",
"name": "Authorization",
"required": false,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "Bearer {{YOUR_API_KEY}}"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 174925600,
"name": "成功",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"model": {
"type": "string"
},
"version": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"aspect_ratio": {
"type": "string"
},
"input_image": {
"type": "string"
},
"output_format": {
"type": "string"
},
"prompt": {
"type": "string"
},
"prompt_upsampling": {
"type": "boolean"
},
"safety_tolerance": {
"type": "integer"
}
},
"required": [
"aspect_ratio",
"input_image",
"output_format",
"prompt",
"prompt_upsampling",
"safety_tolerance"
],
"x-apifox-orders": [
"aspect_ratio",
"input_image",
"output_format",
"prompt",
"prompt_upsampling",
"safety_tolerance"
]
},
"logs": {
"type": "string"
},
"output": {
"type": "null"
},
"data_removed": {
"type": "boolean"
},
"error": {
"type": "null"
},
"status": {
"type": "string"
},
"created_at": {
"type": "string"
},
"urls": {
"type": "object",
"properties": {
"cancel": {
"type": "string"
},
"get": {
"type": "string"
},
"stream": {
"type": "string"
},
"web": {
"type": "string"
}
},
"required": [
"cancel",
"get",
"stream",
"web"
],
"x-apifox-orders": [
"cancel",
"get",
"stream",
"web"
]
}
},
"required": [
"id",
"model",
"version",
"input",
"logs",
"output",
"data_removed",
"error",
"status",
"created_at",
"urls"
],
"x-apifox-orders": [
"id",
"model",
"version",
"input",
"logs",
"output",
"data_removed",
"error",
"status",
"created_at",
"urls"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [
{
"name": "成功示例",
"responseId": 174925600,
"data": "{\n \"id\": \"tv3jnp73n1rmc0crb54b3srz94\",\n \"model\": \"black-forest-labs/flux-fill-dev\",\n \"version\": \"hidden\",\n \"input\": {\n \"guidance\": 30,\n \"image\": \"https://replicate.delivery/pbxt/M0hxMJeO7wFCMr7QYNZsjRxzHhz6ntlLllMteRQNsRD7f3Nf/flux-fill-dev.webp\",\n \"lora_scale\": 1,\n \"mask\": \"https://replicate.delivery/pbxt/M0hxLu8a1YBcybWuumSsfoEec8ooer6JZ2fR28vuM1U0CN9m/74b40bb1-364a-461a-bec5-200a38c7bc87.png\",\n \"megapixels\": \"1\",\n \"num_inference_steps\": 28,\n \"num_outputs\": 1,\n \"output_format\": \"webp\",\n \"output_quality\": 80,\n \"prompt\": \"a spaceship\"\n },\n \"logs\": \"\",\n \"output\": null,\n \"data_removed\": false,\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2025-07-30T03:03:25.864Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/tv3jnp73n1rmc0crb54b3srz94/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/tv3jnp73n1rmc0crb54b3srz94\",\n \"stream\": \"https://stream.replicate.com/v1/files/bcwr-epcf2nmmvkvxq7trerel6zuoiwzyoji3ifhkuu3lf7rtdzh3i6ca\",\n \"web\": \"https://replicate.com/p/tv3jnp73n1rmc0crb54b3srz94\"\n }\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fc09b-0b2d-761c-a052-2fe0e8f0872a"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92436086,
"ordering": 150,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {},
"isDefaultUrlEncoding": 1
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-02T03:53:34.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [
"BLANK.174925600"
],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}