# Wan 2.7 Lora API Alibaba Wan 2.7 Lora 图生视频生成的完整 API 参考。 ## 模型版本 此 API 支持一个模型版本: | 模型 | ID | 说明 | |-------|-----|-------------| | **Wan 2.7 Lora Image to Video** | `wan-2.7-lora-image-to-video` | 高质量图生视频动画 | ## 快速对比 | 功能 | Image to Video | |---------|----------------| | 输入 | 图像 + 文本提示词 | | 时长范围 | 2-15 秒 | | 分辨率选项 | 720p、1080p | | 宽高比 | 不支持(由源图决定) | | 音频支持 | 可选自定义音频 | | 起始帧 | 必需 | ## Wan 2.7 Lora Image to Video ### 端点 ``` POST /api/v1/video/task ``` ### 请求参数 #### 必需 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `model_name` | string | 必须为 `"wan-2.7-lora-image-to-video"` | | `prompt` | string | 视频生成提示词 | | `image_url` | string | 首帧图像 URL | | `duration` | number | 视频时长,单位为秒。必须介于 `2` 到 `15`。 | | `resolution` | string | 必填输出分辨率:`"720p"` 或 `"1080p"`。默认值为 `"720p"`。 | #### 可选 | 参数 | 类型 | 说明 | |-----------|------|-------------| | `audio_url` | string | 可选的自定义音频 URL。支持格式:wav 或 mp3。音频时长应为 2-30 秒。 | | `negative_prompt` | string | 生成视频中需要抑制的内容 | | `seed` | number | 范围 `[0, 2147483647]` 内的随机种子 | ### 请求示例 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/video/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'wan-2.7-lora-image-to-video', prompt: 'The girl is dancing', image_url: 'https://example.com/source-image.jpg', resolution: '720p', duration: 5, audio_url: 'https://example.com/background-audio.mp3', seed: 4, negative_prompt: 'other people' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## 响应格式 提交响应: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` 使用 `GET /api/v1/video/{task_id}` 轮询。任务状态包括:`submitted`、`processing`、`succeed`、`failed`。 ## 最佳实践 - 使用清楚描述主体运动和镜头行为的运动提示词。 - 提供主体明确、画面干净的首帧图像。 - 使用 `negative_prompt` 减少场景中不需要的瑕疵或多余主体。