# Wan 2.2 Spicy 视频生成 API 对接文档

支持文生视频、首帧图生视频和参考生视频。创建任务后返回 `taskId`，可轮询查询，也可在创建时提供回调地址。

## 接口地址

Base URL：`https://mm-internal-cn.leonecloud.com`

| 方法 | 路径 | 说明 |
| --- | --- | --- |
| POST | `/api/v2/open/aigc/wan-2.2-spicy` | 创建任务 |
| GET | `/api/v2/open/aigc/{taskId}` | 查询单个任务 |
| POST | `/api/v2/open/aigc/batch` | 批量查询任务 |

请求头：`Authorization: Bearer <YOUR_API_KEY>`；POST 使用 `Content-Type: application/json`。

## 创建任务

```bash
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/wan-2.2-spicy" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"一艘帆船驶过平静的湖面","resolution":"480p","duration":5,"ratio":"16:9"}'
```

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `prompt` | string | 必填。描述要生成的视频。 |
| `imageUrls` | string[] | 首帧图生视频时传入一张图片的 URL。 |
| `r2vMedia` | object[] | 参考生视频时传入，最多 5 个。每项包含 `type` 和 `url`；`type` 可为 `reference_image`、`reference_video` 或 `first_frame`。与 `imageUrls` 二选一；都不传即为文生视频。 |
| `resolution` | string | 固定为 `480p`。 |
| `duration` | integer | 5–8 秒，默认 5 秒。 |
| `ratio` | string | `16:9`（默认）、`9:16` 或 `1:1`。首帧图生视频跟随首帧画幅。 |
| `negativePrompt` | string | 可选。描述希望避免的内容。 |
| `promptOptimization` | boolean | 可选。是否优化提示词，默认开启。 |
| `callbackUrl` | string | 可选。任务结束后通知的 URL。 |
| `taskNickname` | string | 可选。任务备注。 |

参考生视频请求示例：

```json
{
  "prompt": "沿着参考视频的运镜，拍摄参考图中的帆船",
  "resolution": "480p",
  "duration": 5,
  "r2vMedia": [
    {"type": "reference_image", "url": "https://example.com/sailboat.jpg"},
    {"type": "reference_video", "url": "https://example.com/camera-motion.mp4"}
  ]
}
```

## 查询任务

```bash
curl "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/<TASK_ID>" \
  -H "Authorization: Bearer <YOUR_API_KEY>"
```

返回统一的 `{code, msg, data}` 结构。建单成功时从 `data.taskId` 取任务 ID；查询时读取 `data.status`，成功后从 `data.result` 取视频地址。批量查询请求体为 `{"taskIds":["<TASK_ID>"]}`。
