{
  "openapi": "3.0.1",
  "info": {
    "title": "API 接口规范",
    "description": "面向调用方的 Relay 接口规范。所有接口使用 Bearer Token 鉴权，示例服务器地址请替换为实际网关地址。",
    "version": "1.0.0",
    "contact": {
      "name": "API 文档"
    }
  },
  "servers": [
    {
      "url": "https://YOUR_API_BASE_URL",
      "description": "示例网关地址，请替换为实际地址"
    }
  ],
  "tags": [
    {
      "name": "Claude",
      "description": "Claude 相关接口"
    },
    {
      "name": "Gemini",
      "description": "Gemini 相关接口"
    },
    {
      "name": "图像",
      "description": "图像 相关接口"
    },
    {
      "name": "文件",
      "description": "文件 相关接口"
    },
    {
      "name": "文本 / Chat",
      "description": "文本 / Chat 相关接口"
    },
    {
      "name": "文本 / Responses",
      "description": "文本 / Responses 相关接口"
    },
    {
      "name": "模型",
      "description": "模型 相关接口"
    },
    {
      "name": "视频",
      "description": "视频 相关接口"
    },
    {
      "name": "音频",
      "description": "音频 相关接口"
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "summary": "获取模型列表",
        "deprecated": false,
        "description": "获取当前可用的模型列表。\n\n根据请求头自动识别返回格式：\n- 包含 `x-api-key` 和 `anthropic-version` 头时返回 Anthropic 格式\n- 包含 `x-goog-api-key` 头或 `key` 查询参数时返回 Gemini 格式\n- 其他情况返回 OpenAI 格式\n",
        "operationId": "listModels",
        "tags": [
          "模型"
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "description": "Google API Key (用于 Gemini 格式)",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Anthropic API Key (用于 Claude 格式)",
            "required": false,
            "example": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "anthropic-version",
            "in": "header",
            "description": "Anthropic API 版本",
            "required": false,
            "example": "",
            "schema": {
              "type": "string",
              "example": "2023-06-01"
            }
          },
          {
            "name": "x-goog-api-key",
            "in": "header",
            "description": "Google API Key (用于 Gemini 格式)",
            "required": false,
            "example": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功获取模型列表",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                }
              }
            },
            "headers": {}
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1beta/models": {
      "get": {
        "summary": "Gemini 格式获取",
        "deprecated": false,
        "description": "以 Gemini API 格式返回可用模型列表",
        "operationId": "listModelsGemini",
        "tags": [
          "模型"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "成功获取模型列表",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiModelsResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "创建聊天对话",
        "deprecated": false,
        "description": "根据对话历史创建模型响应。支持流式和非流式响应。\n\n兼容 OpenAI Chat Completions API。\n",
        "operationId": "createChatCompletion",
        "tags": [
          "文本 / Chat"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "成功创建响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              }
            },
            "headers": {}
          },
          "400": {
            "description": "请求参数错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "429": {
            "description": "请求频率限制",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/responses": {
      "post": {
        "summary": "创建响应 (OpenAI Responses API)",
        "deprecated": false,
        "description": "OpenAI Responses API，用于创建模型响应。\n支持多轮对话、工具调用、推理等功能。\n",
        "operationId": "createResponse",
        "tags": [
          "文本 / Responses"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "成功创建响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponsesResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/responses/compact": {
      "post": {
        "summary": "压缩对话 (OpenAI Responses API)",
        "deprecated": false,
        "description": "OpenAI Responses API，用于对长对话进行 compaction。",
        "operationId": "compactResponse",
        "tags": [
          "文本 / Responses"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesCompactionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "成功压缩对话",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponsesCompactionResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/images/generations": {
      "post": {
        "summary": "生成图像",
        "deprecated": false,
        "description": "图像生成接口。模型 `seedream-v5-pro-n` 使用本接口；模型支持的尺寸、比例、质量和参考图能力以实际响应为准。",
        "operationId": "createImage",
        "tags": [
          "图像"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              },
              "example": {
                "model": "seedream-v5-pro-n",
                "prompt": "一只橘猫坐在窗边，午后阳光，写实摄影风格",
                "n": 1,
                "size": "1024x1024",
                "aspect_ratio": "1:1",
                "response_format": "url"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功生成图像",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/images/edits": {
      "post": {
        "summary": "编辑图像(qwen-image-edit)",
        "deprecated": false,
        "description": " 百炼qwen-image系列图片生成",
        "operationId": "createImage",
        "tags": [
          "图像"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "input": {
                    "type": "object",
                    "properties": {
                      "messages": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "role": {
                              "type": "string"
                            },
                            "content": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "image": {
                                    "type": "string"
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "required": [
                      "messages"
                    ]
                  },
                  "parameters": {
                    "type": "object",
                    "properties": {
                      "n": {
                        "type": "integer"
                      },
                      "negative_prompt": {
                        "type": "string"
                      },
                      "prompt_extend": {
                        "type": "boolean"
                      },
                      "watermark": {
                        "type": "boolean"
                      },
                      "size": {
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "model",
                  "input"
                ]
              },
              "example": "{\n    \"model\": \"qwen-image-edit-plus\",\n    \"input\": {\n        \"messages\": [\n            {\n                \"role\": \"user\",\n                \"content\": [\n                    {\n                        \"image\": \"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp\"\n                    },\n                    {\n                        \"text\": \"生成一张符合深度图的图像，遵循以下描述：一辆红色的破旧的自行车停在一条泥泞的小路上，背景是茂密的原始森林\"\n                    }\n                ]\n            }\n        ]\n    },\n    \"parameters\": {\n        \"n\": 2,\n        \"negative_prompt\": \" \",\n        \"prompt_extend\": true,\n        \"watermark\": false\n    }"
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功生成图像",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/videos": {
      "post": {
        "summary": "创建视频 ",
        "deprecated": false,
        "description": "统一视频生成接口。只接受 application/json content 多模态格式，不支持 multipart 或其他顶层字段。字段、状态和结果地址由网关统一转换。MiniMax H3 可省略 resolution（默认 384P），并支持 num_inference_steps、turbo、lora_preset 与 lora_strength；具体约束见 MiniMax H3 独立文档。\n",
        "operationId": "createVideo",
        "tags": [
          "视频"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UnifiedVideoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功创建视频任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnifiedVideoTask"
                },
                "example": {
                  "id": "task_xxxxxxxxx",
                  "status": "queued"
                }
              }
            },
            "headers": {}
          },
          "400": {
            "description": "请求参数错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "415": {
            "description": "仅支持 application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/videos/{task_id}": {
      "get": {
        "summary": "获取视频任务状态 ",
        "deprecated": false,
        "description": "统一视频任务状态查询接口。\n\n返回视频任务的详细状态信息。\n",
        "operationId": "getVideo",
        "tags": [
          "视频"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "description": "视频任务 ID",
            "required": true,
            "example": "task_xxxxxxxxx",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功获取视频任务状态",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnifiedVideoTask"
                },
                "example": {
                  "id": "task_xxxxxxxxx",
                  "status": "succeeded",
                  "content": {
                    "video_url": "https://YOUR_API_BASE_URL/v1/videos/task_xxxxxxxxx/content"
                  }
                }
              }
            },
            "headers": {}
          },
          "404": {
            "description": "任务不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "delete": {
        "summary": "取消或删除 MiniMax H3 视频任务",
        "deprecated": false,
        "description": "仅 MiniMax H3 支持。queued 或运行中的任务会取消；succeeded、failed 或 expired 任务会删除任务记录，本地任务及用量记录会保留。",
        "operationId": "cancelOrDeleteVideo",
        "tags": [
          "视频"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "description": "网关公开视频任务 ID",
            "required": true,
            "example": "task_xxxxxxxxx",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "任务已取消或记录已删除",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationResponse"
                }
              }
            },
            "headers": {}
          },
          "400": {
            "description": "任务当前状态不可操作",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "401": {
            "description": "鉴权失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "404": {
            "description": "任务不存在或不属于当前 API Token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "409": {
            "description": "本地任务状态在请求期间已变化",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "429": {
            "description": "服务限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "500": {
            "description": "服务端错误",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "501": {
            "description": "该模型不支持取消任务",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          },
          "502": {
            "description": "无法请求服务或服务返回无效响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTaskCancellationErrorResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/videos/{task_id}/content": {
      "get": {
        "summary": "获取视频内容",
        "deprecated": false,
        "description": "获取已完成视频任务的视频文件内容。\n\n此接口会代理返回视频文件流。\n",
        "operationId": "getVideoContent",
        "tags": [
          "视频"
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "description": "视频任务 ID",
            "required": true,
            "example": "task_xxxxxxxxx",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功获取视频内容",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {}
          },
          "404": {
            "description": "视频不存在或未完成",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/messages": {
      "post": {
        "summary": "Claude 聊天",
        "deprecated": false,
        "description": "Anthropic Claude Messages API 格式的请求。\n需要在请求头中包含 `anthropic-version`。\n",
        "operationId": "createMessage",
        "tags": [
          "Claude"
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "description": "Anthropic API 版本",
            "required": true,
            "example": "",
            "schema": {
              "type": "string",
              "example": "2023-06-01"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "description": "Anthropic API Key (可选，也可使用 Bearer Token)",
            "required": false,
            "example": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaudeRequest"
              },
              "examples": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功创建响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaudeResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1beta/models/{model}:generateContent": {
      "post": {
        "summary": "Gemini 图片(Nano Banana)",
        "deprecated": false,
        "description": "Gemini 图片生成",
        "operationId": "geminiRelayV1Beta",
        "tags": [
          "Gemini"
        ],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "description": "模型名称",
            "required": true,
            "example": "gemini-3-pro-image-preview",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contents": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "generationConfig": {
                    "type": "object",
                    "properties": {
                      "responseModalities": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "imageConfig": {
                        "type": "object",
                        "properties": {
                          "aspectRatio": {
                            "type": "string"
                          },
                          "imageSize": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "required": [
                      "responseModalities"
                    ]
                  }
                },
                "required": [
                  "contents",
                  "generationConfig"
                ]
              },
              "example": {
                "contents": [
                  {
                    "role": "user",
                    "parts": [
                      {
                        "text": "draw a cat"
                      }
                    ]
                  }
                ],
                "generationConfig": {
                  "responseModalities": [
                    "TEXT",
                    "IMAGE"
                  ],
                  "imageConfig": {
                    "aspectRatio": "16:9",
                    "imageSize": "4K"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "summary": "音频转录",
        "deprecated": false,
        "description": "将音频转换为文本",
        "operationId": "createTranscription",
        "tags": [
          "音频"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "音频文件",
                    "example": ""
                  },
                  "model": {
                    "type": "string",
                    "example": "whisper-1"
                  },
                  "language": {
                    "type": "string",
                    "description": "ISO-639-1 语言代码",
                    "example": ""
                  },
                  "prompt": {
                    "type": "string",
                    "example": ""
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "text",
                      "srt",
                      "verbose_json",
                      "vtt"
                    ],
                    "default": "json",
                    "example": "json"
                  },
                  "temperature": {
                    "type": "number",
                    "example": 0
                  },
                  "timestamp_granularities": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "word",
                        "segment"
                      ]
                    },
                    "example": ""
                  }
                },
                "required": [
                  "file",
                  "model"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "成功转录",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/audio/translations": {
      "post": {
        "summary": "音频翻译",
        "deprecated": false,
        "description": "将音频翻译为英文文本",
        "operationId": "createTranslation",
        "tags": [
          "音频"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "example": ""
                  },
                  "model": {
                    "type": "string",
                    "example": ""
                  },
                  "prompt": {
                    "type": "string",
                    "example": ""
                  },
                  "response_format": {
                    "type": "string",
                    "example": ""
                  },
                  "temperature": {
                    "type": "number",
                    "example": 0
                  }
                },
                "required": [
                  "file",
                  "model"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "成功翻译",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/audio/speech": {
      "post": {
        "summary": "文本转语音",
        "deprecated": false,
        "description": "将文本转换为音频",
        "operationId": "createSpeech",
        "tags": [
          "音频"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "成功生成音频",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/files": {
      "post": {
        "summary": "上传视频素材文件",
        "deprecated": false,
        "description": "上传图片、视频或音频到平台存储。成功后先得到平台 file ID；调用查询接口取得可供视频接口读取的公网 URL。单个文件最大 100 MiB。",
        "operationId": "createFile",
        "tags": [
          "文件"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "图片、视频或音频文件；服务端按内容识别类型，最大 100 MiB"
                  },
                  "purpose": {
                    "type": "string",
                    "default": "vision",
                    "description": "素材用途；省略时为 vision"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "上传成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileResponse"
                },
                "example": {
                  "id": "file_a1b2c3d4",
                  "object": "file",
                  "filename": "person.png",
                  "purpose": "vision",
                  "bytes": 248102,
                  "created_at": 1781180000
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/files/{file_id}": {
      "get": {
        "summary": "查询视频素材文件",
        "deprecated": false,
        "description": "返回当前 API Token 所属用户的素材元数据和供视频接口读取的 URL。不可直接把 file_id 填入视频请求的媒体 URL 字段。",
        "operationId": "retrieveFile",
        "tags": [
          "文件"
        ],
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "description": "上传接口返回的平台 file_* ID",
            "required": true,
            "example": "file_a1b2c3d4",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "文件信息",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileResponse"
                },
                "example": {
                  "id": "file_a1b2c3d4",
                  "object": "file",
                  "filename": "person.png",
                  "purpose": "vision",
                  "bytes": 248102,
                  "created_at": 1781180000,
                  "url": "https://media.example.com/media/uploads/2026/08/file_a1b2c3d4.png"
                }
              }
            },
            "headers": {}
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/files/{file_id}/content": {
      "get": {
        "summary": "下载视频素材文件",
        "deprecated": false,
        "description": "验证文件归属后，以 307 重定向到 COS 公共 URL 或预签名下载 URL。HTTP 客户端通常会自动跟随此重定向。",
        "operationId": "downloadFile",
        "tags": [
          "文件"
        ],
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "description": "上传接口返回的平台 file_* ID",
            "required": true,
            "example": "file_a1b2c3d4",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "307": {
            "description": "重定向到 COS 文件访问 URL",
            "headers": {
              "Location": {
                "description": "素材下载地址",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sk-xxxxxxxx",
        "description": "在请求头中发送 Authorization: Bearer sk-xxxxxxxx"
      }
    },
    "schemas": {
      "FileResponse": {
        "type": "object",
        "required": [
          "id",
          "object",
          "filename",
          "bytes",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "平台文件 ID"
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "filename": {
            "type": "string",
            "description": "上传时的原始文件名"
          },
          "purpose": {
            "type": "string",
            "description": "素材用途"
          },
          "bytes": {
            "type": "integer",
            "format": "int64",
            "description": "文件大小，单位为字节"
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "上传时间 Unix 时间戳"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "仅查询响应提供，可直接填入视频请求的媒体 URL 字段"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "错误信息"
              },
              "type": {
                "type": "string",
                "description": "错误类型"
              },
              "param": {
                "type": "string",
                "description": "相关参数",
                "nullable": true
              },
              "code": {
                "type": "string",
                "description": "错误代码",
                "nullable": true
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "额外错误详情。",
            "additionalProperties": true
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "提示词 Token 数"
          },
          "completion_tokens": {
            "type": "integer",
            "description": "补全 Token 数"
          },
          "total_tokens": {
            "type": "integer",
            "description": "总 Token 数"
          },
          "prompt_tokens_details": {
            "type": "object",
            "properties": {
              "cached_tokens": {
                "type": "integer"
              },
              "text_tokens": {
                "type": "integer"
              },
              "audio_tokens": {
                "type": "integer"
              },
              "image_tokens": {
                "type": "integer"
              }
            }
          },
          "completion_tokens_details": {
            "type": "object",
            "properties": {
              "text_tokens": {
                "type": "integer"
              },
              "audio_tokens": {
                "type": "integer"
              },
              "reasoning_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "模型 ID",
            "example": "gpt-4"
          },
          "object": {
            "type": "string",
            "description": "对象类型",
            "example": "model"
          },
          "created": {
            "type": "integer",
            "description": "创建时间戳"
          },
          "owned_by": {
            "type": "string",
            "description": "模型所有者",
            "example": "openai"
          }
        }
      },
      "ModelsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "example": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "GeminiModelsResponse": {
        "type": "object",
        "properties": {
          "models": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "example": "models/gemini-pro"
                },
                "version": {
                  "type": "string"
                },
                "displayName": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "inputTokenLimit": {
                  "type": "integer"
                },
                "outputTokenLimit": {
                  "type": "integer"
                },
                "supportedGenerationMethods": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool",
              "developer"
            ],
            "description": "消息角色"
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageContent"
                }
              }
            ],
            "description": "消息内容"
          },
          "name": {
            "type": "string",
            "description": "发送者名称"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolCall"
            }
          },
          "tool_call_id": {
            "type": "string",
            "description": "工具调用 ID（用于 tool 角色消息）"
          },
          "reasoning_content": {
            "type": "string",
            "description": "推理内容"
          }
        }
      },
      "MessageContent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "image_url",
              "input_audio",
              "file",
              "video_url"
            ]
          },
          "text": {
            "type": "string"
          },
          "image_url": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "description": "图片 URL 或 base64"
              },
              "detail": {
                "type": "string",
                "enum": [
                  "low",
                  "high",
                  "auto"
                ]
              }
            }
          },
          "input_audio": {
            "type": "object",
            "properties": {
              "data": {
                "type": "string",
                "description": "Base64 编码的音频数据"
              },
              "format": {
                "type": "string",
                "enum": [
                  "wav",
                  "mp3"
                ]
              }
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string"
              },
              "file_data": {
                "type": "string"
              },
              "file_id": {
                "type": "string"
              }
            }
          },
          "video_url": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            }
          }
        }
      },
      "ToolCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "example": "function"
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "arguments": {
                "type": "string"
              }
            }
          }
        }
      },
      "Tool": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "function"
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "type": "object",
                "description": "JSON Schema 格式的参数定义",
                "properties": {}
              }
            }
          }
        }
      },
      "ResponseFormat": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "json_object",
              "json_schema"
            ]
          },
          "json_schema": {
            "type": "object",
            "description": "JSON Schema 定义",
            "properties": {}
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "模型 ID",
            "example": "gpt-4"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "description": "对话消息列表"
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "default": 1,
            "description": "采样温度"
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 1,
            "description": "核采样参数"
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "default": 1,
            "description": "生成数量"
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "是否流式响应"
          },
          "stream_options": {
            "type": "object",
            "properties": {
              "include_usage": {
                "type": "boolean"
              }
            }
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "停止序列"
          },
          "max_tokens": {
            "type": "integer",
            "description": "最大生成 Token 数"
          },
          "max_completion_tokens": {
            "type": "integer",
            "description": "最大补全 Token 数"
          },
          "presence_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0
          },
          "frequency_penalty": {
            "type": "number",
            "minimum": -2,
            "maximum": 2,
            "default": 0
          },
          "logit_bias": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            },
            "properties": {}
          },
          "user": {
            "type": "string"
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "none",
                  "auto",
                  "required"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "function": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            ]
          },
          "response_format": {
            "$ref": "#/components/schemas/ResponseFormat"
          },
          "seed": {
            "type": "integer"
          },
          "reasoning_effort": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "description": "推理强度 (用于支持推理的模型)"
          },
          "modalities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "text",
                "audio"
              ]
            }
          },
          "audio": {
            "type": "object",
            "properties": {
              "voice": {
                "type": "string"
              },
              "format": {
                "type": "string"
              }
            }
          }
        }
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "example": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/Message"
                },
                "finish_reason": {
                  "type": "string",
                  "enum": [
                    "stop",
                    "length",
                    "tool_calls",
                    "content_filter"
                  ]
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "system_fingerprint": {
            "type": "string"
          }
        }
      },
      "ResponsesRequest": {
        "type": "object",
        "required": [
          "model"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "description": "输入内容，可以是字符串或消息数组",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {}
                }
              }
            ]
          },
          "instructions": {
            "type": "string"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "stream": {
            "type": "boolean"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {}
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {}
              }
            ]
          },
          "reasoning": {
            "type": "object",
            "properties": {
              "effort": {
                "type": "string",
                "enum": [
                  "low",
                  "medium",
                  "high"
                ]
              },
              "summary": {
                "type": "string"
              }
            }
          },
          "previous_response_id": {
            "type": "string"
          },
          "truncation": {
            "type": "string",
            "enum": [
              "auto",
              "disabled"
            ]
          }
        }
      },
      "ResponsesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "example": "response"
          },
          "created_at": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "failed",
              "in_progress",
              "incomplete"
            ]
          },
          "model": {
            "type": "string"
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                },
                "content": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "text": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ResponsesCompactionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "example": "response.compaction"
          },
          "created_at": {
            "type": "integer"
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {}
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "error": {
            "type": "object",
            "properties": {}
          }
        }
      },
      "ResponsesCompactionRequest": {
        "type": "object",
        "required": [
          "model"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "description": "输入内容，可以是字符串或消息数组",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {}
                }
              }
            ]
          },
          "instructions": {
            "type": "string"
          },
          "previous_response_id": {
            "type": "string"
          }
        }
      },
      "ClaudeRequest": {
        "type": "object",
        "required": [
          "model",
          "messages",
          "max_tokens"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "claude-3-opus-20240229"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClaudeMessage"
            }
          },
          "system": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {}
                }
              }
            ]
          },
          "cache_control": {
            "type": "object",
            "properties": {}
          },
          "inference_geo": {
            "type": "string"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "top_p": {
            "type": "number"
          },
          "top_k": {
            "type": "integer"
          },
          "stream": {
            "type": "boolean"
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "input_schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "any",
                      "tool",
                      "none"
                    ]
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "thinking": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "enabled",
                  "disabled"
                ]
              },
              "budget_tokens": {
                "type": "integer"
              }
            }
          },
          "context_management": {
            "type": "object",
            "properties": {}
          },
          "output_config": {
            "type": "object",
            "properties": {}
          },
          "output_format": {
            "type": "object",
            "properties": {}
          },
          "container": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {}
              }
            ]
          },
          "mcp_servers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {}
            }
          },
          "metadata": {
            "type": "object",
            "properties": {
              "user_id": {
                "type": "string"
              }
            }
          },
          "speed": {
            "type": "string",
            "enum": [
              "standard",
              "fast"
            ]
          },
          "service_tier": {
            "type": "string",
            "enum": [
              "auto",
              "standard_only"
            ]
          }
        }
      },
      "ClaudeMessage": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "text",
                        "image",
                        "tool_use",
                        "tool_result"
                      ]
                    },
                    "text": {
                      "type": "string"
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "base64",
                            "url"
                          ]
                        },
                        "media_type": {
                          "type": "string"
                        },
                        "data": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      }
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "properties": {}
                    },
                    "tool_use_id": {
                      "type": "string"
                    },
                    "content": {
                      "type": "string"
                    }
                  }
                }
              }
            ]
          }
        }
      },
      "ClaudeResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "example": "message"
          },
          "role": {
            "type": "string",
            "example": "assistant"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "model": {
            "type": "string"
          },
          "stop_reason": {
            "type": "string",
            "enum": [
              "end_turn",
              "max_tokens",
              "stop_sequence",
              "tool_use"
            ]
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "cache_creation_input_tokens": {
                "type": "integer"
              },
              "cache_read_input_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ImageGenerationRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "seedream-v5-pro-n"
          },
          "prompt": {
            "type": "string",
            "description": "图像描述"
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 128,
            "default": 1
          },
          "size": {
            "type": "string",
            "description": "输出尺寸或分辨率档位；允许值取决于所选模型。"
          },
          "aspect_ratio": {
            "type": "string",
            "description": "输出宽高比；仅在所选模型支持时生效。"
          },
          "quality": {
            "type": "string",
            "description": "图像质量档位；允许值取决于所选模型。"
          },
          "style": {
            "type": "string",
            "description": "图像风格；仅在所选模型支持时生效。"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "url",
              "b64_json"
            ],
            "default": "url"
          },
          "user": {
            "type": "string"
          },
          "images": {
            "type": "array",
            "description": "参考图列表；仅在所选模型支持时生效。",
            "items": {
              "type": "string"
            }
          },
          "image": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "单张或多张参考图；仅在所选模型支持时生效。"
          },
          "mask": {
            "type": "string",
            "description": "图像编辑蒙版；仅在所选模型支持时生效。"
          },
          "input_fidelity": {
            "type": "string",
            "description": "参考图保真度；仅在所选模型支持时生效。"
          },
          "background": {
            "type": "string",
            "description": "背景模式；仅在所选模型支持时生效。"
          },
          "moderation": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object"
              }
            ],
            "description": "内容审核设置；仅在所选模型支持时生效。"
          },
          "output_format": {
            "type": "string",
            "description": "输出图像编码；仅在所选模型支持时生效。"
          },
          "output_compression": {
            "type": "integer",
            "description": "输出压缩等级；仅在所选模型支持时生效。"
          },
          "partial_images": {
            "type": "integer",
            "description": "流式响应时输出的中间图数量；仅在所选模型支持时生效。"
          },
          "watermark": {
            "type": "boolean",
            "description": "水印开关；仅在所选模型支持时生效。"
          },
          "stream": {
            "type": "boolean",
            "description": "启用图片流式响应；仅在所选模型支持时生效。"
          }
        }
      },
      "ImageResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "b64_json": {
                  "type": "string"
                },
                "revised_prompt": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AudioTranscriptionResponse": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          }
        }
      },
      "SpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input",
          "voice"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "tts-1"
          },
          "input": {
            "type": "string",
            "description": "要转换的文本",
            "maxLength": 4096
          },
          "voice": {
            "type": "string",
            "enum": [
              "alloy",
              "echo",
              "fable",
              "onyx",
              "nova",
              "shimmer"
            ]
          },
          "response_format": {
            "type": "string",
            "enum": [
              "mp3",
              "opus",
              "aac",
              "flac",
              "wav",
              "pcm"
            ],
            "default": "mp3"
          },
          "speed": {
            "type": "number",
            "minimum": 0.25,
            "maximum": 4,
            "default": 1
          }
        }
      },
      "GeminiResponse": {
        "type": "object",
        "properties": {
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "content": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "parts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    }
                  }
                },
                "finishReason": {
                  "type": "string"
                },
                "safetyRatings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {}
                  }
                }
              }
            }
          },
          "usageMetadata": {
            "type": "object",
            "properties": {
              "promptTokenCount": {
                "type": "integer"
              },
              "candidatesTokenCount": {
                "type": "integer"
              },
              "totalTokenCount": {
                "type": "integer"
              }
            }
          }
        }
      },
      "UnifiedVideoRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "采用 content 多模态格式的视频生成请求。",
        "required": [
          "model",
          "content",
          "duration",
          "ratio"
        ],
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "description": "公开模型名称"
          },
          "duration": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "description": "视频时长（秒）；具体范围由模型能力进一步限制"
          },
          "ratio": {
            "type": "string",
            "minLength": 1,
            "description": "画面比例"
          },
          "resolution": {
            "type": "string",
            "minLength": 1,
            "description": "输出分辨率。除 MiniMax H3 外必填；MiniMax H3 允许省略，默认 384P，且仅支持 384P、480P、768P",
            "example": "720p"
          },
          "generate_audio": {
            "type": "boolean",
            "description": "是否生成同步音频"
          },
          "watermark": {
            "type": "boolean",
            "description": "是否添加水印；不支持该参数的模型会返回 400，不会静默忽略"
          },
          "guidance_scale": {
            "type": "number",
            "description": "提示词引导强度；当前仅部分模型支持"
          },
          "num_inference_steps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "仅 MiniMax H3 支持。turbo=true 时必须为 4；启用 turbo 且省略时由网关 自动传 4"
          },
          "turbo": {
            "type": "boolean",
            "description": "仅 MiniMax H3 支持。文生、首尾帧和参考生视频均可使用；启用时固定为 4 步"
          },
          "lora_preset": {
            "type": "string",
            "enum": [
              "none",
              "momo_face",
              "aftermidnight",
              "hearmeman_hmcumshot"
            ],
            "default": "none",
            "description": "仅 MiniMax H3 支持的 LoRA 预设；momo_face 使用 momo_h3_face.safetensors"
          },
          "lora_strength": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "仅 MiniMax H3 支持的 LoRA 强度；省略时使用预设默认值，momo_face 默认 0.8"
          },
          "sampling": {
            "type": "object",
            "additionalProperties": false,
            "description": "仅 MiniMax H3 支持。兼容 H3 原生采样参数；与对应顶层参数同时提供且值冲突时返回 400 invalid_sampling",
            "properties": {
              "num_inference_steps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "turbo": {
                "type": "boolean"
              },
              "momo_face": {
                "type": "boolean"
              },
              "momo_face_strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 2
              }
            }
          },
          "content": {
            "type": "array",
            "minItems": 1,
            "description": "文本与媒体素材序列，至少包含一个非空 text 项。text 项只可带 text；媒体项只可带与 type 对应的 *_url，role 必须与媒体类型匹配。",
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "image_url",
                    "video_url",
                    "audio_url"
                  ]
                },
                "text": {
                  "type": "string",
                  "minLength": 1
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "reference_image",
                    "first_frame",
                    "last_frame",
                    "reference_video",
                    "reference_audio"
                  ]
                },
                "image_url": {
                  "$ref": "#/components/schemas/VideoMediaURL"
                },
                "video_url": {
                  "$ref": "#/components/schemas/VideoMediaURL"
                },
                "audio_url": {
                  "$ref": "#/components/schemas/VideoMediaURL"
                }
              }
            }
          }
        }
      },
      "VideoMediaURL": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "minLength": 1,
            "description": "公网 http/https 媒体 URL 或 Data URI；不接受客户端传入 asset://"
          }
        }
      },
      "UnifiedVideoTask": {
        "type": "object",
        "description": "统一视频任务对象",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "视频 ID",
            "example": "video-abc123"
          },
          "status": {
            "type": "string",
            "description": "任务状态",
            "enum": [
              "queued",
              "processing",
              "succeeded",
              "failed"
            ]
          },
          "content": {
            "type": "object",
            "required": [
              "video_url"
            ],
            "properties": {
              "video_url": {
                "type": "string",
                "description": "任务成功后由中转站提供的视频地址"
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/UnifiedVideoError"
          }
        }
      },
      "VideoTaskCancellationResponse": {
        "type": "object",
        "required": [
          "id",
          "action",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "网关公开任务 ID"
          },
          "action": {
            "type": "string",
            "enum": [
              "cancel",
              "delete"
            ],
            "description": "cancel 表示取消排队任务；delete 表示删除终态任务记录"
          },
          "status": {
            "type": "string",
            "enum": [
              "cancelled",
              "succeeded",
              "failed",
              "expired"
            ],
            "description": "执行操作后的任务状态"
          }
        }
      },
      "VideoTaskCancellationErrorResponse": {
        "type": "object",
        "required": [
          "code",
          "message",
          "data"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "错误码，例如 cancel_task_failed"
          },
          "message": {
            "type": "string",
            "description": "可用于排查的错误信息"
          },
          "data": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          }
        }
      },
      "UnifiedVideoError": {
        "type": "object",
        "description": "统一视频任务错误信息",
        "properties": {
          "message": {
            "type": "string",
            "description": "错误信息"
          },
          "code": {
            "type": "string",
            "description": "错误码"
          }
        }
      }
    },
    "responses": {}
  }
}
