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

# Upload Model

> This endpoint is used to load a private or public model

## Request

Send a `POST` request to below endpoint.

```curl curl theme={null}
--request POST 'https://modelslab.com/api/v3/load_model' \
```

## Load a ckpt or safetensors Model from Civitai

```json json theme={null}
{   
  "key": "your_api_key",    
  "url": "https://civitai.com/api/download/models/132760?type=Model&format=SafeTensor&size=pruned&fp=fp16",    
  "revision": "fp32",    
  "model_id": "stable-diffusion-1.0-inpainting-0.1",    
  "force_load": "yes",     
  "model_category": "stable_diffusion_xl",    
  "model_format": "safetensors",    
  "model_visibility": "public",    
  "model_name": "stable-diffusion-1.0-inpainting-0.1",    
  "model_image": "https://assets.modelslab.ai/generations/95aebdb1-302f-42c4-b461-64b6ce9214e4",    
  "hf_upload": "no"
}
```

## Load a diffusers model

```json json theme={null}
{    
  "key": "your_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://assets.modelslab.ai/generations/95aebdb1-302f-42c4-b461-64b6ce9214e4",    
  "hf_upload": "no"
}
```


## OpenAPI

````yaml POST /load_model
openapi: 3.0.3
info:
  title: ModelsLab API
  description: >-
    API endpoints for managing and browsing Stable Diffusion models - includes
    public model discovery, custom model uploads, and trained model management.
  version: 4.0.0
  contact:
    name: ModelsLab Support
    url: https://modelslab.com
servers:
  - url: https://modelslab.com/api/v3
    description: V3 API Endpoints
  - url: https://modelslab.com/api/v4
    description: V4 API Endpoints
security: []
tags:
  - name: Public Models
    description: Browse and discover publicly available pre-trained models
  - name: Model Management
    description: Upload custom models and manage your trained model collection
paths:
  /load_model:
    post:
      tags:
        - Model Management
      summary: Upload Model
      description: >-
        This endpoint is used to load a private or public model. To load a
        private model you must have purchased model credit from private model
        page.
      operationId: loadModel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelUploadRequest'
            examples:
              civitai_example:
                summary: Load a ckpt or safetensors Model from Civitai
                value:
                  key: api_key
                  url: >-
                    https://civitai.com/api/download/models/132760?type=Model&format=SafeTensor&size=pruned&fp=fp16
                  revision: fp32
                  model_id: stable-diffusion-1.0-inpainting-0.1
                  force_load: 'yes'
                  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'
              diffusers_example:
                summary: Load a diffusers
                value:
                  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'
      responses:
        '200':
          description: Model load started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelUploadResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      servers:
        - url: https://modelslab.com/api/v3
components:
  schemas:
    ModelUploadRequest:
      type: object
      required:
        - key
        - url
        - model_id
        - model_format
        - model_category
        - model_visibility
        - model_name
      properties:
        key:
          type: string
          description: Your API Key used for request authorization
        url:
          type: string
          description: >-
            The URL of the Huggingface model, CKPT download link, or Safetensors
            model
        model_id:
          type: string
          description: >-
            Choose a name (ID) for your model. The loaded model will be saved
            under this ID
        force_load:
          type: string
          enum:
            - 'yes'
            - 'no'
          default: 'yes'
          description: >-
            Set this to "yes" if you want to reload automatically once upload
            fails; otherwise pass "no"
        model_format:
          type: string
          enum:
            - diffusers
            - safetensors
            - ckpt
          description: Available options are "diffusers", "safetensors", or "ckpt"
        revision:
          type: string
          enum:
            - fp16
            - fp32
          default: fp16
          description: Specify whether the loaded model is "fp16" or "fp32"
        model_category:
          type: string
          enum:
            - stable_diffusion
            - stable_diffusion_xl
            - flux
            - z_image
          description: The category of the model you want to upload
        model_subcategory:
          type: string
          enum:
            - lora
          description: for lora models, specify the model sub category as lora
        model_visibility:
          type: string
          enum:
            - private
            - public
          default: public
          description: It accepts "private" or "public"
        model_name:
          type: string
          description: The name you want to give your model
        model_image:
          type: string
          format: uri
          description: A valid image URL to display the model when uploaded
        hf_upload:
          type: string
          enum:
            - 'yes'
            - 'no'
          default: 'no'
          description: It accepts "yes" or "no"
    ModelUploadResponse:
      type: object
      properties:
        status:
          type: string
          example: success
        message:
          type: string
          example: model load started
    Error:
      type: object
      properties:
        status:
          type: string
          example: error
        message:
          type: string
          description: Error description
        code:
          type: integer
          description: Error code
  responses:
    BadRequest:
      description: Bad request - Invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized - Invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

````