Stable Diffusion
  1. 社区模型 API V4
Stable Diffusion
  • Stable Diffusion API 文档
  • A1111 调度程序
  • Stable Diffusion API
    • 概述
    • 文本到图像
      POST
    • 图像到图像
      POST
    • 修复
      POST
    • 获取排队图像
      POST
    • 系统负载
      POST
  • 训练模型
    • 概述
    • Lora 模型
      POST
    • Dreambooth 模型 (V2)
      POST
    • Dreambooth 模型
      POST
    • 训练状态
      POST
    • 获取模型列表
      POST
    • 删除训练
      POST
    • 取消训练
      POST
    • 裁剪 Base64 图像
      POST
  • 文字转视频
    • 概述
    • 创建视频
      POST
    • 将文本训练为视频
      POST
  • 社区模型 API V4
    • 概述
    • 文本转图像
      POST
    • LoRA
      POST
    • LoRA 多功能设备
      POST
    • 图像到图像
      POST
    • 修复
      POST
    • 获取排队图像接口
      POST
    • 重新加载模型接口
      POST
  • 管理信息系统
    • 概述
    • 裁剪 Base64 图像
    • 删除图像
    • 获取训练过的模型列表
    • 获取公共型号列表
    • 清除用户缓存
    • 购买 Dreambooth 模型
    • 购买订阅计划
    • 取消订阅计划
    • NSFW 图像检查
    • 上传模型
    • 创建房间内部接口
  • 控制网
    • 概述
    • ControlNet 主要终端
    • ControlNet 多功能终端
  • 企业计划
    • 概述
    • 系统详情
    • 重新启动服务器终端
    • 更新服务器
    • 更新 S3 详细信息
    • 清楚缓存
    • 列表调度程序
    • 负载模型
    • 验证模型
    • 获取所有模型
    • 删除模型
    • Controlnet
    • 文字转图像
    • 文字转视频
    • 图像到图像
    • 修复
    • 超分辨率
    • 上传图片
    • 同步模型
    • 负载 Vae
    • NSFW 图像检查
    • 获取排队图像
  • Dreambooth 沙盒
    • 概述
    • 创建 Dreambooth 请求(沙盒)
    • 获取训练状态(沙盒)
  • 图像编辑
    • 概述
    • 外部绘画
    • Blip 扩散
    • 魔术混合接口
    • 图像深度
    • 图像混合器
    • 图像引导编辑
    • 删除背景
    • 超分辨率
    • 混合画布
  • 文本转 3D
    • 概述
    • 文本转 3D
    • 图像转 3D
  • 未经审查的聊天
    POST
  1. 社区模型 API V4

修复

开发环境
https://stablediffusionapi.com/v1
开发环境
https://stablediffusionapi.com/v1
POST
https://stablediffusionapi.com/api/v4/dreambooth/inpaint
Dreambooth Inpainting API 用于根据特定要求、基于经过训练的模型或公共模型来更改(修复)图像的某些部分。将适当的请求参数传递到端点。
该端点根据图像和掩码生成并返回图像,掩码与请求中的 URL 以及模型的 ID 一起传递。
您还可以通过传递提示和否定提示来添加对所需结果的描述。
POST向https://stablediffusionapi.com/api/v4/dreambooth/inpaint 接口发出请求,并将所需参数作为请求正文传递。
该接口还支持调度程序。使用请求正文中的“scheduler”参数来设置要从以下列表中使用的特定调度程序:
DDPMScheduler
DDIMScheduler
PNDMScheduler
LMSDiscreteScheduler
EulerDiscreteScheduler
EulerAncestralDiscreteScheduler
DPMSolverMultistepScheduler
HeunDiscreteScheduler
KDPM2DiscreteScheduler
DPMSolverSinglestepScheduler
KDPM2AncestralDiscreteScheduler
UniPCMultistepScheduler
DDIMInverseScheduler
DEISMultistepScheduler
IPNDMScheduler
KarrasVeScheduler
ScoreSdeVeScheduler
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://stablediffusionapi.com/api/v4/dreambooth/inpaint' \
--header 'Content-Type: application/json' \
--data-raw '{
  "key": "",
  "model_id": "your_model_id",
  "prompt": "a cat sitting on a bench",
  "negative_prompt": null,
  "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",
  "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",
  "width": "512",
  "height": "512",
  "samples": "1",
  "steps": "30",
  "safety_checker": "no",
  "enhance_prompt": "yes",
  "guidance_scale": 7.5,
  "strength": 0.7,
  "scheduler": "UniPCMultistepScheduler",
  "lora_model": null,
  "tomesd": "yes",
  "use_karras_sigmas": "yes",
  "vae": null,
  "lora_strength": null,
  "embeddings_model": null,
  "seed": null,
  "webhook": null,
  "track_id": null
}'
响应示例响应示例
{
  "status": "success",
  "generationTime": 20.970642805099487,
  "id": 13446970,
  "output": [
    "https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/dc639bd6-d605-42c7-950e-48c531124d0d-0.png"
  ],
  "meta": {
    "prompt": " a cat sitting on a bench DSLR photography, sharp focus, Unreal Engine 5, Octane Render, Redshift, ((cinematic lighting)), f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame",
    "model_id": "midjourney-v4-painta",
    "scheduler": "PNDMScheduler",
    "safetychecker": "no",
    "negative_prompt": " ((out of frame)), ((extra fingers)), mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), (((tiling))), ((naked)), ((tile)), ((fleshpile)), ((ugly)), (((abstract))), blurry, ((bad anatomy)), ((bad proportions)), ((extra limbs)), cloned face, glitchy, ((extra breasts)), ((double torso)), ((extra arms)), ((extra hands)), ((mangled fingers)), ((missing breasts)), (missing lips), ((ugly face)), ((fat)), ((extra legs))",
    "W": 512,
    "H": 512,
    "guidance_scale": 7.5,
    "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",
    "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",
    "multi_lingual": "no",
    "steps": 50,
    "n_samples": 1,
    "full_url": "no",
    "upscale": "no",
    "seed": 1343687916,
    "outdir": "out",
    "file_prefix": "dc639bd6-d605-42c7-950e-48c531124d0d"
  }
}

请求参数

Body 参数application/json
key
string 
必需
您用于请求授权的 API Key
model_id
string 
必需
要使用的模型的 ID。它可以是公共的,也可以是您训练有素的模型。
prompt
string 
必需
文本提示,包含您想要在图像中生成的内容的描述
negative_prompt
null 
必需
图像中您不想要的项目
init_image
string 
链接到初始图像
必需
width
string 
必需
最大高度: 宽度: 1024x1024
height
string 
必需
最大高度: 宽度: 1024x1024
samples
string 
必需
作为响应返回的图像数量。最大值为 4。
num_inference_steps
string 
必需
safety_checker
string 
必需
NSFW 图像检查器。如果检测到此类图像,它将被空白图像替换。
enhance_prompt
string 
必需
增强提示以获得更好的结果;默认:是,选项:是/否
guidance_scale
number 
必需
无分类器指导的量表(最小值:1;最大值:20)
strength
number 
必需
使用init image时提示强度。1.0 对应于初始化映像中信息的完全破坏。
scheduler
string 
必需
用它来设置调度程序。
seed
null 
必需
种子用于重现结果,相同的种子将再次为您提供相同的图像。为随机数传递null 。
lora_model
null 
必需
支持多lora,传递逗号分隔值。对比修复示例,yae-miko-genshin
tomesd
string 
必需
启用 tomesd 生成图像:给出非常快的结果, 默认值:是,选项:是/否
use_karras_sigmas
string 
必需
用于 DPMSolverMultistepScheduler 调度程序, 默认值:none,选项:dpmsolver+++
vae
null 
必需
使用自定义 vae 生成图像默认值:null
lora_strength
null 
必需
您正在使用的劳拉模型的强度。如果使用多个 lora,请以逗号分隔的方式传递每个值
embeddings_model
null 
必需
webhook
null 
必需
设置 URL 以在图像生成完成后获取 POST API 调用。
track_id
null 
必需
此 ID 在 Webhook API 调用的响应中返回。这将用于识别 Webhook 请求。
示例

返回响应

🟢200成功
application/json
Body
status
string 
必需
generationTime
number 
必需
id
integer 
必需
output
array[string]
必需
meta
object 
必需
prompt
string 
必需
model_id
string 
必需
scheduler
string 
必需
safetychecker
string 
必需
negative_prompt
string 
必需
W
integer 
必需
H
integer 
必需
guidance_scale
number 
必需
init_image
string 
必需
mask_image
string 
必需
multi_lingual
string 
必需
steps
integer 
必需
n_samples
integer 
必需
full_url
string 
必需
upscale
string 
必需
seed
integer 
必需
outdir
string 
必需
file_prefix
string 
必需
上一页
图像到图像
下一页
获取排队图像接口
Built with