Skip to main content

Upload Model

Overview

This endpoint is used to load a private or public model

Request

--request POST 'https://stablediffusionapi.com/api/v3/load_model' \

Send a POST request to https://stablediffusionapi.com/api/v3/load_model endpoint.

note

To load a private model you must have purchased model credit from private model page.

Attributes

ParameterDescription
keyYour API Key used for request authorization.
urlThe URL of the huggingface model, ckpt download link, or safetensors model
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.
force_loadSet this to "yes" if you want to reload automatically once upload fails; otherwise pass "no".
model_formatAvailable options: "diffusers", "safetensors", "ckpt".
revisionSpecify whether the loaded model is "fp16" or "fp32".
model_categoryThe category of the model you want to upload, it accepts any of these;stable_diffusion,stable_diffusion_xl, controlnet, lora, embeddings,vae
model_visibilityIt accepts private or public.
model_nameThis is the name you want to give your model.
model_imageA valid image url of to display the model when uploaded.
hf_uploadIt accepts yes or no.

Examples

Load a ckpt or safetensors Model from Civitai

Body Raw
{
"key": "api_key",
"url": "https://civitai.com/api/download/models/132760?type=Model&format=SafeTensor&size=pruned&fp=fp16",
"model_id": "majicmix-realistic",
"revision": "fp32",
"model_id": "stable-diffusion-1.0-inpainting-0.1",
"force_load": "yes",
"revision": "fp16",
"model_category": "stable_diffusion_xl",
"model_format": "safetensors",
"model_visibility": "public",
"model_name": "stable-diffusion-1.0-inpainting-0.1",
"model_image": "https://cdn2.stablediffusionapi.com/generations/1a14cab3-cc79-4cee-ab28-29379bff766b-0.png",
"hf_upload": "no"
}

Load a diffusers

Body Raw
{
"key": "api_key",
"url": "diffusers/stable-diffusion-xl-1.0-inpainting-0.1",
"model_id": "stable-diffusion-xl-1.0-inpainting-0.1",
"force_load": "yes",
"revision": "fp16",
"model_category": "stable_diffusion_xl",
"model_format": "diffusers",
"model_visibility": "public",
"model_name": "stable-diffusion-xl-1.0-inpainting-0.1",
"model_image": "https://cdn2.stablediffusionapi.com/generations/1a14cab3-cc79-4cee-ab28-29379bff766b-0.png",
"hf_upload": "no"
}
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"url": "diffusers/stable-diffusion-xl-1.0-inpainting-0.1",
"model_id": "stable-diffusion-xl-1.0-inpainting-0.1",
"force_load": "yes",
"revision": "fp16",
"model_category": "stable_diffusion_xl",
"model_format": "diffusers",
"model_visibility": "private",
"model_name": "stable-diffusion-xl-1.0-inpainting-0.1",
"model_image": "https://cdn2.stablediffusionapi.com/generations/1a14cab3-cc79-4cee-ab28-29379bff766b-0.png",
"hf_upload": "no"
});

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

model_reload("https://stablediffusionapi.com/api/v3/load_model", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

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