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://stablediffusionapi.com/api/v1/enterprise/load_model' \

Send a POST request to https://stablediffusionapi.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", "embeddings", "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 List

  • lllyasviel/sd-controlnet-canny
  • lllyasviel/sd-controlnet-depth
  • lllyasviel/sd-controlnet-hed
  • lllyasviel/sd-controlnet-mlsd
  • lllyasviel/sd-controlnet-normal
  • lllyasviel/sd-controlnet-openpose
  • lllyasviel/sd-controlnet-scribble
  • lllyasviel/sd-controlnet-seg

Examples

Request Body: Load a .ckpt Model from Civitai

Body Raw
{
"key": "enterprise_api_key",
"url": "https://civitai-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com/9742/training-images/urpmv12Pruned.pW4x.ckpt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=2fea663d76bd24a496545da373d610fc%2F20230125%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20230125T124757Z&X-Amz-Expires=10800&X-Amz-Signature=7432bb3b59a78fd9f746dc2ada3cae760957959a66af6a3c0f22bb04e23867fc&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3D%22uberRealisticPornMerge_urpmv12.ckpt%22&x-id=GetObject",
"model_id": "nckpt-model",
"model_type": "custom_ckpt",
"webhook": "https://stablediffusionapi.com",
"revision": "fp32",
"upcast_attention": "no"
}

Request: Load a .ckpt Model from Civitai

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"url": "https://civitai-prod.5ac0637cfd0766c97916cefa3764fbdf.r2.cloudflarestorage.com/9742/training-images/urpmv12Pruned.pW4x.ckpt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=2fea663d76bd24a496545da373d610fc%2F20230125%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20230125T124757Z&X-Amz-Expires=10800&X-Amz-Signature=7432bb3b59a78fd9f746dc2ada3cae760957959a66af6a3c0f22bb04e23867fc&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3D%22uberRealisticPornMerge_urpmv12.ckpt%22&x-id=GetObject",
"model_id": "nckpt-model",
"model_type": "custom_ckpt",
"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 Huggingface Model

Body Raw
{
"key": "enterprise_api_key",
"url": "wavymulder/Analog-Diffusion",
"model_id": "analog-diffusion",
"model_type": "huggingface",
"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",
"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

Body Raw
{
"key": "enterprise_api_key",
"url": "lllyasviel/sd-controlnet-hed",
"model_id": "hed",
"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/sd-controlnet-hed",
"model_id": "hed",
"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));

Response

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