注册

Replicate Flux Fill Dev 功能

POST https://api.quickrouter.ai/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions 在线调试 →
Authorization

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

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

请求参数

Header 参数
Authorization string
可选
示例: Bearer {{YOUR_API_KEY}}
Content-Type string
可选
示例: application/json
Body 参数 application/json
input object
可选
模型输入参数
mask string
可选
一张黑白图像,用于描述需要修复的图像部分。黑色区域将被保留,白色区域将被修复。
image string
必需
待修复的图像。可包含 Alpha 蒙版。如果图像宽度或高度不是 32 的倍数,则会缩放至最接近的 32 倍数。如果图像尺寸超出 1440x1440 的范围,则会缩小以适应 1440x1440 的尺寸
prompt string
必需
您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。
guidance integer
可选
图像生成的引导信息。默认值:30。最小值:0,最大值:100。
lora_scale integer
可选
确定主 LoRA 的适用强度。对于基础推理,合理的结果介于 0 到 1 之间。对于 go_fast,我们对此值应用 1.5 倍乘数;通常情况下,将基础值按此倍数缩放时,性能会很好。您可能仍需要进行实验,以找到适合您特定 LoRA 的最佳值。默认值:1。最小值:-1,最大值:3。
megapixels string
可选
生成图像的近似像素数。使用 match_input 匹配输入的大小(上限为 1440x1440 像素),默认值:"1"。
num_outputs integer
可选
要生成的输出数量。默认值:1。最小值:1,最大值:4。
output_format string
可选
输出图像的格式。默认值:"webp"。
output_quality integer
可选
保存输出图像时的质量,范围为 0 至 100。100 为最佳质量,0 为最低质量。与 .png 输出无关。默认值:80
num_inference_steps integer
可选
去噪步数。建议范围为 28-50,步数越少,输出质量越低,但速度越快。默认值:28。最小值:1,最大值:50。
示例
{
    "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
    }
}

请求示例代码

curl --location --request POST 'https://api.quickrouter.ai/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
    "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
    }
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "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
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.quickrouter.ai/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
import http.client
import json

conn = http.client.HTTPSConnection("api.quickrouter.ai")
payload = json.dumps({
  "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
  }
})
headers = {
  'Authorization': 'Bearer YOUR_API_KEY',
  'Content-Type': 'application/json'
}
conn.request("POST", "/replicate/v1/models/black-forest-labs/flux-fill-dev/predictions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

返回响应

响应参数 application/json
id string
可选
任务ID
status string
可选
任务状态
output string
可选
任务输出
示例
{
    "id": "26t3agjpx9rme0crb4es5cbxx4",
    "status": "starting"
}