{
  "openapi": "3.1.0",
  "info": {
    "title": "Runware API - Model Upload",
    "version": "1.0.0",
    "description": "Upload a model."
  },
  "servers": [
    {
      "url": "https://api.runware.ai/v1",
      "description": "Runware REST API"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Runware API Key (e.g., Bearer <your-key>)"
      }
    },
    "schemas": {
      "AuthenticationTask": {
        "title": "Authentication",
        "description": "Authenticates a connection using an API key. Can be sent as the first element of the request array as an alternative to using the Authorization header.",
        "type": "object",
        "x-response-schema": "https://schemas.runware.ai/responses/utilities/authentication.json",
        "properties": {
          "taskType": {
            "const": "authentication",
            "title": "Task Type",
            "description": "The type of task to perform."
          },
          "apiKey": {
            "title": "API Key",
            "description": "Your Runware API key.",
            "type": "string"
          },
          "connectionSessionUUID": {
            "title": "Connection Session UUID",
            "description": "Optional session UUID to resume a previous connection and receive any buffered results.",
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "taskType",
          "apiKey"
        ],
        "additionalProperties": false
      },
      "RequestBody": {
        "type": "array",
        "items": {
          "title": "Model Upload",
          "description": "Upload a model.",
          "type": "object",
          "properties": {
            "taskType": {
              "const": "modelUpload",
              "title": "Task Type",
              "description": "The type of task to perform."
            },
            "taskUUID": {
              "title": "Task UUID",
              "description": "UUID v4 identifier for tracking tasks and matching async responses. Must be unique per task.",
              "type": "string",
              "format": "uuid"
            },
            "category": {
              "title": "Category",
              "description": "Category of the model.",
              "type": "string",
              "enum": [
                "checkpoint",
                "lora",
                "lycoris",
                "vae",
                "embeddings"
              ]
            },
            "type": {
              "title": "Type",
              "description": "Type of the model (specific to category).",
              "type": "string",
              "enum": [
                "base",
                "inpainting",
                "refiner",
                "positive",
                "negative"
              ]
            },
            "architecture": {
              "title": "Architecture",
              "description": "Architecture of the model.",
              "type": "string"
            },
            "format": {
              "title": "Format",
              "description": "Format of the model file.",
              "type": "string",
              "enum": [
                "safetensors"
              ]
            },
            "air": {
              "title": "AIR",
              "description": "Artificial Intelligence Resource identifier.",
              "type": "string"
            },
            "uniqueIdentifier": {
              "title": "Unique Identifier",
              "description": "Unique identifier for the model.",
              "type": "string"
            },
            "name": {
              "title": "Name",
              "description": "Name of the model.",
              "type": "string"
            },
            "version": {
              "title": "Version",
              "description": "Version of the model.",
              "type": "string"
            },
            "downloadURL": {
              "title": "Download URL",
              "description": "URL where the model file is hosted.",
              "type": "string",
              "format": "uri"
            },
            "defaultScheduler": {
              "title": "Default Scheduler",
              "description": "Default scheduler.",
              "type": "string"
            },
            "defaultSteps": {
              "title": "Default Steps",
              "description": "Default number of inference steps.",
              "type": "integer",
              "minimum": 1
            },
            "defaultCFG": {
              "title": "Default CFG",
              "description": "Default classifier-free guidance scale.",
              "type": "number",
              "minimum": 0
            },
            "defaultStrength": {
              "title": "Default Strength",
              "description": "Default strength for img2img.",
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "defaultWeight": {
              "title": "Default Weight",
              "description": "Default weight for the model.",
              "type": "number"
            },
            "private": {
              "title": "Private",
              "description": "Whether the model should be private.",
              "type": "boolean",
              "default": false
            },
            "heroImageURL": {
              "title": "Hero Image URL",
              "description": "URL of the hero image.",
              "type": "string",
              "format": "uri"
            },
            "tags": {
              "title": "Tags",
              "description": "Tags associated with the model.",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "positiveTriggerWords": {
              "title": "Positive Trigger Words",
              "description": "List of positive trigger words.",
              "type": "string"
            },
            "shortDescription": {
              "title": "Short Description",
              "description": "Short description of the model.",
              "type": "string"
            },
            "comment": {
              "title": "Comment",
              "description": "Additional comments or notes.",
              "type": "string"
            }
          },
          "required": [
            "taskType",
            "category",
            "architecture",
            "format",
            "name",
            "version",
            "downloadURL"
          ],
          "allOf": [
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "checkpoint"
                  }
                }
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sd2x",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony",
                      "flux1s",
                      "flux1d",
                      "fluxkontextdev",
                      "z_image",
                      "z_image_turbo"
                    ]
                  },
                  "type": {
                    "enum": [
                      "base",
                      "inpainting",
                      "refiner"
                    ]
                  },
                  "defaultScheduler": {
                    "type": "string"
                  },
                  "defaultSteps": {
                    "type": "integer"
                  },
                  "defaultCFG": {
                    "type": "number"
                  },
                  "defaultStrength": {
                    "type": "number"
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "lora"
                  }
                }
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sd2x",
                      "sd3",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony",
                      "flux1s",
                      "flux1d",
                      "fluxkontextdev",
                      "flux_2_dev",
                      "flux2klein_base_4b",
                      "flux2klein_4b",
                      "flux2klein_base_9b",
                      "flux2klein_9b",
                      "z_image",
                      "z_image_turbo",
                      "auraflow",
                      "hidreamfast",
                      "hidreamdev",
                      "hidreamfull",
                      "qwen_image",
                      "qwen_image_edit",
                      "qwen_image_edit_plus",
                      "qwen_image_layered",
                      "wan_2_2_a14b_t2v",
                      "wan_2_2_a14b_i2v"
                    ]
                  },
                  "type": {
                    "enum": [
                      "positive",
                      "negative"
                    ]
                  },
                  "defaultWeight": {
                    "type": "number"
                  },
                  "positiveTriggerWords": {
                    "type": "string"
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "lycoris"
                  }
                }
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sd2x",
                      "sd3",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony",
                      "flux1s",
                      "flux1d",
                      "fluxkontextdev",
                      "flux_2_dev",
                      "flux2klein_base_4b",
                      "flux2klein_4b",
                      "flux2klein_base_9b",
                      "flux2klein_9b",
                      "z_image",
                      "z_image_turbo",
                      "auraflow",
                      "hidreamfast",
                      "hidreamdev",
                      "hidreamfull",
                      "qwen_image",
                      "qwen_image_edit",
                      "qwen_image_edit_plus",
                      "qwen_image_layered",
                      "wan_2_2_a14b_t2v",
                      "wan_2_2_a14b_i2v"
                    ]
                  },
                  "type": {
                    "enum": [
                      "positive",
                      "negative"
                    ]
                  },
                  "defaultWeight": {
                    "type": "number"
                  },
                  "positiveTriggerWords": {
                    "type": "string"
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "vae"
                  }
                }
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony"
                    ]
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "embeddings"
                  }
                }
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony"
                    ]
                  },
                  "type": {
                    "enum": [
                      "positive",
                      "negative"
                    ]
                  }
                }
              }
            }
          ],
          "additionalProperties": false
        },
        "description": "You must always POST an array of task objects."
      },
      "ResponseBody": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "title": "Model Upload Response",
              "type": "object",
              "properties": {
                "taskType": {
                  "title": "Task Type",
                  "description": "Identifier for the type of task being performed",
                  "type": "string",
                  "const": "modelUpload"
                },
                "taskUUID": {
                  "title": "Task UUID",
                  "description": "UUID v4 identifier for tracking tasks and matching async responses. Must be unique per task.",
                  "type": "string",
                  "format": "uuid"
                },
                "status": {
                  "title": "Status",
                  "description": "Status of the upload operation phase.",
                  "type": "string",
                  "enum": [
                    "validated",
                    "downloaded",
                    "optimized",
                    "stored",
                    "ready",
                    "failed"
                  ]
                },
                "message": {
                  "title": "Message",
                  "description": "Status message or error details.",
                  "type": "string"
                },
                "air": {
                  "title": "AIR",
                  "description": "The AIR identifier of the uploaded model.",
                  "type": "string"
                }
              },
              "required": [
                "taskUUID",
                "status",
                "message"
              ],
              "additionalProperties": false
            }
          }
        }
      },
      "ErrorResponse": {
        "title": "Error Response",
        "description": "Standard error response returned by the Runware API.",
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code",
                "message"
              ],
              "additionalProperties": true,
              "properties": {
                "code": {
                  "type": "string",
                  "description": "A short identifier for the error (e.g., invalidApiKey, timeoutProvider)."
                },
                "message": {
                  "type": "string",
                  "description": "A human-readable explanation of what went wrong."
                },
                "parameter": {
                  "type": "string",
                  "description": "The request parameter related to the error, if applicable."
                },
                "taskType": {
                  "type": "string",
                  "description": "The task type of the request that failed."
                },
                "taskUUID": {
                  "type": "string",
                  "description": "The unique identifier of the failed request."
                },
                "documentation": {
                  "type": "string",
                  "description": "A link to relevant documentation."
                }
              }
            }
          }
        },
        "required": [
          "errors"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/": {
      "post": {
        "summary": "Run Model Upload",
        "description": "Upload a model.",
        "operationId": "run_model_upload",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseBody"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request — Missing or invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — No valid API key provided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required — Insufficient account balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — The API key lacks permissions for this request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests — Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server Error — Something went wrong on Runware's end.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable — Temporarily unavailable (maintenance or capacity).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "apiKeyAuth": []
    }
  ]
}