{
  "openapi": "3.0.0",
  "info": {
    "title": "AI 时装虚拟试穿",
    "description": "# 概览\nAI 时装虚拟试穿是一间虚拟试衣间，不用真穿就能试遍各种衣服。它借助 AI 与图片编辑技术，把服装叠合到您的照片上，让您看清不同风格、不同版型穿在自己身形上的样子。网购、找穿搭灵感，或纯粹玩一玩时尚点子，都很合适。用 AI 时装虚拟试穿体验虚拟试穿。上传任意服装参考图，与您的照片互换穿搭，瞬间换一整套行头。\n\n---\n\n## 接入指南\n\n* API Playground\n您可以用 API Playground 测试 AI 时装虚拟试穿的虚拟试穿功能，边试边熟悉试穿流程，理解会更透彻。\n\nAPI Playground 地址：\n<https://yce.makeupar.com/api-console/en/api-playground/ai-clothes/>\n\n---\n\n* AI 时装虚拟试穿接口使用指引\n\n本指引说明如何上传图片、准备参考服装，以及创建虚拟试穿任务。\n\n***\n\n   * 第 1 步：用 File 接口上传文件\n\n用 **File 接口**（`/s2s/v2.0/file`）上传目标用户图片。\n\n**图片要求：**\n\n*   上传一张高分辨率的全身照。\n*   确保照片把整个人体完整、清楚地呈现出来。\n*   避免背景里有多人，或杂乱干扰的物体。\n\n**请求示例：**\n\n```bash\ncurl --request POST \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/file \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json' \\\n  --data '{\n    \"files\": [\n {\n   \"content_type\": \"image/jpg\",\n   \"file_name\": \"full_body_photo_01_3dbd1b6683.jpg\",\n   \"file_size\": 547541\n }\n    ]\n  }'\n```\n\n***\n\n   * 第 2 步：取得 File 接口响应\n\n响应中包含：\n\n*   用于创建 AI 任务的 `file_id`。\n*   用于上传实际图片文件的 `requests.url`。\n\n**响应示例：**\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"files\": [\n {\n   \"content_type\": \"image/jpg\",\n   \"file_name\": \"full_body_photo_01_3dbd1b6683.jpg\",\n   \"file_id\": \"SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9/13W5TOD8/u/FfjK3xgCQ+hRt9MJXBFaud\",\n   \"requests\": [\n {\n  \"method\": \"PUT\",\n  \"url\": \"https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...\",\n  \"headers\": {\n    \"Content-Length\": \"547541\",\n    \"Content-Type\": \"image/jpg\"\n  }\n }\n   ]\n }\n    ]\n  }\n}\n```\n\n***\n\n   * 第 3 步：把图片上传到提供的 URL\n\n用 File 接口响应中的 `requests.url` 上传图片：\n\n```bash\ncurl --location --request PUT 'https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...' \\\n  --header 'Content-Type: image/jpg' \\\n  --header 'Content-Length: 547541' \\\n  --data-binary @'./full_body_photo_01_3dbd1b6683.jpg'\n```\n\n***\n\n   * 第 4 步：准备参考服装\n\n * 4.1 上传参考服装图片\n\n您可以：\n\n*   用 File 接口（`/s2s/v2.0/file`）上传服装图片，或\n*   提供一个有效的图片 URL。\n\n**支持的服装图片：**\n\n*   服装的商品图。\n*   真人全身照，作为穿搭参考。\n\n详细规格见 **[文件规格与错误码](#section/overview/File-Specs-and-Errors)**。\n\n***\n\n   * 第 5 步：创建 AI 任务\n\n用 **AI 任务接口**（`/s2s/v2.0/task/cloth-v4`）创建虚拟试穿任务。\n\n**参数：**\n\n*   用户图片：`src_file_id` 或 `src_file_url`。\n*   服装图片：`ref_file_id`、`ref_file_url` 或 `template_id`。\n\n**请求示例：**\n\n```bash\ncurl --request POST \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/cloth-v4 \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json' \\\n  --data '{\n    \"src_file_url\": \"https://plugins-media.makeupar.com/strapi/assets/clothes_03_cccd5d4803.jpeg\",\n    \"ref_file_url\": \"https://plugins-media.makeupar.com/strapi/assets/clothes_reference_full_body_01_5a000d999f.png\",\n    \"garment_category\": \"full_body\"\n  }'\n```\n\n**响应示例：**\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"task_id\": \"SaGaqpDgKwFrVBgMpQMA3HY0LeqdT9_13W5TOD8_u_GPi6NqQ3dhlmN-6ntFwhzT\"\n  }\n}\n```\n\n***\n\n   * 第 6 步：轮询任务结果\n\n用任务 ID 查看状态：\n\n```bash\ncurl --request GET \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/cloth-v4/<YOUR_TASK_ID> \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json'\n```\n\n***\n\n   * 第 7 步：取回结果\n\n成功的响应会给出结果图片的下载 URL：\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"error\": null,\n    \"results\": {\n \"url\": \"https://yce-us.s3-accelerate.amazonaws.com/demo/ttl30/...signature...\"\n    },\n    \"task_status\": \"success\"\n  }\n}\n```\n\nAPI 密钥无效的报错响应：\n\n```json\n{\n  \"status\": 401,\n  \"error\": \"Unauthorized\",\n  \"error_code\": \"InvalidAccessToken\"\n}\n```\n\n---\n\n应用场景：\n![](https://plugins-media.makeupar.com/smb/blog/post/2025-05-08/b80f4ae1-c905-4ec0-b491-e42c15e65575.gif)\n\n![](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/01%20ai%20clothes%20changer.jpg)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2023-12-01/45f451aa-4b4f-466d-9da7-4538573c92af.jpg)\n\n拍摄建议：\n![拍摄建议](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/AI-Cloth-Guideline.png \"Suggestions for How to Shoot\")\n\n\n## 文件规格与错误码\n* 支持的格式与尺寸\n\n|类型|支持尺寸|支持文件大小|支持格式|\n|  ---- | ---- | ---- | ---- |\n|目标用户图片|建议 1024×768，最小 512×384，最长边 4096 px。</br></br> - 仅支持单人。</br> - 为达到最佳效果，人物应占据画面至少 80%。</br> - 图片只需包含上半身，从胸部往上即可。腹部不必露出，但肩膀须可见。</br> - 脸部必须完整可见，不得被遮挡。</br> - 身体须正对镜头、站姿（不要坐着或蹲着）。 |< 10MB|jpg/png|\n|服装参考图片 |建议 1024×768，最小 512×384，最长边 4096 px。</br></br> - 使用真人服装照作为参考时</br>&nbsp;&nbsp;&nbsp;- 只能有一位人物。</br>&nbsp;&nbsp;&nbsp;- 可见的服装区域必须完整覆盖要试穿的部位。</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 举例：全身试穿时，不能拿半身服装图来用。</br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 举例：下半身试穿时，不能只用裤子的一部分。</br>&nbsp;&nbsp;&nbsp;- 服装不得被严重遮挡（例如被长发或手臂盖住）。</br>&nbsp;&nbsp;&nbsp;- 脸部必须完整可见，不得被遮挡。</br>&nbsp;&nbsp;&nbsp;- 身体须正对镜头、站姿（不要坐着或蹲着）。 </br></br> - 使用商品图作为参考时</br>&nbsp;&nbsp;&nbsp;- 必须是单件服装的正面商品图。</br>&nbsp;&nbsp;&nbsp;- 不要使用合成图（例如一张图里同时有上衣和下装）。</br>&nbsp;&nbsp;&nbsp;- 下半身只支持实际穿着的服装，不支持单件商品图。|< 10MB|jpg/png|\n\n* 错误码\n\n* 错误码（预处理）\n\n| 错误码 | 说明 |\n| ---------- | ----------- |\n| exceed_max_filesize | 源图或参考图过大。长边不得超过 4096 像素。 |\n| error_below_min_image_size | 源图或参考图过小。长边不得小于 128 像素。 |\n| error_pose | 无法从上传的人物源图中检测出姿态。 |\n| error_invalid_ref | 参考图无效，例如图片为空，或主体未完整呈现。 |\n| error_apply_region_mismatch | 源图中的套用区域与参考图不匹配，无法套用任何修改。 |\n| error_invalid_src | 源图只有下半身或只有脚部时。 |\n\n* 错误码（引擎）\n\n| 错误码 | 说明 |\n| ---------- | ----------- |\n| invalid_parameter | - 服装类别无效。 <br> - Style_id 不在 inference_style_list 中。 <br> - src_keys、dst_keys 或 acts 无效。 <br> - ref_keys 或 template_ref_image 无效。 <br> - 上述参数必须且只能提供一个。 |\n| error_download_image | 源图或参考图下载失败。 |\n| exceed_max_filesize | 源图或参考图过大。文件大小不得超过 10 MB。 |\n| error_nsfw_content_detected | 在结果图中检测到疑似不适宜内容（NSFW）。 |\n| error_editing_failed | 编辑失败：结果图与原图过于相似。 |\n| unknown_internal_error | - 模型加载失败。 <br> - 调度算法类型无效。 <br> - 未加载引擎。 <br> - 文件不在上传结果中。 |\n| error_multi_person | 在\"normal\"或\"strict\"多人过滤设置下，系统在源图或参考图中检测到多人。 |\n\n\n* 运行环境与依赖\n\n| 示例代码语言 / 工具 | 建议运行时版本 |\n|---|---|\n| cURL | - bash >= 3.2</br>   - curl >= 7.58 (modern TLS/HTTP support)</br>   - jq >= 1.6 (robust JSON parsing) |\n| Node.js (JavaScript) | Node >= 18 (for global fetch) |\n| JavaScript | - Chrome / Edge >= 80</br>   - Firefox >= 74</br>   - Safari >= 13.1 |\n| PHP | PHP >= 7.4 (for modern TLS/compat), ext-curl (recommended) or allow_url_fopen=On + ext-openssl, ext-json |\n| Python | Python >= 3.10 (for f-strings), requests >= 2.20.0 |\n| Java | Java 11+ (for HttpClient), Jackson Databind >= 2.12.0 |\n\n---\n\n## 点数消耗\n\n| AI 功能 | 消耗点数 |\n|---|---|\n| AI 时装虚拟试穿 V2.0 | 2 |\n| AI 时装虚拟试穿 V3.0 | 2 |\n\n---\n",
    "version": "",
    "termsOfService": "https://www.makeupar.com/perfectbeauty/youcam/terms-of-service-api",
    "contact": {
      "email": "YouCamOnlineEditor_API@perfectcorp.com"
    },
    "license": {
      "name": "Privacy policy",
      "url": "https://www.makeupar.com/perfectbeauty/youcam/privacy-policy-api"
    }
  },
  "servers": [
    {
      "url": "https://yce-api-01.makeupar.com"
    }
  ],
  "tags": [
    {
      "name": "V4.0",
      "description": "能力增强：新增外套类虚拟试穿，包含夹克与马甲。现在可以在全身、上半身、下半身、鞋子、外套之间挑选试穿类型， 也可以直接选 Auto，让 AI 引擎为您搭配一整套造型。"
    },
    {
      "name": "V3.0",
      "description": "AI 时装虚拟试穿 v3 引擎全面升级：面料真实感出色，可准确呈现皮革、针织、真丝等材质，服装细节的还原也更加精细。"
    },
    {
      "name": "V2.0",
      "description": "用 AI 技术生成服装的虚拟试穿体验，支持模板与参考图两种方式。"
    }
  ],
  "paths": {
    "/s2s/v2.0/task/template/cloth": {
      "get": {
        "summary": "列出预置模板。",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 20
            },
            "description": "本页返回的条目数量，取值 1 到 20，默认 20。"
          },
          {
            "name": "starting_token",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "73a3c9e69b89"
            },
            "description": "本页的起始 token。第一页传 `null`，之后用上一次响应里的 `next_token` 作为下一页的起点"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TemplateResponse"
          },
          "400": {
            "$ref": "#/components/responses/InvalidParameters"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth": {
      "post": {
        "summary": "执行 AI 时装虚拟试穿 任务。",
        "description": "本接口用于发起 AI 时装虚拟试穿流程。您可以使用模板 ID，或提供参考图（源文件与参考文件）。任务会异步处理，您可以使用本响应返回的 task_id 查询其状态。\n",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunClothsTaskV2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "AI 时装虚拟试穿 任务执行成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "任务执行失败",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/RunError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth/{task_id}": {
      "get": {
        "summary": "查询 AI 时装虚拟试穿 任务的状态。",
        "tags": [
          "V2.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "要查询的任务 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "AI 时装虚拟试穿 任务状态查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStatusResponseV2"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth-v3": {
      "post": {
        "summary": "执行 AI 时装虚拟试穿 V3（V3） 任务。",
        "description": "AI 任务是异步处理的。功能支持 Webhook 时，优先用 Webhook 来接收完成通知。配置好您的 Webhook 端点、校验 Webhook 签名，收到 `success` 或 `error` 通知后，用收到的 `task_id` 查询任务结果。配置与校验的细节请见 [Webhook 接入指南](/develop/webhook.md)。\n\n若功能不支持 Webhook，或您的接入方式用不了 Webhook，就请实现轮询。提交 AI 任务后，按固定间隔（例如每 10 秒）轮询状态接口，直到任务状态变为 `success` 或 `error`。\n",
        "tags": [
          "V3.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RunClothV3Task"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务执行成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "任务执行失败",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/RunError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth-v3/{task_id}": {
      "get": {
        "summary": "查询 AI 时装虚拟试穿 V3（V3） 任务的状态。",
        "tags": [
          "V3.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "要查询的任务 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "任务状态查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStatusResponseV2"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth-v4": {
      "post": {
        "summary": "执行 AI 时装虚拟试穿 V4（V4） 任务。",
        "x-display-name": "AI Clothes Virtual Try-On",
        "x-engine-version": "V4.0",
        "description": "AI 任务是异步处理的。功能支持 Webhook 时，优先用 Webhook 来接收完成通知。配置好您的 Webhook 端点、校验 Webhook 签名，收到 `success` 或 `error` 通知后，用收到的 `task_id` 查询任务结果。配置与校验的细节请见 [Webhook 接入指南](/develop/webhook.md)。\n\n若功能不支持 Webhook，或您的接入方式用不了 Webhook，就请实现轮询。提交 AI 任务后，按固定间隔（例如每 10 秒）轮询状态接口，直到任务状态变为 `success` 或 `error`。\n",
        "tags": [
          "V4.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/RunClothV4Task"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务执行成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BasicRunTaskResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "任务执行失败",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/RunError"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/s2s/v2.0/task/cloth-v4/{task_id}": {
      "get": {
        "summary": "查询 AI 时装虚拟试穿 V4（V4） 任务的状态。",
        "x-display-name": "AI Clothes Virtual Try-On",
        "x-engine-version": "V4.0",
        "tags": [
          "V4.0"
        ],
        "security": [
          {
            "BearerAuthenticationV2": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
            },
            "description": "要查询的任务 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "任务状态查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskStatusResponseV2"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidTaskId"
          },
          "401": {
            "$ref": "#/components/responses/InvalidApiKey"
          },
          "500": {
            "$ref": "#/components/responses/TaskTimeout"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuthenticationV2": {
        "type": "http",
        "scheme": "bearer",
        "description": "使用标准的 Bearer 鉴权。把您的 API 密钥放进请求头： `Authorization:Bearer YOUR_API_KEY`。请注意 'Bearer' 与 'YOUR_API_KEY' 之间有一个空格。"
      }
    },
    "schemas": {
      "RunClothsTaskV2Template": {
        "required": [
          "template_id"
        ],
        "properties": {
          "template_id": {
            "type": "string",
            "description": "模板 ID。请先调用列出预置模板的接口，再取用其中某个模板的 ID。",
            "example": "good_template_001"
          }
        }
      },
      "RunClothsTaskV2GarmentCategory": {
        "required": [
          "garment_category"
        ],
        "properties": {
          "garment_category": {
            "type": "string",
            "enum": [
              "full_body",
              "lower_body",
              "upper_body",
              "shoes",
              "auto"
            ],
            "description": "参考图中服装的类别。提供参考图时必填。 传 \"auto\" 可让 AI 引擎自动识别并归类服装类别。"
          }
        }
      },
      "RunClothsTaskV2": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与参考文件 URL 运行任务",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与参考文件 ID 运行任务",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与参考文件 URL 运行任务",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与参考文件 ID 运行任务",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与模板运行任务"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2Template"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与模板运行任务"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2Template"
                  }
                ]
              }
            ]
          },
          {
            "properties": {
              "change_shoes": {
                "type": "boolean",
                "default": true,
                "description": "当可用的全身参考图带有鞋子时，用于控制是否替换鞋子。"
              }
            }
          }
        ]
      },
      "RunClothV3Task": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与参考文件 URL 运行任务",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与参考文件 ID 运行任务",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与参考文件 URL 运行任务",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与参考文件 ID 运行任务",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV2GarmentCategory"
                  }
                ]
              }
            ]
          },
          {
            "properties": {
              "change_shoes": {
                "type": "boolean",
                "default": true,
                "description": "当可用的全身参考图带有鞋子时，用于控制是否替换鞋子。\n<br> 仅在 `garment_category` 为 `full_body` 或 `lower_body` 时生效\n"
              }
            }
          }
        ]
      },
      "RunClothsTaskV4GarmentCategory": {
        "required": [
          "garment_category"
        ],
        "properties": {
          "garment_category": {
            "type": "string",
            "enum": [
              "full_body",
              "lower_body",
              "upper_body",
              "shoes",
              "auto",
              "outer"
            ],
            "description": "参考图中服装的类别。提供参考图时必填。 传 \"auto\" 可让 AI 引擎自动识别并归类服装类别。"
          }
        }
      },
      "RunClothV4Task": {
        "allOf": [
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与参考文件 URL 运行任务",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 URL 与参考文件 ID 运行任务",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与参考文件 URL 运行任务",
                    "required": [
                      "ref_file_url"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileUrl"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              },
              {
                "allOf": [
                  {
                    "title": "以源文件 ID 与参考文件 ID 运行任务",
                    "required": [
                      "ref_file_id"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2SrcFileId"
                  },
                  {
                    "$ref": "#/components/schemas/BasicRunTaskV2RefFileId"
                  },
                  {
                    "$ref": "#/components/schemas/RunClothsTaskV4GarmentCategory"
                  }
                ]
              }
            ]
          },
          {
            "properties": {
              "change_shoes": {
                "type": "boolean",
                "default": true,
                "description": "当可用的全身参考图带有鞋子时，用于控制是否替换鞋子。\n<br> 仅在 `garment_category` 为 `full_body` 或 `lower_body` 时生效\n"
              },
              "filter_multi_person": {
                "type": "string",
                "enum": [
                  "off",
                  "normal",
                  "strict"
                ],
                "default": "off",
                "description": "过滤源图与人体参考图中的多人情况。\n<br> `off` - 不过滤。引擎取图中最大的人物。\n<br> `normal` - 当另一个人主体大小相当，或在同一平面上清晰可见时拒绝，例如近处站着、面孔清楚的人；典型的多人与双人合照。远处或模糊的背景人物会被忽略。\n<br> `strict` - 只要出现任何额外人物就拒绝，包括很小、很远、背景中或模糊失焦的人。\n"
              }
            }
          }
        ]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "模板的 ID。运行任务时把它作为 `template_id` 使用。",
            "example": "good_template_001"
          },
          "thumb": {
            "type": "string",
            "description": "风格缩略图。"
          },
          "title": {
            "type": "string",
            "description": "模板名称。"
          },
          "category_name": {
            "type": "string",
            "description": "模板的类别名称。"
          }
        }
      },
      "BasicRunTaskV2SrcFileUrl": {
        "type": "object",
        "required": [
          "src_file_url"
        ],
        "properties": {
          "src_file_url": {
            "type": "string",
            "description": "用于运行任务的文件 URL，该 URL 需可公开访问。",
            "example": "https://example.com/selfie.jpg"
          }
        }
      },
      "BasicRunTaskV2RefFileUrl": {
        "type": "object",
        "properties": {
          "ref_file_url": {
            "type": "string",
            "description": "用于运行任务的参考文件 URL，该 URL 需可公开访问。",
            "example": "https://example.com/accessory.jpg"
          }
        }
      },
      "BasicRunTaskV2RefFileId": {
        "type": "object",
        "properties": {
          "ref_file_id": {
            "type": "string",
            "description": "用于运行任务的参考文件 ID，取自上传文件接口返回的 file_id。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskV2SrcFileId": {
        "type": "object",
        "required": [
          "src_file_id"
        ],
        "properties": {
          "src_file_id": {
            "type": "string",
            "description": "用于运行任务的文件 ID，取自上传文件接口返回的 file_id。",
            "example": "pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE="
          }
        }
      },
      "BasicRunTaskResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "响应状态",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_id": {
                "type": "string",
                "description": "该任务的 ID。凭这个 ID 可在 24 小时内查询任务结果。",
                "example": "grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe"
              }
            }
          }
        }
      },
      "RunError": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "响应状态",
            "example": 400
          },
          "error": {
            "type": "string",
            "description": "错误信息",
            "example": "The operation could not be completed"
          },
          "error_code": {
            "type": "string",
            "enum": [
              "InvalidParameters",
              "CreditInsufficiency",
              "InvalidStyleGroup",
              "InvalidStyle",
              "BadRequest"
            ],
            "description": "错误码：\n  * InvalidParameters - 请求参数无效\n  * CreditInsufficiency - 点数不足，无法运行\n  * BadRequest - 请求参数不符合预期\n  * InvalidStyleGroup - 风格分组 ID 无效\n  * InvalidStyle - 风格 ID 无效\n"
          }
        }
      },
      "EngineErrorCode": {
        "type": "string",
        "nullable": true,
        "enum": [
          "error_exceed_max_image_size",
          "exceed_max_filesize",
          "invalid_parameter",
          "error_download_image",
          "error_download_mask",
          "error_decode_image",
          "error_decode_mask",
          "error_nsfw_content_detected",
          "error_no_face",
          "error_pose",
          "error_face_parsing",
          "error_inference",
          "exceed_nsfw_retry_limits",
          "error_upload",
          "unknown_internal_error"
        ],
        "description": "错误码：\n- \\`error_exceed_max_image_size\\`  - 输入图片尺寸超出上限\n- \\`exceed_max_filesize\\` - 输入文件大小超出上限\n- \\`invalid_parameter\\` - 参数取值无效\n- \\`error_download_image\\` - 下载原图出错\n- \\`error_download_mask\\` - 下载蒙版图片出错\n- \\`error_decode_image\\` - 解码原图出错\n- \\`error_decode_mask\\` - 解码蒙版图片出错\n- \\`error_nsfw_content_detected\\` - 在原图中检测到不适宜内容（NSFW）\n- \\`error_no_face\\` - 原图中没有检测到人脸\n- \\`error_pose\\` - 原图的姿态检测失败\n- \\`error_face_parsing\\` - 原图的人脸分割失败\n- \\`error_inference\\` - 推理流程中出现错误\n- \\`exceed_nsfw_retry_limits\\` - 为避免生成不适宜内容， 重试次数已用尽\n- \\`error_upload\\` - 上传结果图片出错\n- \\`unknown_internal_error\\` - 其他错误\n"
      },
      "TaskStatusResponseBodySingleUrlResultsV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "下载该结果的 URL，有效期 2 小时",
            "example": "https://example.com/sample-result-url"
          }
        }
      },
      "TaskStatusResponseV2": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "响应状态",
            "example": 200
          },
          "data": {
            "type": "object",
            "properties": {
              "task_status": {
                "type": "string",
                "enum": [
                  "running",
                  "success",
                  "error"
                ],
                "description": "任务状态"
              },
              "error": {
                "$ref": "#/components/schemas/EngineErrorCode"
              },
              "error_message": {
                "type": "string",
                "description": "错误的详细说明"
              },
              "results": null
            }
          }
        },
        "$ref": "#/components/schemas/TaskStatusResponseBodySingleUrlResultsV2"
      }
    },
    "responses": {
      "TemplateResponse": {
        "description": "成功获取风格列表",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "description": "响应状态",
                  "example": 200
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Template"
                      }
                    },
                    "next_token": {
                      "type": "string",
                      "example": "73a3c9e69b89",
                      "description": "用于查询下一页的 token。"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "InvalidParameters": {
        "description": "请求参数无效",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "响应状态"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid parameter value"
                },
                "error_code": {
                  "type": "string",
                  "example": "InvalidParameters"
                }
              }
            }
          }
        }
      },
      "InvalidApiKey": {
        "description": "API 密钥无效或缺失",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 401,
                  "description": "响应状态"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid API key"
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "请求过多",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 429,
                  "description": "响应状态"
                },
                "error": {
                  "type": "string",
                  "example": "Too many requests"
                }
              }
            }
          }
        }
      },
      "InvalidTaskId": {
        "description": "任务 ID 无效",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 400,
                  "description": "响应状态"
                },
                "error": {
                  "type": "string",
                  "example": "Invalid task ID"
                }
              }
            }
          }
        }
      },
      "TaskTimeout": {
        "description": "任务执行超时",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer",
                  "example": 500,
                  "description": "响应状态"
                },
                "error": {
                  "type": "string",
                  "example": "Task execution timed out"
                }
              }
            }
          }
        }
      }
    }
  }
}