Skip to main content

Enterprise: Load Model Endpoint

Overview​

This endpoint is used to load a model to your dedicated server.

Request​

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

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

note

The model selected for loading has to be a diffusers model.

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.
from_safetensorsSet this to "yes" if you are loading a .safetensor file; otherwise pass "no".
model_typeAvailable options: "huggingface", "api_trained", "custom_ckpt", "lora", "controlnet".
revisionSpecify whether the loaded model is "fp16" or "fp32".
webhookA webhook to receive response on model load events.
upcast_attentionSet this to "yes" only when you are loading a stable diffusion 2.1 model; otherwise keep it "no".

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_type": "custom_ckpt",
"from_safetensors": "yes",
"webhook": "https://modelslab.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://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", 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", 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", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response​

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