{
  "openapi": "3.0.3",
  "info": {
    "title": "OI API",
    "version": "1.5.0",
    "description": "Public server-to-server API. Send a Bearer key in every request; keys expire after90 days. Shared limit60 requests/minute per account. Credits, files and tasks are shared with the studio. Confirm an exact quote before submission, preserve the same idempotency key on retry and poll every15 seconds. No completion webhook or cancellation endpoint. See /developers#integration. Generated files are automatically deleted 72 hours after completion; download before expiresAt. Administrator and published platform creations are exempt: retentionExempt=true and expiresAt=null."
  },
  "servers": [
    {
      "url": "https://oiai.me/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/balance": {
      "get": {
        "operationId": "getBalance",
        "summary": "Check credits",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tools": {
      "get": {
        "operationId": "getTools",
        "summary": "Get tools and pricing",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/uploads": {
      "post": {
        "operationId": "uploadAsset",
        "summary": "Upload a file (up to 30 MB; 200 MB quota per account)",
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size or storage limit",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use multipart/form-data",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "JPG, PNG, WebP, MP4, WebM, MP3 or WAV."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "description": "Up to30MiB per file and200MiB per account. Default maximum2,000 files. Reuse owned asset IDs. V1 has no material list/delete endpoint; use the studio or support for cleanup. Wan 3.0 material limits: images 20 MiB, videos 30 MiB, audio 15 MiB; see Creation.wanMedia for dimensions and durations. Owned PDFs are not accepted."
      }
    },
    "/jobs": {
      "get": {
        "operationId": "listJobs",
        "summary": "List account tasks without syncing the provider",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobsPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ]
      },
      "post": {
        "operationId": "createJob",
        "summary": "Create a task and reserve credits",
        "responses": {
          "200": {
            "description": "Existing task; no additional charge",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            }
          },
          "202": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "JSON exceeds 32 KB",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Use application/json",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Prompt blocked by content policy (prompt_policy_blocked); no new task or debit.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Provider error",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,80}$"
            },
            "description": "Unique per account; reuse the same key and body after a timeout. Different parameters with the same key return 409."
          },
          {
            "name": "X-Quote-Id",
            "in": "header",
            "required": true,
            "description": "ID returned by POST /quotes for the identical creation parameters. Expires after 120 seconds; single use. Retain with Idempotency-Key for retries.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Creation"
              },
              "examples": {
                "image": {
                  "value": {
                    "tool": "image",
                    "prompt": "Paisagem tropical",
                    "ratio": "16:9"
                  }
                },
                "wan3": {
                  "summary": "Wan 3.0: text to video",
                  "value": {
                    "tool": "video",
                    "videoModel": "wan3.0-video",
                    "wanMode": "text-to-video",
                    "prompt": "A red kite flying over a green field, with birdsong",
                    "wanResolution": "480P",
                    "wanDuration": 3,
                    "wanRatio": "16:9",
                    "wanAudio": true
                  }
                },
                "hd": {
                  "summary": "HD image to video",
                  "value": {
                    "tool": "video",
                    "videoModel": "hd",
                    "videoAudio": true,
                    "duration": "5",
                    "prompt": "A slow camera move along the coast",
                    "assetIds": [
                      "11111111-1111-4111-8111-111111111111"
                    ],
                    "consent": true
                  }
                },
                "cinema": {
                  "summary": "Cinematic short",
                  "value": {
                    "tool": "video",
                    "videoModel": "seedance-2.5",
                    "wanMode": "text-to-video",
                    "prompt": "A cinematic journey through a futuristic city",
                    "wanDuration": 4,
                    "wanResolution": "480P",
                    "wanRatio": "16:9",
                    "wanAudio": true
                  }
                },
                "precise": {
                  "summary": "Precise image editing",
                  "value": {
                    "tool": "image",
                    "imageModel": "seedream-5.0-pro-edit",
                    "prompt": "Change the jacket to blue",
                    "assetIds": [
                      "11111111-1111-4111-8111-111111111111"
                    ],
                    "consent": true
                  }
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "summary": "Get and sync a task",
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Task missing or owned by another account",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Provider sync failed",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/quotes": {
      "post": {
        "operationId": "quoteCreation",
        "summary": "Get the credits required for a creation",
        "description": "Does not generate or debit credits. Submit owned file IDs; material durations are read server-side. Confirm cost and send id in X-Quote-Id to POST /jobs with identical parameters. Wan 3.0 requires an exact quote, including wanDuration=-1. Changes require a fresh quote.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Creation"
              },
              "examples": {
                "image": {
                  "value": {
                    "tool": "image",
                    "prompt": "Paisagem tropical",
                    "ratio": "16:9"
                  }
                },
                "wan3": {
                  "summary": "Wan 3.0: text to video",
                  "value": {
                    "tool": "video",
                    "videoModel": "wan3.0-video",
                    "wanMode": "text-to-video",
                    "prompt": "A red kite flying over a green field, with birdsong",
                    "wanResolution": "480P",
                    "wanDuration": 3,
                    "wanRatio": "16:9",
                    "wanAudio": true
                  }
                },
                "hd": {
                  "summary": "HD image to video",
                  "value": {
                    "tool": "video",
                    "videoModel": "hd",
                    "videoAudio": true,
                    "duration": "5",
                    "prompt": "A slow camera move along the coast",
                    "assetIds": [
                      "11111111-1111-4111-8111-111111111111"
                    ],
                    "consent": true
                  }
                },
                "cinema": {
                  "summary": "Cinematic short",
                  "value": {
                    "tool": "video",
                    "videoModel": "seedance-2.5",
                    "wanMode": "text-to-video",
                    "prompt": "A cinematic journey through a futuristic city",
                    "wanDuration": 4,
                    "wanResolution": "480P",
                    "wanRatio": "16:9",
                    "wanAudio": true
                  }
                },
                "precise": {
                  "summary": "Precise image editing",
                  "value": {
                    "tool": "image",
                    "imageModel": "seedream-5.0-pro-edit",
                    "prompt": "Change the jacket to blue",
                    "assetIds": [
                      "11111111-1111-4111-8111-111111111111"
                    ],
                    "consent": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Quote valid for 120 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "cost",
                    "expiresAt"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "cost": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "expiresAt": {
                      "type": "integer",
                      "description": "Unix milliseconds"
                    },
                    "inputDuration": {
                      "type": "number",
                      "nullable": true
                    },
                    "priceMode": {
                      "type": "string",
                      "enum": [
                        "maximum"
                      ]
                    },
                    "maximumDuration": {
                      "type": "integer",
                      "minimum": 10,
                      "description": "TTS reservation duration ceiling in seconds."
                    },
                    "country": {
                      "type": "string",
                      "description": "Account business market, fixed by the owning account."
                    },
                    "pricingRevision": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "JSON exceeds 32 KB",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Provider error",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/voices": {
      "get": {
        "summary": "Available system narration voices",
        "operationId": "getVoices",
        "parameters": [
          {
            "name": "locale",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pt-BR",
                "en-US",
                "zh-CN"
              ],
              "default": "pt-BR"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "System voice catalog; no voice cloning.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "locale": {
                      "type": "string"
                    },
                    "voices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "locale": {
                            "type": "string"
                          },
                          "gender": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}/file": {
      "get": {
        "operationId": "downloadJobFile",
        "summary": "Download an owned completed result. Resolve outputs paths against https://oiai.me and send Authorization. Single byte Range supported. Files expire 72 hours after completion (expiresAt); later access returns 410/content_expired. Download before the deadline.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "index",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0,
              "maximum": 7
            }
          },
          {
            "name": "download",
            "in": "query",
            "description": "Set1 to suggest an attachment filename.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "Range",
            "in": "header",
            "schema": {
              "type": "string",
              "example": "bytes=0-1023"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Media bytes",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "Content-Type": {
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "schema": {
                  "type": "integer"
                }
              },
              "Accept-Ranges": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "Partial media bytes",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "Content-Type": {
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "schema": {
                  "type": "integer"
                }
              },
              "Accept-Ranges": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Invalid key",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "example": "Bearer realm=\"oiAI API\""
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Result not found",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Result unavailable or expired after 72 hours (content_expired)",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Result exceeds the supported size",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "416": {
            "description": "Invalid byte range",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit of 60 requests/minute per account",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the next window."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Storage temporarily unavailable",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "oi_<64 hex>",
        "description": "Key created at /developers; do not use in the browser."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string",
                "format": "uuid"
              },
              "details": {
                "type": "array",
                "description": "Validation field paths and codes; submitted values are not echoed.",
                "items": {
                  "type": "object",
                  "required": [
                    "path",
                    "code"
                  ],
                  "properties": {
                    "path": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "integer"
                          }
                        ]
                      }
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              },
              "submission": {
                "type": "object",
                "description": "Present only after a committed generation failure and refund. Reconcile the existing job; retrying the same idempotency key returns that job.",
                "required": [
                  "jobId",
                  "jobStatus",
                  "cost",
                  "refundedCredits"
                ],
                "properties": {
                  "jobId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "jobStatus": {
                    "type": "string",
                    "enum": [
                      "failed"
                    ]
                  },
                  "cost": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "refundedCredits": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            },
            "required": [
              "code",
              "message",
              "request_id"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Creation": {
        "type": "object",
        "properties": {
          "tool": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "tryon",
              "photobook",
              "face",
              "facevideo",
              "motion",
              "talk",
              "upscale",
              "subtitle",
              "tts",
              "product",
              "textvideo"
            ]
          },
          "prompt": {
            "type": "string",
            "maxLength": 5000,
            "default": "",
            "description": "Required for image/textvideo/tts. Wan 3.0: up to 5,000 characters; required in text-to-video/first-frame/first-last-frames, optional in reference when materials or a link are present. Other tools: up to 2,000 characters; tts up to 1,000. Empty for upscale/subtitle/face/facevideo. Cinematic short: four image/text modes, explicit integer duration4–30. Image references only; no wanLinks, wanSeed, negativePrompt or extend."
          },
          "ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "9:16",
              "16:9",
              "4:3",
              "3:4",
              "2:3",
              "3:2",
              "21:9"
            ],
            "default": "1:1"
          },
          "duration": {
            "type": "string",
            "enum": [
              "5",
              "10",
              "15"
            ],
            "default": "5",
            "description": "Earlier video models: 5/10/15 seconds. With videoMode=extend this is additional duration; maximum combined duration 120 seconds. Wan 3.0 uses numeric wanDuration."
          },
          "count": {
            "type": "string",
            "enum": [
              "4",
              "8",
              "12",
              "16"
            ],
            "default": "4"
          },
          "clothing": {
            "type": "string",
            "maxLength": 400,
            "default": ""
          },
          "swapMode": {
            "type": "string",
            "enum": [
              "face",
              "head"
            ],
            "default": "face"
          },
          "assetIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 10,
            "default": [],
            "description": "Owned file UUIDs. Wan 3.0: IDs and order must exactly match wanMedia. Seedream: up to ten references; upscale/subtitle: exactly one; other tools follow GET /tools."
          },
          "consent": {
            "type": "boolean",
            "default": false,
            "description": "Must be true when files are included. Wan 3.0: also required when wanLinks includes a link."
          },
          "negativePrompt": {
            "type": "string",
            "maxLength": 2000,
            "default": "",
            "description": "Must be empty for Wan 3.0. Other video/motion/talk models use a negative field; image/tryon/photobook use text constraints. Empty for upscale/subtitle/face/facevideo."
          },
          "videoMode": {
            "type": "string",
            "enum": [
              "image",
              "extend"
            ],
            "default": "image",
            "description": "image: generate from an image. extend: use the last frame of an owned completed sourceJobId and join a new segment. Request a fresh quote for each extension. Wan 3.0 does not accept extend."
          },
          "sourceJobId": {
            "type": "string",
            "format": "uuid",
            "description": "Required for extension: ID of an owned completed video job. Set assetIds=[] and consent=true."
          },
          "sourceOutputIndex": {
            "type": "integer",
            "minimum": 0,
            "maximum": 7,
            "default": 0
          },
          "imageModel": {
            "type": "string",
            "enum": [
              "standard",
              "seedream-5.0-pro",
              "seedream-5.0-pro-edit"
            ],
            "default": "standard"
          },
          "imageResolution": {
            "type": "string",
            "enum": [
              "1K",
              "2K"
            ],
            "default": "1K"
          },
          "upscaleMedia": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ],
            "default": "image",
            "description": "upscale: image or MP4 video. V1 video up to 15 seconds; V2 video only, up to 60 seconds. subtitle: MP4 up to 60 seconds and 4K. Duration is read from the stored file; no automatic trimming."
          },
          "upscaleModel": {
            "type": "string",
            "enum": [
              "v1",
              "v2"
            ],
            "default": "v1"
          },
          "upscaleQuality": {
            "type": "string",
            "enum": [
              "standard",
              "professional"
            ],
            "default": "standard"
          },
          "upscaleResolution": {
            "type": "string",
            "enum": [
              "1080p",
              "2K"
            ],
            "default": "1080p"
          },
          "imageCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 1
          },
          "voiceId": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{24}$",
            "description": "tts: system voice ID from GET /voices."
          },
          "voiceLocale": {
            "type": "string",
            "enum": [
              "pt-BR",
              "en-US",
              "zh-CN"
            ],
            "default": "pt-BR"
          },
          "speechRate": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 2,
            "default": 1
          },
          "productX": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 0.35,
            "description": "product: normalized coordinates on person image. Rectangle must remain within image."
          },
          "productY": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 0.5,
            "description": "product: normalized coordinates on person image. Rectangle must remain within image."
          },
          "productWidth": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 0.3,
            "description": "product: normalized coordinates on person image. Rectangle must remain within image.",
            "exclusiveMinimum": true
          },
          "productHeight": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 0.3,
            "description": "product: normalized coordinates on person image. Rectangle must remain within image.",
            "exclusiveMinimum": true
          },
          "videoModel": {
            "type": "string",
            "enum": [
              "standard",
              "hd",
              "wan3.0-video",
              "wan3.0-video-prime",
              "seedance-2.5"
            ],
            "default": "standard",
            "description": "Public video models. standard preserves the earlier default. hd selects HD image-to-video; set videoAudio=true for native audio. seedance-2.5 uses wan fields, with explicit wanDuration4–30."
          },
          "wanMode": {
            "type": "string",
            "enum": [
              "text-to-video",
              "first-frame",
              "first-last-frames",
              "reference"
            ],
            "default": "text-to-video",
            "description": "Wan 3.0 mode. text-to-video: no materials; first-frame: one first_frame; first-last-frames: one first_frame followed by one last_frame; reference: image/video/audio references and an optional link."
          },
          "wanResolution": {
            "type": "string",
            "enum": [
              "480P",
              "720P",
              "1080P"
            ],
            "default": "480P"
          },
          "wanDuration": {
            "type": "integer",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "integer",
                "enum": [
                  -1
                ]
              }
            ],
            "default": 3,
            "description": "Wan 3.0: integer from 2 to 30 seconds, or -1 for automatic duration only with an exact quote. Output plus total reference video duration must be at most 30 seconds. Does not use the earlier models’ duration field. Cinematic short: four image/text modes, explicit integer duration4–30. Image references only; no wanLinks, wanSeed, negativePrompt or extend."
          },
          "wanRatio": {
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ],
            "default": "16:9"
          },
          "wanAudio": {
            "type": "boolean",
            "default": true
          },
          "wanSeed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "wanMedia": {
            "type": "array",
            "maxItems": 10,
            "default": [],
            "items": {
              "$ref": "#/components/schemas/WanMedia"
            },
            "description": "Owned file UUIDs with IDs and order exactly matching assetIds. Reference mode: at most 10 materials including wanLinks; up to 10 images, 5 videos and 5 audio files. Images: 20 MiB, width/height 240–7680 pixels, aspect ratio 1:8–8:1. Videos: 30 MiB; audio: 15 MiB. Each video/audio is 1–15 seconds; total video duration at most 15 seconds and total audio duration at most 15 seconds. Cinematic short: four image/text modes, explicit integer duration4–30. Image references only; no wanLinks, wanSeed, negativePrompt or extend."
          },
          "wanLinks": {
            "type": "array",
            "maxItems": 1,
            "default": [],
            "items": {
              "$ref": "#/components/schemas/WanLink"
            },
            "description": "Reference mode only; at most one file or link, counted within the total of 10 materials. Public HTTPS URL without credentials, localhost or private IP addresses. OI does not fetch it. Owned PDF uploads are not accepted."
          },
          "videoAudio": {
            "type": "boolean",
            "default": false,
            "description": "HD: true enables native audio; use wanAudio for Wan/cinematic modes."
          },
          "imageRegion": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "reference",
              "x",
              "y",
              "width",
              "height"
            ],
            "description": "Precise image editing. At least one owned reference required. Region coordinates are normalized textual guidance, not a pixel mask.",
            "properties": {
              "reference": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9
              },
              "x": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "y": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "width": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "height": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        },
        "required": [
          "tool"
        ],
        "description": "Wan 3.0: tool=video and videoModel=wan3.0-video or wan3.0-video-prime. Up to 5,000 prompt characters; empty negativePrompt; extend is not accepted. Send the complete body to POST /quotes first; POST /jobs requires the identical body and X-Quote-Id. An exact quote is required, including wanDuration=-1.",
        "allOf": [
          {
            "anyOf": [
              {
                "not": {
                  "required": [
                    "videoModel"
                  ],
                  "properties": {
                    "videoModel": {
                      "enum": [
                        "wan3.0-video",
                        "wan3.0-video-prime",
                        "seedance-2.5"
                      ]
                    }
                  }
                },
                "properties": {
                  "prompt": {
                    "maxLength": 2000
                  }
                }
              },
              {
                "required": [
                  "videoModel"
                ],
                "properties": {
                  "tool": {
                    "enum": [
                      "video"
                    ]
                  },
                  "videoModel": {
                    "enum": [
                      "wan3.0-video",
                      "wan3.0-video-prime",
                      "seedance-2.5"
                    ]
                  },
                  "negativePrompt": {
                    "enum": [
                      ""
                    ]
                  },
                  "videoMode": {
                    "enum": [
                      "image"
                    ]
                  },
                  "videoAudio": {
                    "enum": [
                      false
                    ]
                  },
                  "assetIds": {
                    "uniqueItems": true
                  }
                }
              }
            ]
          },
          {
            "anyOf": [
              {
                "not": {
                  "required": [
                    "videoModel"
                  ],
                  "properties": {
                    "videoModel": {
                      "enum": [
                        "seedance-2.5"
                      ]
                    }
                  }
                }
              },
              {
                "required": [
                  "wanDuration",
                  "prompt"
                ],
                "properties": {
                  "wanDuration": {
                    "type": "integer",
                    "minimum": 4,
                    "maximum": 30
                  },
                  "prompt": {
                    "minLength": 1
                  },
                  "wanLinks": {
                    "maxItems": 0
                  },
                  "wanSeed": {
                    "not": {}
                  },
                  "wanMedia": {
                    "items": {
                      "properties": {
                        "type": {
                          "enum": [
                            "reference_image",
                            "first_frame",
                            "last_frame"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            ]
          },
          {
            "anyOf": [
              {
                "not": {
                  "required": [
                    "imageModel"
                  ],
                  "properties": {
                    "imageModel": {
                      "enum": [
                        "seedream-5.0-pro-edit"
                      ]
                    }
                  }
                }
              },
              {
                "required": [
                  "assetIds",
                  "consent"
                ],
                "properties": {
                  "tool": {
                    "enum": [
                      "image"
                    ]
                  },
                  "assetIds": {
                    "minItems": 1
                  },
                  "consent": {
                    "enum": [
                      true
                    ]
                  }
                }
              }
            ]
          }
        ]
      },
      "JobAccepted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "submitting",
              "processing",
              "completed",
              "failed",
              "review",
              "refunded",
              "stitching"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status"
        ]
      },
      "Job": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tool": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "submitting",
              "processing",
              "completed",
              "failed",
              "review",
              "refunded",
              "stitching"
            ]
          },
          "cost": {
            "type": "integer"
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri-reference",
              "description": "Authenticated relative paths rooted at https://oiai.me, not anonymous public URLs. Download from your server with the same Bearer key. Save copies in your own storage."
            },
            "description": "Authenticated relative paths rooted at https://oiai.me, not anonymous public URLs. Download from your server with the same Bearer key. Save copies in your own storage."
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp in milliseconds."
          },
          "mediaKind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio"
            ]
          },
          "upscaleMedia": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ],
            "description": "upscale: image or MP4 video. V1 video up to 15 seconds; V2 video only, up to 60 seconds. subtitle: MP4 up to 60 seconds and 4K. Duration is read from the stored file; no automatic trimming."
          },
          "upscaleModel": {
            "type": "string",
            "enum": [
              "v1",
              "v2"
            ]
          },
          "upscaleQuality": {
            "type": "string",
            "enum": [
              "standard",
              "professional"
            ]
          },
          "upscaleResolution": {
            "type": "string",
            "enum": [
              "1080p",
              "2K"
            ]
          },
          "priceMode": {
            "type": "string",
            "enum": [
              "maximum"
            ]
          },
          "reservedCost": {
            "type": "integer"
          },
          "actualCost": {
            "type": "integer",
            "nullable": true
          },
          "actualDuration": {
            "type": "number",
            "nullable": true
          },
          "billingStatus": {
            "type": "string",
            "enum": [
              "settled",
              "review",
              "refunded",
              "reserved"
            ]
          },
          "videoModel": {
            "type": "string",
            "enum": [
              "standard",
              "hd",
              "wan3.0-video",
              "wan3.0-video-prime",
              "seedance-2.5"
            ]
          },
          "wanMode": {
            "type": "string",
            "enum": [
              "text-to-video",
              "first-frame",
              "first-last-frames",
              "reference"
            ],
            "description": "Wan 3.0 mode. text-to-video: no materials; first-frame: one first_frame; first-last-frames: one first_frame followed by one last_frame; reference: image/video/audio references and an optional link."
          },
          "wanResolution": {
            "type": "string",
            "enum": [
              "480P",
              "720P",
              "1080P"
            ]
          },
          "wanDuration": {
            "type": "integer",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 2,
                "maximum": 30
              },
              {
                "type": "integer",
                "enum": [
                  -1
                ]
              }
            ],
            "description": "Wan 3.0: integer from 2 to 30 seconds, or -1 for automatic duration only with an exact quote. Output plus total reference video duration must be at most 30 seconds. Does not use the earlier models’ duration field."
          },
          "wanRatio": {
            "type": "string",
            "enum": [
              "adaptive",
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16"
            ]
          },
          "wanAudio": {
            "type": "boolean"
          },
          "wanSeed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "videoAudio": {
            "type": "boolean"
          },
          "videoMode": {
            "type": "string",
            "enum": [
              "image",
              "extend"
            ]
          },
          "duration": {
            "type": "string"
          },
          "sourceJobId": {
            "type": "string",
            "nullable": true
          },
          "imageModel": {
            "type": "string",
            "enum": [
              "standard",
              "seedream-5.0-pro",
              "seedream-5.0-pro-edit"
            ]
          },
          "imageResolution": {
            "type": "string",
            "enum": [
              "1K",
              "2K"
            ],
            "default": "1K"
          },
          "imageCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8,
            "default": 1
          },
          "ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "9:16",
              "16:9",
              "4:3",
              "3:4",
              "2:3",
              "3:2",
              "21:9"
            ],
            "default": "1:1"
          },
          "outputStorage": {
            "type": "string",
            "nullable": true,
            "enum": [
              "saving",
              "saved",
              "retry",
              "unavailable",
              "expired"
            ]
          },
          "completedCount": {
            "type": "integer",
            "minimum": 0
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0
          },
          "refundedCredits": {
            "type": "integer",
            "minimum": 0
          },
          "completedAt": {
            "type": "integer",
            "nullable": true,
            "description": "Platform-confirmed completion time (Unix milliseconds)."
          },
          "expiresAt": {
            "type": "integer",
            "nullable": true,
            "description": "File deletion deadline, 72 hours after completion (Unix milliseconds). Download before this deadline. Null for administrator creations and published platform works exempt from automatic deletion."
          },
          "contentExpired": {
            "type": "boolean",
            "description": "Expired files cannot be downloaded, recovered or used as video sources."
          },
          "retentionHours": {
            "type": "integer",
            "nullable": true,
            "enum": [
              72,
              null
            ]
          },
          "retentionExempt": {
            "type": "boolean",
            "description": "True for administrator creations and published platform works; expiresAt and retentionHours are null for exempt works."
          }
        },
        "required": [
          "id",
          "tool",
          "status",
          "cost",
          "outputs",
          "created_at"
        ]
      },
      "Upload": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "mime"
        ]
      },
      "Balance": {
        "type": "object",
        "properties": {
          "credits": {
            "type": "integer"
          }
        },
        "required": [
          "credits"
        ]
      },
      "Catalog": {
        "type": "object",
        "properties": {
          "generation_ready": {
            "type": "boolean"
          },
          "pricing_revision": {
            "type": "integer"
          },
          "tool_credits": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Deprecated. Empty in dynamic pricing mode; use POST /quotes."
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "uploads": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "prompt_mode": {
                  "type": "string",
                  "enum": [
                    "native",
                    "text_constraints",
                    "draft_only",
                    "files_only"
                  ],
                  "description": "native: separate positive/negative fields; text_constraints: avoidance included in text; draft_only: prompts cannot be used for generation."
                },
                "wan3": {
                  "$ref": "#/components/schemas/WanCapabilities"
                },
                "models": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "cinema": {
                  "type": "object",
                  "description": "Cinematic short: four image/text modes, explicit integer duration4–30. Image references only; no wanLinks, wanSeed, negativePrompt or extend.",
                  "properties": {
                    "model": {
                      "type": "string",
                      "enum": [
                        "seedance-2.5"
                      ]
                    },
                    "modes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "duration": {
                      "type": "object",
                      "properties": {
                        "minimum": {
                          "type": "integer",
                          "enum": [
                            4
                          ]
                        },
                        "maximum": {
                          "type": "integer",
                          "enum": [
                            30
                          ]
                        }
                      }
                    },
                    "native_audio": {
                      "type": "boolean"
                    },
                    "requires_exact_quote": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "uploads"
              ]
            }
          },
          "billing_rule": {
            "type": "object",
            "description": "The credits required vary with the selected options and are confirmed in a quote for each creation.",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "per_creation_quote"
                ]
              },
              "quoteTtlSeconds": {
                "type": "integer",
                "enum": [
                  120
                ]
              }
            }
          },
          "quote_endpoint": {
            "type": "string"
          },
          "api_version": {
            "type": "string",
            "example": "1.5.0"
          },
          "country": {
            "type": "string",
            "description": "Account business market, fixed by the owning account."
          }
        },
        "required": [
          "generation_ready",
          "pricing_revision",
          "tool_credits",
          "tools"
        ]
      },
      "JobsPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Job"
            }
          },
          "next_offset": {
            "type": "integer",
            "nullable": true
          }
        },
        "required": [
          "data",
          "next_offset"
        ]
      },
      "WanMedia": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "reference_image",
              "reference_video",
              "reference_audio",
              "first_frame",
              "last_frame"
            ]
          },
          "assetId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "type",
          "assetId"
        ],
        "additionalProperties": false
      },
      "WanLink": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "file",
              "link"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://",
            "maxLength": 2000,
            "description": "Public HTTPS URL. Credentials, localhost and private IP addresses are prohibited. OI does not fetch it."
          }
        },
        "required": [
          "type",
          "url"
        ],
        "additionalProperties": false
      },
      "WanCapabilities": {
        "type": "object",
        "properties": {
          "models": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "wan3.0-video",
                "wan3.0-video-prime"
              ]
            }
          },
          "modes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "text-to-video",
                "first-frame",
                "first-last-frames",
                "reference"
              ]
            }
          },
          "resolutions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "480P",
                "720P",
                "1080P"
              ]
            }
          },
          "ratios": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "adaptive",
                "16:9",
                "4:3",
                "1:1",
                "3:4",
                "9:16"
              ]
            }
          },
          "duration": {
            "type": "object",
            "properties": {
              "minimum": {
                "type": "integer",
                "enum": [
                  2
                ]
              },
              "maximum": {
                "type": "integer",
                "enum": [
                  30
                ]
              },
              "automatic": {
                "type": "integer",
                "enum": [
                  -1
                ]
              },
              "default": {
                "type": "integer",
                "enum": [
                  3
                ]
              },
              "requires_exact_quote": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            },
            "required": [
              "minimum",
              "maximum",
              "automatic",
              "default",
              "requires_exact_quote"
            ]
          },
          "defaults": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "text-to-video"
                ]
              },
              "resolution": {
                "type": "string",
                "enum": [
                  "480P"
                ]
              },
              "ratio": {
                "type": "string",
                "enum": [
                  "16:9"
                ]
              },
              "audio": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            },
            "required": [
              "mode",
              "resolution",
              "ratio",
              "audio"
            ]
          },
          "seed": {
            "type": "object",
            "properties": {
              "minimum": {
                "type": "integer",
                "enum": [
                  0
                ]
              },
              "maximum": {
                "type": "integer",
                "enum": [
                  2147483647
                ]
              }
            },
            "required": [
              "minimum",
              "maximum"
            ]
          },
          "prompt_max_characters": {
            "type": "integer",
            "enum": [
              5000
            ]
          },
          "prompt_required_modes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "text-to-video",
                "first-frame",
                "first-last-frames"
              ]
            }
          },
          "negative_prompt_supported": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "supports_extend": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "media_roles": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "reference_image",
                "reference_video",
                "reference_audio",
                "first_frame",
                "last_frame"
              ]
            }
          },
          "asset_order": {
            "type": "string",
            "enum": [
              "wanMedia_matches_assetIds"
            ]
          },
          "upload_limits": {
            "type": "object",
            "properties": {
              "image_max_bytes": {
                "type": "integer",
                "enum": [
                  20971520
                ]
              },
              "image_min_dimension": {
                "type": "integer",
                "enum": [
                  240
                ]
              },
              "image_max_dimension": {
                "type": "integer",
                "enum": [
                  7680
                ]
              },
              "image_min_aspect_ratio": {
                "type": "number",
                "enum": [
                  0.125
                ]
              },
              "image_max_aspect_ratio": {
                "type": "integer",
                "enum": [
                  8
                ]
              },
              "video_max_bytes": {
                "type": "integer",
                "enum": [
                  31457280
                ]
              },
              "audio_max_bytes": {
                "type": "integer",
                "enum": [
                  15728640
                ]
              },
              "reference_total_max_count": {
                "type": "integer",
                "enum": [
                  10
                ]
              },
              "reference_image_max_count": {
                "type": "integer",
                "enum": [
                  10
                ]
              },
              "reference_video_max_count": {
                "type": "integer",
                "enum": [
                  5
                ]
              },
              "reference_audio_max_count": {
                "type": "integer",
                "enum": [
                  5
                ]
              },
              "reference_video_seconds": {
                "type": "object",
                "properties": {
                  "minimum": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "maximum": {
                    "type": "integer",
                    "enum": [
                      15
                    ]
                  },
                  "total_maximum": {
                    "type": "integer",
                    "enum": [
                      15
                    ]
                  }
                },
                "required": [
                  "minimum",
                  "maximum",
                  "total_maximum"
                ]
              },
              "reference_audio_seconds": {
                "type": "object",
                "properties": {
                  "minimum": {
                    "type": "integer",
                    "enum": [
                      1
                    ]
                  },
                  "maximum": {
                    "type": "integer",
                    "enum": [
                      15
                    ]
                  },
                  "total_maximum": {
                    "type": "integer",
                    "enum": [
                      15
                    ]
                  }
                },
                "required": [
                  "minimum",
                  "maximum",
                  "total_maximum"
                ]
              },
              "output_plus_reference_video_max_seconds": {
                "type": "integer",
                "enum": [
                  30
                ]
              },
              "image_formats": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "image/jpeg",
                    "image/png",
                    "image/webp"
                  ]
                }
              },
              "video_formats": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "video/mp4"
                  ]
                }
              },
              "audio_formats": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "audio/mpeg",
                    "audio/wav"
                  ]
                }
              }
            },
            "required": [
              "image_max_bytes",
              "image_min_dimension",
              "image_max_dimension",
              "image_min_aspect_ratio",
              "image_max_aspect_ratio",
              "video_max_bytes",
              "audio_max_bytes",
              "reference_total_max_count",
              "reference_image_max_count",
              "reference_video_max_count",
              "reference_audio_max_count",
              "reference_video_seconds",
              "reference_audio_seconds",
              "output_plus_reference_video_max_seconds"
            ]
          },
          "links": {
            "type": "object",
            "properties": {
              "maximum": {
                "type": "integer",
                "enum": [
                  1
                ]
              },
              "modes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "reference"
                  ]
                }
              },
              "types": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "file",
                    "link"
                  ]
                }
              },
              "protocol": {
                "type": "string",
                "enum": [
                  "https"
                ]
              },
              "public_only": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "fetched_by_oi": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "owned_pdf_upload": {
                "type": "boolean",
                "enum": [
                  false
                ]
              }
            },
            "required": [
              "maximum",
              "modes",
              "types",
              "protocol",
              "public_only",
              "fetched_by_oi",
              "owned_pdf_upload"
            ]
          }
        },
        "required": [
          "models",
          "modes",
          "resolutions",
          "ratios",
          "duration",
          "defaults",
          "seed",
          "prompt_max_characters",
          "prompt_required_modes",
          "negative_prompt_supported",
          "supports_extend",
          "media_roles",
          "asset_order",
          "upload_limits",
          "links"
        ],
        "description": "Capabilities and limits specific to Wan 3.0; duration/video_modes outside this object still describe earlier models."
      }
    }
  }
}
