负载模型
POST
https://stablediffusionapi.com/api/v1/enterprise/load_model该接口用于将模型加载到您的专用服务器。
POST
向 https://stablediffusionapi.com/api/v1/enterprise/load_model 接口发送请求。
笔记
选择用于加载的模型必须是扩散器模型。
ControlNet 模型 url 和 model_id表
网址 | 型号_id |
---|---|
lllyasviel/control_v11p_sd15_inpaint | 修复 |
lllyasviel/control_v11e_sd15_ip2p | ip2p |
lllyasviel/control_v11f1e_sd15_tile | 瓦 |
lllyasviel/control_v11e_sd15_shuffle | 随机播放 |
lllyasviel/control_v11p_sd15_softedge | 软边 |
lllyasviel/control_v11p_sd15_scribble | 涂 |
lllyasviel/control_v11p_sd15_lineart | 线条艺术 |
lllyasviel/control_v11p_sd15_normalbae | 正常情况 |
lllyasviel/control_v11f1p_sd15_深度 | 深度 |
lllyasviel/control_v11p_sd15_mlsd | 最小二乘法 |
lllyasviel/control_v11p_sd15_canny | 精明的 |
示例
Load a .ckpt or .safetensors Model from Civita
{
"key": "enterprise_api_key",
"url": "https://civitai.com/api/download/models/94640",
"model_id": "majicmix-realistic",
"model_type": "custom_ckpt",
"from_safetensors": "yes",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
}
Load a .ckpt Model from Civitai
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "",
"url": "https://civitai.com/api/download/models/94640",
"model_id": "majicmix-realistic",
"model_type": "custom_ckpt",
"from_safetensors": "yes",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
model_reload("https://stablediffusionapi.com/api/v1/enterprise/load_model", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Load a Huggingface Model
{
"key": "enterprise_api_key",
"url": "wavymulder/Analog-Diffusion",
"model_id": "analog-diffusion",
"model_type": "huggingface",
"from_safetensors": "no",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
}
Request: Load a Huggingface Model
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "enterprise_api_key",
"url": "wavymulder/Analog-Diffusion",
"model_id": "analog-diffusion",
"model_type": "huggingface",
"from_safetensors": "no",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
model_reload("https://stablediffusionapi.com/api/v1/enterprise/load_model", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Request Body: Load a ControlNet Model
{
"key": "enterprise_api_key",
"url": "lllyasviel/control_v11p_sd15_canny",
"model_id": "canny",
"model_type": "controlnet",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
}
Request: Load a ControlNet Model
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key": "enterprise_api_key",
"url": "lllyasviel/control_v11p_sd15_canny",
"model_id": "canny",
"model_type": "controlnet",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
model_reload("https://stablediffusionapi.com/api/v1/enterprise/load_model", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
请求参数
Body 参数application/json
key
string
必需
您的企业API Key用于请求授权。
url
string
必需
Huggingface模型的 URL 、.ckpt下载链接或来自我们的 Dreambooth API 的训练模型。
model_id
string
必需
为您的模型选择一个名称(ID)。加载的模型将保存在此ID下,以便您在生成图像时参考它。
model_type
string
必需
可用选项:“huggingface”、“api_trained”、“custom_ckpt”、“lora”、“embeddings”、“controlnet”。
from_safetensors
string
必需
如果您正在加载.safetensor文件,请将其设置为“yes” ;否则通过“否”。
webhook
string
必需
用于接收模型加载事件响应的 Webhook。
revision
string
必需
指定加载的模型是“fp16”还是“fp32”。
upcast_attention
string
必需
仅当您加载稳定扩散 2.1模型时才将其设置为“yes” ;否则保持“否”。
示例
{
"key": "enterprise_api_key",
"url": "https://civitai.com/api/download/models/94640",
"model_id": "majicmix-realistic",
"model_type": "custom_ckpt",
"from_safetensors": "yes",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
message
string
必需
status
string
必需
示例
{
"message": "model load started",
"status": "success"
}
最后修改时间: 1 年前