官方文档: https://replicate.com/black-forest-labs/flux-kontext-dev
POST
/replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions创建任务 black-forest-labs/flux-kontext-dev
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "Change the car color to red, turn the headlights on",
"go_fast": true,
"guidance": 2.5,
"input_image": "https://replicate.delivery/pbxt/N5YURZv4ifaW2bMwU7hmrwzgtxf99DTQXpBeobLt1O7dEc3h/pexels-jmark-253096.jpg",
"aspect_ratio": "match_input_image",
"output_format": "jpg",
"output_quality": 80,
"num_inference_steps": 30
}
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | Header | string | 否 | - | Bearer {{YOUR_API_KEY}} |
input | JSON body | object | 否 | - | - |
input.prompt | JSON body | string | 是 | 您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。 | - |
input.go_fast | JSON body | boolean | 否 | 使模型运行速度更快,对于更困难的提示,输出质量可能会略有下降。默认值:true。 | - |
input.guidance | JSON body | number | 否 | 提示词引导强度。默认值: 2.5。最小值:0,最大值:10 | - |
input.input_image | JSON body | string | 是 | 用作参考的图片。必须是 jpeg、png、gif 或 webp 格式。 | - |
input.aspect_ratio | JSON body | string | 否 | 生成图像的长宽比。使用“match_input_image”来匹配输入图像的长宽比。默认值:“match_input_image”。 | - |
input.output_format | JSON body | string | 否 | 输出图像格式。默认值:“webp”。 | - |
input.output_quality | JSON body | integer | 否 | 保存输出图像时的质量,范围为 0 至 100。100 为最佳质量,0 为最低质量。与 .png 输出无关。默认值:80。最小值:0,最大值:100。 | - |
input.num_inference_steps | JSON body | integer | 否 | 推理步骤数,默认值:28。最小值:4,最大值: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 | 否 | - | - |
响应示例
{
"id": "tpdf40dypdrma0cram394vvzkg",
"model": "black-forest-labs/flux-kontext-dev",
"version": "hidden",
"input": {
"aspect_ratio": "match_input_image",
"go_fast": true,
"guidance": 2.5,
"input_image": "https://replicate.delivery/pbxt/N5YURZv4ifaW2bMwU7hmrwzgtxf99DTQXpBeobLt1O7dEc3h/pexels-jmark-253096.jpg",
"num_inference_steps": 30,
"output_format": "jpg",
"output_quality": 80,
"prompt": "Change the car color to red, turn the headlights on"
},
"logs": "",
"output": null,
"data_removed": false,
"error": null,
"status": "starting",
"created_at": "2025-07-29T07:12:42.163Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/tpdf40dypdrma0cram394vvzkg/cancel",
"get": "https://api.replicate.com/v1/predictions/tpdf40dypdrma0cram394vvzkg",
"stream": "https://stream.replicate.com/v1/files/bcwr-6rywfvqq3376h7243k7xrgtnkaqpwiogzgh7kcehtx7kz3nre6fq",
"web": "https://replicate.com/p/tpdf40dypdrma0cram394vvzkg"
}
}来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497673404,
"name": "创建任务 black-forest-labs/flux-kontext-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": "JImRAoTsRQghYWM7AtPacmNRcesV9Rcl"
}
],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档: https://replicate.com/black-forest-labs/flux-kontext-dev",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。"
},
"go_fast": {
"type": "boolean",
"description": "使模型运行速度更快,对于更困难的提示,输出质量可能会略有下降。默认值:true。"
},
"guidance": {
"type": "number",
"description": "提示词引导强度。默认值: 2.5。最小值:0,最大值:10"
},
"input_image": {
"type": "string",
"description": "用作参考的图片。必须是 jpeg、png、gif 或 webp 格式。"
},
"aspect_ratio": {
"type": "string",
"description": "生成图像的长宽比。使用“match_input_image”来匹配输入图像的长宽比。默认值:“match_input_image”。"
},
"output_format": {
"type": "string",
"description": "输出图像格式。默认值:“webp”。"
},
"output_quality": {
"type": "integer",
"description": "保存输出图像时的质量,范围为 0 至 100。100 为最佳质量,0 为最低质量。与 .png 输出无关。默认值:80。最小值:0,最大值:100。"
},
"num_inference_steps": {
"type": "integer",
"description": "推理步骤数,默认值:28。最小值:4,最大值:50。"
}
},
"required": [
"prompt",
"input_image"
],
"x-apifox-orders": [
"prompt",
"go_fast",
"guidance",
"input_image",
"aspect_ratio",
"output_format",
"output_quality",
"num_inference_steps"
]
}
},
"x-apifox-orders": [
"input"
]
},
"examples": [
{
"value": "{\n \"input\": {\n \"prompt\": \"Change the car color to red, turn the headlights on\",\n \"go_fast\": true,\n \"guidance\": 2.5,\n \"input_image\": \"https://replicate.delivery/pbxt/N5YURZv4ifaW2bMwU7hmrwzgtxf99DTQXpBeobLt1O7dEc3h/pexels-jmark-253096.jpg\",\n \"aspect_ratio\": \"match_input_image\",\n \"output_format\": \"jpg\",\n \"output_quality\": 80,\n \"num_inference_steps\": 30\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": 107989991,
"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": [
"input_image",
"prompt"
],
"x-apifox-orders": [
"aspect_ratio",
"input_image",
"output_format",
"prompt",
"prompt_upsampling",
"safety_tolerance"
]
}
},
"x-apifox-orders": [
"id",
"model",
"version",
"input"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [
{
"name": "成功示例",
"responseId": 107989991,
"data": "{\n \"id\": \"tpdf40dypdrma0cram394vvzkg\",\n \"model\": \"black-forest-labs/flux-kontext-dev\",\n \"version\": \"hidden\",\n \"input\": {\n \"aspect_ratio\": \"match_input_image\",\n \"go_fast\": true,\n \"guidance\": 2.5,\n \"input_image\": \"https://replicate.delivery/pbxt/N5YURZv4ifaW2bMwU7hmrwzgtxf99DTQXpBeobLt1O7dEc3h/pexels-jmark-253096.jpg\",\n \"num_inference_steps\": 30,\n \"output_format\": \"jpg\",\n \"output_quality\": 80,\n \"prompt\": \"Change the car color to red, turn the headlights on\"\n },\n \"logs\": \"\",\n \"output\": null,\n \"data_removed\": false,\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2025-07-29T07:12:42.163Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/tpdf40dypdrma0cram394vvzkg/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/tpdf40dypdrma0cram394vvzkg\",\n \"stream\": \"https://stream.replicate.com/v1/files/bcwr-6rywfvqq3376h7243k7xrgtnkaqpwiogzgh7kcehtx7kz3nre6fq\",\n \"web\": \"https://replicate.com/p/tpdf40dypdrma0cram394vvzkg\"\n }\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fd25e-4bea-77ac-9aa4-585ea0ef7290"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92749334,
"ordering": 78,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {},
"isDefaultUrlEncoding": 1
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-05T14:40:23.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}