Replicate Flux Kontext Pro 功能
POST
https://api.quickrouter.ai/replicate/v1/models/black-forest-labs/flux-kontext-pro/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
可选
模型输入参数
prompt
string
必需
您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。
input_image
string
可选
用作参考的图片。必须是 jpeg、png、gif 或 webp 格式。
aspect_ratio
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。
output_format
string
可选
生成图像的输出格式。默认值:"png"。
safety_tolerance
integer
可选
安全容差,0 最严格,6 最宽松。2 是目前使用输入图像时允许的最大值。默认值:2
prompt_upsampling
boolean
可选
自动提示改进。默认值:false。
示例
{
"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
}
}
请求示例代码
curl --location --request POST 'https://api.quickrouter.ai/replicate/v1/models/black-forest-labs/flux-kontext-pro/predictions' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
"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
}
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"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
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.quickrouter.ai/replicate/v1/models/black-forest-labs/flux-kontext-pro/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": {
"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
}
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
conn.request("POST", "/replicate/v1/models/black-forest-labs/flux-kontext-pro/predictions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
返回响应
响应参数 application/json
id
string
可选
任务ID
status
string
可选
任务状态
output
string
可选
任务输出
示例
{
"id": "b1qw7g8h9xrma0crakst3xbj8m",
"status": "starting"
}