官方文档: https://replicate.com/stability-ai/sdxl
POST
/replicate/v1/predictions创建任务 stability-ai/sdxl
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/replicate/v1/predictions \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"version": "stability-ai/sdxl:7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc",
"input": {
"width": 768,
"height": 768,
"prompt": "An astronaut riding a rainbow unicorn, cinematic, dramatic",
"refine": "expert_ensemble_refiner",
"scheduler": "K_EULER",
"lora_scale": 0.6,
"num_outputs": 1,
"guidance_scale": 7.5,
"apply_watermark": false,
"high_noise_frac": 0.8,
"negative_prompt": "",
"prompt_strength": 0.8,
"num_inference_steps": 25
}
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | Header | string | 否 | - | Bearer {{YOUR_API_KEY}} |
input | JSON body | object | 否 | - | - |
input.width | JSON body | integer | 否 | 输出图像的宽度。默认值:1024。 | - |
input.height | JSON body | integer | 否 | 输出图像的高度。默认值:1024。 | - |
input.prompt | JSON body | string | 否 | 输入提示。 | - |
input.refine | JSON body | string | 否 | 使用哪种精炼风格。默认值:“no_refiner”。 | - |
input.scheduler | JSON body | string | 否 | 调度程序。默认值:“K_EULER”。 | - |
input.lora_scale | JSON body | number | 否 | LoRA 加法缩放。仅适用于经过训练的模型。默认值:0.6。 | - |
input.num_outputs | JSON body | integer | 否 | 要输出的图像数量。默认值:1。最小值:1,最大值:4。 | - |
input.guidance_scale | JSON body | number | 否 | 无分类器引导尺度。默认值:7.5。最小值:1,最大值:50。 | - |
input.apply_watermark | JSON body | boolean | 否 | 应用水印,以便确定图像是否在下游应用程序中生成。如果您有其他安全生成或部署图像的规定,则可以使用此方法禁用水印。默认值:true。 | - |
input.high_noise_frac | JSON body | number | 否 | 对于 expert_ensemble_refiner,要使用的噪声分数。默认值:0.8。最小值:0,最大值:1。 | - |
input.negative_prompt | JSON body | string | 否 | 输入否定提示。默认:””。 | - |
input.prompt_strength | JSON body | number | 否 | 使用 img2img / inpaint 时的提示强度。1.0 对应于完全破坏图像中的信息。默认值:0.8。最小值:0,最大值:1。 | - |
input.num_inference_steps | JSON body | integer | 否 | 去噪步骤数。默认值:50。最小值:1,最大值:500。 | - |
返回响应 (200)
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
id | 响应 JSON | string | 是 | - | - |
model | 响应 JSON | string | 是 | - | - |
version | 响应 JSON | string | 是 | - | - |
input | 响应 JSON | object | 是 | - | - |
input.aspect_ratio | 响应 JSON | string | 是 | - | - |
input.input_image | 响应 JSON | string | 是 | - | - |
input.output_format | 响应 JSON | string | 是 | - | - |
input.prompt | 响应 JSON | string | 是 | - | - |
input.prompt_upsampling | 响应 JSON | boolean | 是 | - | - |
input.safety_tolerance | 响应 JSON | integer | 是 | - | - |
logs | 响应 JSON | string | 是 | - | - |
output | 响应 JSON | null | 是 | - | - |
data_removed | 响应 JSON | boolean | 是 | - | - |
error | 响应 JSON | null | 是 | - | - |
status | 响应 JSON | string | 是 | - | - |
created_at | 响应 JSON | string | 是 | - | - |
urls | 响应 JSON | object | 是 | - | - |
urls.cancel | 响应 JSON | string | 是 | - | - |
urls.get | 响应 JSON | string | 是 | - | - |
urls.stream | 响应 JSON | string | 是 | - | - |
urls.web | 响应 JSON | string | 是 | - | - |
响应示例
{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497673395,
"name": "创建任务 stability-ai/sdxl",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [
{
"type": "customScript",
"data": "// 将接口返回数据,封装成自己需要的结构\r\nvar resp = {\r\n response: pm.response.json().data[0].url\r\n}\r\n\r\n// html 模板字符\r\nvar template = `<html><img src=\"{{response}}\" /></html>`;\r\n\r\n// 设置 visualizer 数据。传模板、解析对象。\r\npm.visualizer.set(template, resp);",
"defaultEnable": true,
"enable": true,
"id": "ziBL4xhgIwWZ5PhOmUvEq8MI60bNpmnN"
}
],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档: https://replicate.com/stability-ai/sdxl",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/replicate/v1/predictions",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"width": {
"type": "integer",
"description": "输出图像的宽度。默认值:1024。"
},
"height": {
"type": "integer",
"description": "输出图像的高度。默认值:1024。"
},
"prompt": {
"type": "string",
"description": "输入提示。"
},
"refine": {
"type": "string",
"description": "使用哪种精炼风格。默认值:“no_refiner”。"
},
"scheduler": {
"type": "string",
"description": "调度程序。默认值:“K_EULER”。"
},
"lora_scale": {
"type": "number",
"description": "LoRA 加法缩放。仅适用于经过训练的模型。默认值:0.6。"
},
"num_outputs": {
"type": "integer",
"description": "要输出的图像数量。默认值:1。最小值:1,最大值:4。"
},
"guidance_scale": {
"type": "number",
"description": "无分类器引导尺度。默认值:7.5。最小值:1,最大值:50。"
},
"apply_watermark": {
"type": "boolean",
"description": "应用水印,以便确定图像是否在下游应用程序中生成。如果您有其他安全生成或部署图像的规定,则可以使用此方法禁用水印。默认值:true。"
},
"high_noise_frac": {
"type": "number",
"description": "对于 expert_ensemble_refiner,要使用的噪声分数。默认值:0.8。最小值:0,最大值:1。"
},
"negative_prompt": {
"type": "string",
"description": "输入否定提示。默认:””。"
},
"prompt_strength": {
"type": "number",
"description": "使用 img2img / inpaint 时的提示强度。1.0 对应于完全破坏图像中的信息。默认值:0.8。最小值:0,最大值:1。"
},
"num_inference_steps": {
"type": "integer",
"description": "去噪步骤数。默认值:50。最小值:1,最大值:500。"
}
},
"x-apifox-orders": [
"width",
"height",
"prompt",
"refine",
"scheduler",
"lora_scale",
"num_outputs",
"guidance_scale",
"apply_watermark",
"high_noise_frac",
"negative_prompt",
"prompt_strength",
"num_inference_steps"
]
}
},
"x-apifox-orders": [
"input"
]
},
"examples": [
{
"value": "{\n \"version\": \"stability-ai/sdxl:7762fd07cf82c948538e41f63f77d685e02b063e37e496e96eefd46c929f9bdc\",\n \"input\": {\n \"width\": 768,\n \"height\": 768,\n \"prompt\": \"An astronaut riding a rainbow unicorn, cinematic, dramatic\",\n \"refine\": \"expert_ensemble_refiner\",\n \"scheduler\": \"K_EULER\",\n \"lora_scale\": 0.6,\n \"num_outputs\": 1,\n \"guidance_scale\": 7.5,\n \"apply_watermark\": false,\n \"high_noise_frac\": 0.8,\n \"negative_prompt\": \"\",\n \"prompt_strength\": 0.8,\n \"num_inference_steps\": 25\n }\n }",
"mediaType": "application/json",
"description": ""
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [],
"cookie": [],
"header": [
{
"id": "GTujCrB2It",
"name": "Authorization",
"required": false,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "Bearer {{YOUR_API_KEY}}"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 158892759,
"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"
],
"x-apifox-orders": [
"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"
],
"x-apifox-orders": [
"cancel",
"get",
"stream",
"web"
]
}
},
"required": [
"id",
"model",
"version",
"input",
"logs",
"output",
"data_removed",
"error",
"status",
"created_at",
"urls"
],
"x-apifox-orders": [
"id",
"model",
"version",
"input",
"logs",
"output",
"data_removed",
"error",
"status",
"created_at",
"urls"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [
{
"name": "Create image",
"responseId": 158892759,
"data": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fd25e-4be9-7338-9c8f-6db60c9179e7"
},
{
"name": "成功示例",
"responseId": 158892759,
"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": "019fd25e-4be9-7338-9c8f-716567dcc406"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92436086,
"ordering": 18,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {},
"isDefaultUrlEncoding": 1
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-05T14:40:23.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [
"BLANK.158892759"
],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}