官方文档: https://replicate.com/black-forest-labs/flux-kontext-pro
POST
/replicate/v1/models/black-forest-labs/flux-kontext-pro/predictions创建任务 black-forest-labs/flux-kontext-pro
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/replicate/v1/models/black-forest-labs/flux-kontext-pro/predictions \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "Make this a 90s cartoon",
"input_image": "https://replicate.delivery/pbxt/N55l5TWGh8mSlNzW8usReoaNhGbFwvLeZR3TX1NL4pd2Wtfv/replicate-prediction-f2d25rg6gnrma0cq257vdw2n4c.png",
"aspect_ratio": "match_input_image",
"output_format": "jpg",
"safety_tolerance": 2,
"prompt_upsampling": false
}
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | Header | string | 否 | - | Bearer {{YOUR_API_KEY}} |
input | JSON body | object | 否 | - | - |
input.prompt | JSON body | string | 是 | 您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。 | - |
input.input_image | JSON body | string | 否 | 用作参考的图片。必须是 jpeg、png、gif 或 webp 格式。 | - |
input.aspect_ratio | JSON body | string | 否 | 生成图像的长宽比。使用“match_input_image”来匹配输入图像的长宽比。默认值:“match_input_image”,支持1:1,16:9,9:16,4:3,3:4,3:2,2:3,4:5,5:4,21:9,9:21,2:1,1:2。 | - |
input.output_format | JSON body | string | 否 | 生成图像的输出格式。默认值:“png”。 | - |
input.safety_tolerance | JSON body | integer | 否 | 安全容差,0 最严格,6 最宽松。2 是目前使用输入图像时允许的最大值。默认值:2 | - |
input.prompt_upsampling | JSON body | boolean | 否 | 自动提示改进。默认值:false。 | - |
返回响应 (200)
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
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": "b1qw7g8h9xrma0crakst3xbj8m",
"model": "black-forest-labs/flux-kontext-pro",
"version": "hidden",
"input": {
"aspect_ratio": "match_input_image",
"input_image": "https://replicate.delivery/pbxt/N55l5TWGh8mSlNzW8usReoaNhGbFwvLeZR3TX1NL4pd2Wtfv/replicate-prediction-f2d25rg6gnrma0cq257vdw2n4c.png",
"output_format": "jpg",
"prompt": "Make this a 90s cartoon",
"prompt_upsampling": false,
"safety_tolerance": 2
},
"logs": "",
"output": null,
"data_removed": false,
"error": null,
"status": "starting",
"created_at": "2025-07-29T06:51:12.591Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/b1qw7g8h9xrma0crakst3xbj8m/cancel",
"get": "https://api.replicate.com/v1/predictions/b1qw7g8h9xrma0crakst3xbj8m",
"stream": "https://stream.replicate.com/v1/files/bcwr-3g5lstbmjxzikqt225npeguwi4bu47ndhirdgete5npgzzzogkpq",
"web": "https://replicate.com/p/b1qw7g8h9xrma0crakst3xbj8m"
}
}来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 495899851,
"name": "创建任务 black-forest-labs/flux-kontext-pro",
"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": "VKuRu7dItECUjgjJ1ntvDZmau5AUkg9r"
}
],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档: https://replicate.com/black-forest-labs/flux-kontext-pro",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/replicate/v1/models/black-forest-labs/flux-kontext-pro/predictions",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。"
},
"input_image": {
"type": "string",
"description": "用作参考的图片。必须是 jpeg、png、gif 或 webp 格式。"
},
"aspect_ratio": {
"type": "string",
"description": "生成图像的长宽比。使用“match_input_image”来匹配输入图像的长宽比。默认值:“match_input_image”,支持1:1,16:9,9:16,4:3,3:4,3:2,2:3,4:5,5:4,21:9,9:21,2:1,1:2。"
},
"output_format": {
"type": "string",
"description": "生成图像的输出格式。默认值:“png”。"
},
"safety_tolerance": {
"type": "integer",
"description": "安全容差,0 最严格,6 最宽松。2 是目前使用输入图像时允许的最大值。默认值:2"
},
"prompt_upsampling": {
"type": "boolean",
"description": "自动提示改进。默认值:false。"
}
},
"required": [
"prompt"
],
"x-apifox-orders": [
"prompt",
"input_image",
"aspect_ratio",
"output_format",
"safety_tolerance",
"prompt_upsampling"
]
}
},
"x-apifox-orders": [
"input"
]
},
"examples": [
{
"value": "{\n \"input\": {\n \"prompt\": \"Make this a 90s cartoon\",\n \"input_image\": \"https://replicate.delivery/pbxt/N55l5TWGh8mSlNzW8usReoaNhGbFwvLeZR3TX1NL4pd2Wtfv/replicate-prediction-f2d25rg6gnrma0cq257vdw2n4c.png\",\n \"aspect_ratio\": \"match_input_image\",\n \"output_format\": \"jpg\",\n \"safety_tolerance\": 2,\n \"prompt_upsampling\": false\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": 128523158,
"name": "成功",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {
"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": [
"prompt"
],
"x-apifox-orders": [
"aspect_ratio",
"input_image",
"output_format",
"prompt",
"prompt_upsampling",
"safety_tolerance"
]
}
},
"required": [
"input"
],
"x-apifox-orders": [
"input"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [
{
"name": "成功示例",
"responseId": 128523158,
"data": "{\n \"id\": \"b1qw7g8h9xrma0crakst3xbj8m\",\n \"model\": \"black-forest-labs/flux-kontext-pro\",\n \"version\": \"hidden\",\n \"input\": {\n \"aspect_ratio\": \"match_input_image\",\n \"input_image\": \"https://replicate.delivery/pbxt/N55l5TWGh8mSlNzW8usReoaNhGbFwvLeZR3TX1NL4pd2Wtfv/replicate-prediction-f2d25rg6gnrma0cq257vdw2n4c.png\",\n \"output_format\": \"jpg\",\n \"prompt\": \"Make this a 90s cartoon\",\n \"prompt_upsampling\": false,\n \"safety_tolerance\": 2\n },\n \"logs\": \"\",\n \"output\": null,\n \"data_removed\": false,\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2025-07-29T06:51:12.591Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/b1qw7g8h9xrma0crakst3xbj8m/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/b1qw7g8h9xrma0crakst3xbj8m\",\n \"stream\": \"https://stream.replicate.com/v1/files/bcwr-3g5lstbmjxzikqt225npeguwi4bu47ndhirdgete5npgzzzogkpq\",\n \"web\": \"https://replicate.com/p/b1qw7g8h9xrma0crakst3xbj8m\"\n }\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fc09b-0b2c-736b-8edb-86060eef061d"
},
{
"name": "成功示例",
"responseId": 128523158,
"data": "{\n \"id\": \"w44zs9cet5rmc0cqzp49gpkhf8\",\n \"model\": \"black-forest-labs/flux-kontext-dev\",\n \"version\": \"hidden\",\n \"input\": {\n \"aspect_ratio\": \"match_input_image\",\n \"input_image\": \"https://replicate.delivery/xezq/XfwWjHJ7HfrmXE6ukuLVEpXWfeQ3PQeRI5mApuLXRxST7XMmC/tmpc91tlq20.png\",\n \"output_format\": \"jpg\",\n \"prompt\": \"Make the letters 3D, floating in space on a city street\",\n \"prompt_upsampling\": false,\n \"safety_tolerance\": 2\n },\n \"logs\": \"\",\n \"output\": null,\n \"data_removed\": false,\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2025-07-12T07:27:54.577Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/w44zs9cet5rmc0cqzp49gpkhf8/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/w44zs9cet5rmc0cqzp49gpkhf8\",\n \"stream\": \"https://stream.replicate.com/v1/files/bcwr-h7bu76ujftxzwih5u35puoysogps56mqvpvjz4nrxskhfe7ks42a\",\n \"web\": \"https://replicate.com/p/w44zs9cet5rmc0cqzp49gpkhf8\"\n }\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fc09b-0b2c-736b-8edb-8ba4bffb9dde"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92436086,
"ordering": 114,
"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.128523158"
],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}