注册

Replicate Stable Diffusion 功能

⚠️ 测试中

POST https://api.quickrouter.ai/replicate/v1/predictions 在线调试 →
Authorization

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

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

请求参数

Header 参数
Authorization string
可选
示例: Bearer {{YOUR_API_KEY}}
Content-Type string
可选
示例: application/json
Body 参数 application/json
version string
必需
模型版本ID
input object
必需
模型输入参数
prompt string
可选
输入提示
width integer
可选
生成图像的宽度(像素)。需要为 64 的倍数。默认值:768
height integer
可选
生成图像的高度(像素)。需要为 64 的倍数。默认值:768
guidance_scale number
可选
无分类器引导尺度。默认值:7.5
num_inference_steps integer
可选
去噪步骤数。默认值:50
示例
{
    "version": "stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
    "input": {
        "prompt": "an astronaut riding a horse on mars, hd, dramatic lighting"
    }
}

请求示例代码

curl --location --request POST 'https://api.quickrouter.ai/replicate/v1/predictions' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
    "version": "stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
    "input": {
        "prompt": "an astronaut riding a horse on mars, hd, dramatic lighting"
    }
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "version": "stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
  "input": {
    "prompt": "an astronaut riding a horse on mars, hd, dramatic lighting"
  }
});

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

fetch("https://api.quickrouter.ai/replicate/v1/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({
  "version": "stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
  "input": {
    "prompt": "an astronaut riding a horse on mars, hd, dramatic lighting"
  }
})
headers = {
  'Authorization': 'Bearer YOUR_API_KEY',
  'Content-Type': 'application/json'
}
conn.request("POST", "/replicate/v1/predictions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

返回响应

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