{
  "openapi": "3.1.0",
  "info": {
    "title": "ModelHub Image & Video API",
    "version": "1.0.0-preview",
    "description": "ModelHub image/video API. Valid ModelHub Bearer key required. Currently open in unmetered testing mode: no balance required and no customer charge. Supplier costs still apply to the operator. Models have not all been live-verified. Generation uses custom asynchronous jobs, not drop-in OpenAI SDK responses. Claude /v1/messages and OpenAI /v1/responses are not implemented. Text models are not published."
  },
  "servers": [
    {
      "url": "https://modelhub.frankcfbackup.uk"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/v1/images/generations": {
      "post": {
        "operationId": "createImages",
        "summary": "Queue one image generation",
        "tags": [
          "images"
        ],
        "description": "ModelHub asynchronous job API. Prices and generation specifications must be published first. No supplier key is required. This is not a synchronous OpenAI Images response.",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "gpt-image-2"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8000
                  },
                  "size": {
                    "type": "string",
                    "description": "Must exactly match the published fixed profile."
                  },
                  "quality": {
                    "type": "string",
                    "description": "GPT Image 2 only; medium."
                  },
                  "n": {
                    "type": "integer",
                    "const": 1
                  },
                  "response_format": {
                    "const": "b64_json"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted or replay of the same idempotent operation. Poll using the returned ID.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "400": {
            "description": "Invalid fields or profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 1 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "JSON required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate or queue limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unpublished model or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/{id}": {
      "get": {
        "operationId": "getImages",
        "summary": "Read an owned job and its result",
        "tags": [
          "images"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job; result data retained for 24 hours. Download links may expire earlier.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not owned by this account"
          },
          "429": {
            "description": "Rate or queue limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/generations": {
      "post": {
        "operationId": "createVideos",
        "summary": "Queue one video generation",
        "tags": [
          "videos"
        ],
        "description": "ModelHub asynchronous job API. Prices and generation specifications must be published first. No supplier key is required. This is not a synchronous OpenAI Images response.",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "SIRAYA-Seedance-2.0-fast"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8000
                  },
                  "seconds": {
                    "type": "integer",
                    "description": "5 for Seedance; 8 for Veo."
                  },
                  "resolution": {
                    "const": "720p"
                  },
                  "aspect_ratio": {
                    "const": "16:9"
                  },
                  "generate_audio": {
                    "const": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted or replay of the same idempotent operation. Poll using the returned ID.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              },
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "400": {
            "description": "Invalid fields or profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Body exceeds 1 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "JSON required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate or queue limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Unpublished model or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/{id}": {
      "get": {
        "operationId": "getVideos",
        "summary": "Read an owned job and its result",
        "tags": [
          "videos"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job; result data retained for 24 hours. Download links may expire earlier.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Job not found or not owned by this account"
          },
          "429": {
            "description": "Rate or queue limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List published models",
        "responses": {
          "200": {
            "description": "Only models available for calls",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "const": "model"
                          },
                          "owned_by": {
                            "const": "modelhub"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/media/catalog": {
      "get": {
        "operationId": "getCatalog",
        "security": [],
        "summary": "List fixed image/video profiles, availability and USD prices",
        "responses": {
          "200": {
            "description": "Includes unpublished profiles. price=null means unpriced; integer prices use micro-USD. No supplier costs exposed."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ModelHub API key"
      }
    },
    "schemas": {
      "Job": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "status",
          "created_at",
          "charge",
          "reserved",
          "billing_status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "enum": [
              "image",
              "video"
            ]
          },
          "model": {
            "type": "string"
          },
          "status": {
            "enum": [
              "queued",
              "submitting",
              "processing",
              "completed",
              "failed",
              "needs_review"
            ]
          },
          "created_at": {
            "type": "integer",
            "description": "Unix seconds"
          },
          "charge": {
            "type": "integer",
            "description": "micro-USD; 1 USD = 1,000,000"
          },
          "reserved": {
            "type": "integer",
            "description": "micro-USD"
          },
          "billing_status": {
            "type": "string"
          },
          "result_expires_at": {
            "type": "integer"
          },
          "result": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "b64_json": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/ErrorDetail"
          }
        }
      },
      "ErrorDetail": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorDetail"
          }
        }
      }
    }
  }
}
