{
  "openapi": "3.1.0",
  "info": {
    "title": "Runware API - Model Search",
    "version": "1.0.0",
    "description": "Search for models."
  },
  "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 Search",
          "description": "Search for models.",
          "type": "object",
          "properties": {
            "taskType": {
              "const": "modelSearch",
              "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"
            },
            "search": {
              "title": "Search",
              "description": "Search query to find models by name, description or AIR ID.",
              "type": "string"
            },
            "tags": {
              "title": "Tags",
              "description": "Filter models by specific tags.",
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "category": {
              "title": "Category",
              "description": "Filter models by category.",
              "type": "string",
              "enum": [
                "checkpoint",
                "lora",
                "lycoris",
                "vae",
                "embeddings"
              ]
            },
            "type": {
              "title": "Type",
              "description": "Filter checkpoint models by type. Only applicable when category is `checkpoint`.",
              "type": "string",
              "enum": [
                "base",
                "inpainting",
                "refiner"
              ]
            },
            "architecture": {
              "title": "Architecture",
              "description": "Filter by model architecture.",
              "type": "string"
            },
            "conditioning": {
              "title": "Conditioning",
              "description": "Filter ControlNet models by their conditioning type.",
              "type": "string",
              "enum": [
                "blur",
                "canny",
                "depth",
                "gray",
                "hed",
                "inpaint",
                "inpaintdepth",
                "lineart",
                "lowquality",
                "normal",
                "openmlsd",
                "openpose",
                "outfit",
                "pix2pix",
                "qrcode",
                "scribble",
                "seg",
                "shuffle",
                "sketch",
                "softedge",
                "tile"
              ]
            },
            "visibility": {
              "title": "Visibility",
              "description": "Filter by visibility status (e.g., public, private, all).",
              "type": "string",
              "enum": [
                "public",
                "private",
                "all"
              ],
              "default": "all"
            },
            "limit": {
              "title": "Limit",
              "description": "Maximum number of results to return.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "offset": {
              "title": "Offset",
              "description": "Number of results to skip for pagination.",
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          "required": [
            "taskType",
            "search"
          ],
          "allOf": [
            {
              "if": {
                "properties": {
                  "type": {
                    "minLength": 1
                  }
                },
                "required": [
                  "type"
                ]
              },
              "then": {
                "properties": {
                  "category": {
                    "const": "checkpoint"
                  }
                },
                "required": [
                  "category"
                ]
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "checkpoint"
                  }
                },
                "required": [
                  "category"
                ]
              },
              "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"
                    ]
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "lora"
                  }
                },
                "required": [
                  "category"
                ]
              },
              "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"
                    ]
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "lycoris"
                  }
                },
                "required": [
                  "category"
                ]
              },
              "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"
                    ]
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "vae"
                  }
                },
                "required": [
                  "category"
                ]
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony"
                    ]
                  }
                }
              }
            },
            {
              "if": {
                "properties": {
                  "category": {
                    "const": "embeddings"
                  }
                },
                "required": [
                  "category"
                ]
              },
              "then": {
                "properties": {
                  "architecture": {
                    "enum": [
                      "sd1x",
                      "sd1lcm",
                      "sd1distilled",
                      "sdhyper",
                      "sdxl",
                      "sdxllcm",
                      "sdxldistilled",
                      "sdxlturbo",
                      "sdxlhyper",
                      "sdxllightning",
                      "illustrious",
                      "noobai",
                      "pony"
                    ]
                  }
                }
              }
            }
          ],
          "additionalProperties": false
        },
        "description": "You must always POST an array of task objects."
      },
      "ResponseBody": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "title": "Model Search Response",
              "type": "object",
              "properties": {
                "taskType": {
                  "title": "Task Type",
                  "description": "Identifier for the type of task being performed",
                  "type": "string",
                  "const": "modelSearch"
                },
                "taskUUID": {
                  "title": "Task UUID",
                  "description": "UUID v4 identifier for tracking tasks and matching async responses. Must be unique per task.",
                  "type": "string",
                  "format": "uuid"
                },
                "totalResults": {
                  "title": "Total Results",
                  "description": "Total number of models matching the search criteria.",
                  "type": "integer",
                  "minimum": 0
                },
                "results": {
                  "title": "Results",
                  "description": "List of models found.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "air": {
                        "title": "AIR",
                        "description": "Artificial Intelligence Resource identifier.",
                        "type": "string"
                      },
                      "name": {
                        "title": "Name",
                        "description": "Name of the model.",
                        "type": "string"
                      },
                      "version": {
                        "title": "Version",
                        "description": "Version of the model.",
                        "type": "string"
                      },
                      "category": {
                        "title": "Category",
                        "description": "Category of the model (e.g., checkpoint, lora).",
                        "type": "string"
                      },
                      "architecture": {
                        "title": "Architecture",
                        "description": "Model architecture (e.g., sdxl, flux).",
                        "type": "string"
                      },
                      "imageURL": {
                        "title": "Image URL",
                        "description": "URL of the model's representative image.",
                        "type": "string",
                        "format": "uri"
                      },
                      "thumbnailURL": {
                        "title": "Thumbnail URL",
                        "description": "URL of the model's thumbnail image.",
                        "type": "string",
                        "format": "uri"
                      },
                      "tags": {
                        "title": "Tags",
                        "description": "List of tags associated with the model.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "private": {
                        "title": "Private",
                        "description": "Whether the model is private.",
                        "type": "boolean"
                      },
                      "primary": {
                        "title": "Primary",
                        "description": "Whether this is the primary version of the model.",
                        "type": "boolean"
                      },
                      "baseModel": {
                        "title": "Base Model",
                        "description": "The base model this model is derived from.",
                        "type": "string"
                      }
                    },
                    "required": [
                      "air",
                      "name",
                      "version",
                      "category",
                      "imageURL",
                      "thumbnailURL"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "taskType",
                "taskUUID",
                "totalResults",
                "results"
              ],
              "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 Search",
        "description": "Search for models.",
        "operationId": "run_model_search",
        "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": []
    }
  ]
}