> ## Documentation Index
> Fetch the complete documentation index at: https://docs.randomseed.co/llms.txt
> Use this file to discover all available pages before exploring further.

# v1/load-model

> Load a custom model from huggingface or civitai

### API key

Create your account on [RandomSeed](https://randomseed.co/signup) & grab your [api key](https://randomseed.co/api-reference/integrate)

### Headers

<ParamField header="Authorization" type="string">
  Your API key. This is required by most endpoints to access our API programatically. You can get your api key by clicking on 'API reference' tab under your profile icon.
</ParamField>

## Tips

Make sure to load only a model file with `.safetensors` extension.

When you're loading a model from huggingface, please change part of the url from /blog/main to /resolve/main.
For example, if you're loading a model from
`https://huggingface.co/SG161222/Realistic_Vision_V4.0/blob/main/Realistic_Vision_V4.0.safetensors`, then you should set the url in the param to
`https://huggingface.co/SG161222/Realistic_Vision_V4.0/resolve/main/Realistic_Vision_V4.0.safetensors`
In addition to checkpoint models, you can also load loras by specifying the model type.

If you're loading a model from civitai, make sure to follow the format `https://civitai.com/api/download/models/<modelId>?type=Model&format=SafeTensor`

Following field is optional: `support_inpainting` - this defaults to false.

### Body

<ParamField body="url" type="string" required>
  Link to the model
</ParamField>

<ParamField body="model_name" type="string" required>
  Name of the model
</ParamField>

<ParamField body="webhook_url" type="string" required>
  Callback url that will be called once the model is loaded
</ParamField>

<ParamField body="model_type" type="string" required>
  Either "checkpoint" or "lora"
</ParamField>

<ParamField body="support_inpainting" type="boolean">
  Whether the model supports inpainting or not.
</ParamField>

### Response

<ResponseField name="message" type="string">
  image generation in progress
</ResponseField>

<RequestExample>
  ```bash Example Request theme={null}
  curl --location "https://randomseed.lol/v1/load-model" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $RANDOMSEED_API_KEY" \
  --data '{
      "load_model": {
          "url": "https://civitai.com/api/download/models/130072?type=Model&format=SafeTensor&size=full&fp=fp16",
          "model_name": "realistic_vision_v5.1",
          "webhook_url": "https://webhook.site/b8d78e3c-7c73-478b-b446-0337d78513da",
          "model_type": "checkpoint",
          "support_inpainting": false
      }
  }
  '
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "message": "Model loading in progress"
  }
  ```
</ResponseExample>
