Skip to main content

Enterprise: Load Model V2 Endpoint

Overview

This endpoint is updated V2 version of the load_model endpoint. It allows you to load models from Huggingface, Civitai, and custom trained models.

Request

--request POST 'https://modelslab.com/api/v1/enterprise/load_model_v2' \

Send a POST request to https://modelslab.com/api/v1/enterprise/load_model_v2 endpoint.

Watch the how-to video to see it in action.

Attributes

ParameterDescription
keyYour enterprise API Key used for request authorization.
urlThe URL of the huggingface model, .ckpt download link, or trained model from our Dreambooth API.
model_idChoose a name(ID) for your model. The loaded model will be saved under this ID, so you can refer to it when generating images.
model_categoryAvailable options: "lora", "embeddings", "stable_diffusion", "stable_diffusion_xl", "controlnet".
model_formatAvailable options: "ckpt", "safetensors", "pt", "diffusers"
revisionSpecify whether the loaded model is "fp16" or "fp32".
webhookA webhook to receive response on model load events.

ControlNet Model url and model_id table

urlmodel_id
lllyasviel/control_v11p_sd15_inpaintinpaint
lllyasviel/control_v11e_sd15_ip2pip2p
lllyasviel/control_v11f1e_sd15_tiletile
lllyasviel/control_v11e_sd15_shuffleshuffle
lllyasviel/control_v11p_sd15_softedgesoftedge
lllyasviel/control_v11p_sd15_scribblescribble
lllyasviel/control_v11p_sd15_lineartlineart
lllyasviel/control_v11p_sd15_normalbaenormalbae
lllyasviel/control_v11f1p_sd15_depthdepth
lllyasviel/control_v11p_sd15_mlsdmlsd
lllyasviel/control_v11p_sd15_cannycanny

Examples

Load a .ckpt or .safetensors Model from Civitai

Body Raw
{
"key": "enterprise_api_key",
"url": "https://civitai.com/api/download/models/94640",
"model_id": "majicmix-realistic",
"model_category": "stable_diffusion",
"model_format": "safetensors",
"webhook": "https://modelslab.com",
"revision": "fp16"
}

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_category": "stable_diffusion",
"model_format": "safetensors",
"webhook": "https://modelslab.com",
"revision": "fp16"
});

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

model_reload("https://modelslab.com/api/v1/enterprise/load_model_v2", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Load a Huggingface Model

Body Raw
{
"key": "enterprise_api_key",
"url": "wavymulder/Analog-Diffusion",
"model_id": "analog-diffusion",
"model_type": "huggingface",
"from_safetensors": "no",
"webhook": "https://modelslab.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://modelslab.com",
"revision": "fp32",
"upcast_attention": "no"
});

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

model_reload("https://modelslab.com/api/v1/enterprise/load_model_v2", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Request Body: Load a ControlNet Model

Body Raw
{
"key": "enterprise_api_key",
"url": "lllyasviel/control_v11p_sd15_canny",
"model_id": "canny",
"model_type": "controlnet",
"webhook": "https://modelslab.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://modelslab.com",
"revision": "fp32",
"upcast_attention": "no"
});

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

model_reload("https://modelslab.com/api/v1/enterprise/load_model_v2", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"message": "model load started",
"status": "success"
}