Aliyun HappyHorse 影片生成

Aliyun HappyHorse 非同步 t2v/i2v/r2v 影片生成 (≤9 圖參考)

POST /v1/videos/generations

鉴权: {'type': 'bearer', 'prefix': 'sk-', 'description': 'API Key, `Authorization: Bearer sk-xxx`'}

## 官方文件參考 | 能力 | 模型 | 官方文件 | |---|---|---| | 文生影片 (t2v) | `happyhorse-1.0-t2v` | [HappyHorse-文生影片](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3029820) | | 圖生影片 (i2v · 基於首幀) | `happyhorse-1.0-i2v` | [HappyHorse-圖生影片-基於首幀](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3029821) | | 參考生影片 (r2v) | `happyhorse-1.0-r2v` | [HappyHorse-參考生影片](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3030778) | | 影片編輯 (video-edit) | `happyhorse-1.0-video-edit` | [HappyHorse-影片編輯](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3030779) | HappyHorse 1.0 影片生成. 提交任務後立即返 task_id, 通過 GET /v1/videos/generations/{id} 輪詢. ## 協議格式 HappyHorse 1.0 用 Wan 2.7 風格的協議 — `input.media: [{type, url}]` 陣列 + `parameters.resolution: "720P"` (大寫P). | 能力 | input.media type | 數量 | |---|---|---| | t2v | (無, 僅 prompt) | — | | i2v | `first_frame` | 1 張 | | r2v | `reference_image` | 最多 9 張 | ## 欄位責任劃分 - 頂層 `model` / `duration` / `resolution` / `aspect_ratio`: 閘道器用於計費 - `input` / `parameters`: 完全透傳給上游

请求体

modelstringrequiredHappyHorse 1.0 影片模型. 字尾 t2v/i2v/r2v 決定 input.media 內容
durationintegerrequired影片時長 (秒). 閘道器計費用
resolutionstringrequired解析度檔位 (閘道器計費用). 客戶端另需在 parameters.resolution 傳 "720P" (大寫 P)
aspect_ratiostring
inputobjectrequired上游 input 欄位透傳: - t2v: 僅 `prompt` - i2v: `prompt` + `media: [{type:"first_frame", url}]` - r2v: `prompt` + `media: [{type:"reference_image", url}, ...]` (最多 9 張)
parametersobject上游 parameters 欄位透傳: `resolution: "720P"` (大寫P) + `duration` + 可選 `ratio: "16:9"`
webhook_urlstring終態推送回調 URL (可選)

响应

调用示例

## ─── HappyHorse-1.0-t2v ───
curl -X POST https://api.router.ai/v1/videos/generations \
  -H 'Authorization: Bearer sk-xxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "happyhorse-1.0-t2v",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "input": {
      "prompt": "一座由硬纸板和瓶盖搭建的微型城市, 在夜晚焕发出生机"
    },
    "parameters": {
      "resolution": "720P",
      "ratio": "16:9",
      "duration": 5
    }
  }'

## ─── HappyHorse-1.0-i2v (media.first_frame, 1 张) ───
curl -X POST https://api.router.ai/v1/videos/generations \
  -H 'Authorization: Bearer sk-xxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "happyhorse-1.0-i2v",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "input": {
      "prompt": "一只猫在草地上奔跑",
      "media": [
        {"type": "first_frame", "url": "https://example.com/cat.png"}
      ]
    },
    "parameters": {
      "resolution": "720P",
      "duration": 5
    }
  }'

## ─── HappyHorse-1.0-r2v (media.reference_image, 最多 9 张) ───
curl -X POST https://api.router.ai/v1/videos/generations \
  -H 'Authorization: Bearer sk-xxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "happyhorse-1.0-r2v",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "input": {
      "prompt": "身着红色旗袍的女性 图1, 镜头先以侧面中景勾勒...",
      "media": [
        {"type": "reference_image", "url": "https://example.com/girl.jpg"},
        {"type": "reference_image", "url": "https://example.com/fan.jpg"},
        {"type": "reference_image", "url": "https://example.com/earrings.jpg"}
      ]
    },
    "parameters": {
      "resolution": "720P",
      "ratio": "16:9",
      "duration": 5
    }
  }'

## ─── 查询任务 ───
curl 'https://api.router.ai/v1/videos/generations/{task_id}' \
  -H 'Authorization: Bearer sk-xxx'

API 文件