{
  "openapi": "3.1.0",
  "info": {
    "title": "WeGen Generation API",
    "version": "1.0.0",
    "description": "Personal-key generation API. Prices and model-specific settings are authoritative at submission. Static reference: https://docs.wegen.art/docs/api"
  },
  "servers": [
    {
      "url": "https://wegen.art"
    }
  ],
  "tags": [
    {
      "name": "Generation",
      "description": "Media, text, analysis, and durable tasks."
    },
    {
      "name": "Discovery",
      "description": "Reviewed models and available voice profiles."
    },
    {
      "name": "References",
      "description": "Upload owned media and private reference recordings."
    }
  ],
  "paths": {
    "/api/generate/models": {
      "get": {
        "operationId": "listModels",
        "summary": "Discover model IDs and capabilities",
        "tags": [
          "Discovery"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "Reviewed model catalog; video entries may omit availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "models": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Model"
                      }
                    },
                    "accountingPeriod": {
                      "type": "string",
                      "const": "UTC calendar month"
                    }
                  },
                  "required": [
                    "models",
                    "accountingPeriod"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/generate/image": {
      "post": {
        "operationId": "generateImage",
        "summary": "Generate image",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "200": {
            "description": "Accepted replay of the same media task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "202": {
            "description": "New durable media task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
            },
            "description": "Persist before dispatch. Reuse the exact payload and same API key on uncertain retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MediaRequest"
              }
            }
          }
        }
      }
    },
    "/api/generate/video": {
      "post": {
        "operationId": "generateVideo",
        "summary": "Generate video",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "200": {
            "description": "Accepted replay of the same media task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "202": {
            "description": "New durable media task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
            },
            "description": "Persist before dispatch. Reuse the exact payload and same API key on uncertain retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MediaRequest"
              }
            }
          }
        }
      }
    },
    "/api/generate/audio": {
      "post": {
        "operationId": "generateAudio",
        "summary": "Generate audio",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "200": {
            "description": "Accepted replay of the same media task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "202": {
            "description": "New durable media task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
            },
            "description": "Persist before dispatch. Reuse the exact payload and same API key on uncertain retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioRequest"
              }
            }
          }
        }
      }
    },
    "/api/generate/tasks/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getTask",
        "summary": "Read an owned public API media task",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "Read-only snapshot with current signed output URLs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "task": {
                      "$ref": "#/components/schemas/Task"
                    }
                  },
                  "required": [
                    "task"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "operationId": "headTask",
        "summary": "Check an owned media task without a response body",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "Task exists. No response body."
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying."
          }
        }
      }
    },
    "/api/generate/assets": {
      "post": {
        "operationId": "uploadAsset",
        "summary": "Upload raw owned media bytes",
        "tags": [
          "References"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "201": {
            "description": "Owned asset uploaded; check readiness before use.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "image",
                            "video",
                            "audio"
                          ]
                        },
                        "state": {
                          "type": "string"
                        },
                        "url": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uri"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "state",
                        "url"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "asset"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Maximum 30 MiB. Uses canonical validation. This mutation does not implement generation idempotency.",
        "parameters": [
          {
            "name": "X-Filename",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "video/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "audio/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        }
      }
    },
    "/api/generate/voices": {
      "get": {
        "operationId": "listVoices",
        "summary": "List owned or approved public voices",
        "tags": [
          "Discovery"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "read",
        "responses": {
          "200": {
            "description": "Voice summaries with pagination.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "voices": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Voice"
                      }
                    }
                  },
                  "required": [
                    "voices"
                  ],
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "mine",
                "explore"
              ],
              "default": "mine"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10000,
              "default": 1
            }
          },
          {
            "name": "language",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Supported voice-language filter."
          }
        ]
      },
      "post": {
        "operationId": "uploadVoice",
        "summary": "Create a private reference voice",
        "tags": [
          "References"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "201": {
            "description": "Private draft voice.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "voice": {
                      "$ref": "#/components/schemas/Voice"
                    }
                  },
                  "required": [
                    "voice"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Transcribes a 15–300 second recording up to 50 MiB. Private zero-shot draft, no training/publication. No generation-idempotency guarantee.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "duration": {
                    "type": "number",
                    "minimum": 15,
                    "maximum": 300
                  },
                  "rightsConfirmed": {
                    "type": "string",
                    "const": "true"
                  }
                },
                "required": [
                  "file",
                  "duration",
                  "rightsConfirmed"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/generate/text/v1/chat/completions": {
      "post": {
        "operationId": "chatCompletion",
        "summary": "Generate text as JSON or SSE",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "200": {
            "description": "JSON completion or SSE chunks with final usage and [DONE]. A stream can emit REQUEST_UNCERTAIN instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "SSE data: chat.completion.chunk JSON; [DONE] on success; error JSON on failure."
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "160,000 request bytes, 128,000 serialized conversation bytes. Completed requests replay without redispatch. Stream setting is part of the identity. Does not support tools or Responses.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
            },
            "description": "Persist before dispatch. Reuse the exact payload and same API key on uncertain retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            }
          }
        }
      }
    },
    "/api/generate/extract/video": {
      "post": {
        "operationId": "extractVideo",
        "summary": "Analyze an owned video",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "personalKey": []
          }
        ],
        "x-required-scope": "generate",
        "responses": {
          "200": {
            "description": "Structured video analysis or a retained successful replay.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "extraction": {
                      "$ref": "#/components/schemas/Extraction"
                    }
                  },
                  "required": [
                    "id",
                    "extraction"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected or outcome uncertain. Preserve the original request identity when retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Owned ready video under 25 MiB and shorter than 120 seconds. JSON at most 16,000 bytes. Conservative 262,144 input + 8,192 output token reservation. Frame suggestions require local capture.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{1,128}$"
            },
            "description": "Persist before dispatch. Reuse the exact payload and same API key on uncertain retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtractionRequest"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "personalKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "lgk_<64 lowercase hex characters>",
        "description": "Personal API key. Scopes are documented through x-required-scope on each operation."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "MediaRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150,
            "description": "Public model ID from GET /api/generate/models."
          },
          "prompt": {
            "type": "string",
            "maxLength": 30000,
            "description": "Generator/model limits can be lower than the envelope limit."
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true,
            "default": {},
            "description": "Generator-specific inputs. Unsupported names and provider/model/prompt/sourceTool overrides are rejected."
          },
          "referenceAssetIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "maxItems": 10,
            "default": [],
            "description": "Owned asset IDs; model-specific limits apply."
          },
          "maxGems": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Approved per-request admission ceiling."
          },
          "operation": {
            "type": "string",
            "enum": [
              "speech",
              "music",
              "voice_clone"
            ],
            "description": "Required for audio."
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false
      },
      "AudioRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150,
            "description": "Public model ID from GET /api/generate/models."
          },
          "prompt": {
            "type": "string",
            "maxLength": 30000,
            "description": "Generator/model limits can be lower than the envelope limit."
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true,
            "default": {},
            "description": "Generator-specific inputs. Unsupported names and provider/model/prompt/sourceTool overrides are rejected."
          },
          "referenceAssetIds": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "maxItems": 10,
            "default": [],
            "description": "Owned asset IDs; model-specific limits apply."
          },
          "maxGems": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Approved per-request admission ceiling."
          },
          "operation": {
            "type": "string",
            "enum": [
              "speech",
              "music",
              "voice_clone"
            ],
            "description": "Required for audio."
          }
        },
        "required": [
          "model",
          "prompt",
          "operation"
        ],
        "additionalProperties": false
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "text"
            ]
          },
          "available": {
            "type": "boolean"
          },
          "baseGems": {
            "type": "number"
          },
          "capabilities": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "capabilities"
        ],
        "additionalProperties": false
      },
      "Voice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "succeeded",
              "partial",
              "failed",
              "cancelled"
            ]
          },
          "quotedGems": {
            "type": "number"
          },
          "chargedGems": {
            "type": "number"
          },
          "releasedGems": {
            "type": "number"
          },
          "error": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "outputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Output"
            }
          }
        },
        "required": [
          "id",
          "status",
          "quotedGems",
          "chargedGems",
          "releasedGems",
          "error",
          "outputs"
        ],
        "additionalProperties": false
      },
      "Output": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "asset": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string"
                  },
                  "mimeType": {
                    "type": "string"
                  },
                  "url": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "kind",
                  "mimeType",
                  "url"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "index",
          "status",
          "asset"
        ],
        "additionalProperties": false
      },
      "Submission": {
        "type": "object",
        "properties": {
          "task": {
            "$ref": "#/components/schemas/Task"
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": [
          "task",
          "created"
        ],
        "additionalProperties": false
      },
      "ChatRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string",
                  "maxLength": 30000
                }
              },
              "required": [
                "role",
                "content"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 60
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8192,
            "default": 4096
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "response_format": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object"
                ]
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          "maxGems": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": false
      },
      "ChatCompletion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "const": "assistant"
                    },
                    "content": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "additionalProperties": false
                },
                "finish_reason": {
                  "type": "string"
                }
              },
              "required": [
                "index",
                "message",
                "finish_reason"
              ],
              "additionalProperties": false
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "number"
              },
              "completion_tokens": {
                "type": "number"
              },
              "total_tokens": {
                "type": "number"
              }
            },
            "required": [
              "prompt_tokens",
              "completion_tokens",
              "total_tokens"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "additionalProperties": false
      },
      "ExtractionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "const": "qwen/qwen3.7-flash"
          },
          "videoAssetId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "prompt": {
            "type": "string",
            "maxLength": 2000,
            "default": ""
          },
          "maxGems": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        },
        "required": [
          "model",
          "videoAssetId"
        ],
        "additionalProperties": false
      },
      "Extraction": {
        "type": "object",
        "properties": {
          "analysis": {
            "type": "string"
          },
          "durationSeconds": {
            "type": "number"
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "number"
                },
                "end": {
                  "type": "number"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "start",
                "end",
                "description"
              ],
              "additionalProperties": false
            }
          },
          "frames": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "time": {
                  "type": "number"
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "selected": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "time",
                "label",
                "description",
                "selected"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "analysis",
          "durationSeconds",
          "frames"
        ],
        "additionalProperties": false
      }
    }
  }
}
