# 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` 減少場景中不需要的瑕疵或多餘主體。