Skip to content

创建任务 black-forest-labs/flux-kontext-dev

POST https://az.gptplus5.com/replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions

官方文档: https://replicate.com/black-forest-labs/flux-kontext-dev

请求参数

Authorization

在 Header 添加参数Authorization,其值为在 Bearer 之后拼接 Token

示例:Authorization: Bearer ********************

Header 参数

参数名类型必需说明示例
Authorizationstring可选Bearer {{YOUR_API_KEY}}

Body 参数 (application/json)

参数名类型必需说明
inputobject可选
  └ promptstring必需您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。
  └ go_fastboolean可选使模型运行速度更快,对于更困难的提示,输出质量可能会略有下降。默认值:true。
  └ guidancenumber可选提示词引导强度。默认值: 2.5。最小值:0,最大值:10
  └ input_imagestring必需用作参考的图片。必须是 jpeg、png、gif 或 webp 格式。
  └ aspect_ratiostring可选生成图像的长宽比。使用“match_input_image”来匹配输入图像的长宽比。默认值:“match_input_image”。
  └ output_formatstring可选输出图像格式。默认值:“webp”。
  └ output_qualityinteger可选保存输出图像时的质量,范围为 0 至 100。100 为最佳质量,0 为最低质量。与 .png 输出无关。默认值:80。最小值:0,最大值:100。
  └ num_inference_stepsinteger可选推理步骤数,默认值:28。最小值:4,最大值:50。

请求示例

json
{
    "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
    }
  }

cURL 示例

bash
curl --location --request POST 'https://az.gptplus5.com/replicate/v1/models/black-forest-labs/flux-kontext-dev/predictions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "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
    }
  }'

返回响应

🟢200成功

响应 Body

参数名类型必需说明
idstring必需
modelstring必需
versionstring必需
inputobject必需
  └ aspect_ratiostring必需
  └ input_imagestring必需
  └ output_formatstring必需
  └ promptstring必需
  └ prompt_upsamplingboolean必需
  └ safety_toleranceinteger必需
logsstring必需
outputnull必需
data_removedboolean必需
errornull必需
statusstring必需
created_atstring必需
urlsobject必需
  └ cancelstring必需
  └ getstring必需
  └ streamstring必需
  └ webstring必需

响应示例

json
{
    "created": 1589478378,
    "data": [
        {
            "url": "https://..."
        },
        {
            "url": "https://..."
        }
    ]
}