创建任务 black-forest-labs/flux-kontext-dev
POST /replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions
说明
概览
| Method | POST |
|---|---|
| Path | /replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions |
| Type | http |
| Status | 1 |
| Module | 2102810 |
| Folder | 61442780 |
参数
{ "query": [], "path": [], "cookie": [], "header": [ { "required": false, "description": "", "type": "string", "id": "GTujCrB2It", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" } ] }
请求体
{ "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" ] }, "mediaType": "", "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": "" } ], "oasExtensions": "" }
响应
[ { "id": 719660557, "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" ] }, "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" ] } }, "required": [ "id", "model", "version", "input", "logs", "output", "data_removed", "error", "status", "created_at", "urls" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [], "oasExtensions": "" } ]
响应示例
[ { "name": "Create image", "responseId": 719660557, "data": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 641274163 }, { "name": "成功示例", "responseId": 719660557, "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": 641290669 } ]