Skip to content

HappyHorse Video

HappyHorse Video 使用异步视频任务接口。客户端先创建任务,再通过任务查询接口轮询状态和结果。

当前服务通过阿里云百炼日本(东京)地域的独立 HappyHorse 渠道接入。东京地域只支持业务空间专属域名;API Host、API Key 和模型必须属于同一个东京业务空间,不能跨地域混用。

渠道配置(阿里东京)

配置项
渠道类型HappyHorse
Base URLhttps://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com
API Key东京地域业务空间的 API Key

Base URL 只填写 Host 根地址,不要追加 /api/v1。服务会自动请求 /api/v1/services/aigc/video-generation/video-synthesis,并通过 /api/v1/tasks/{task_id} 查询结果。

接口地址

能力方法路径
创建视频任务POST/v1/video/generations
查询视频任务GET/v1/video/generations/{task_id}

请求需要携带 API Key:

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

支持模型

模型场景素材要求
happyhorse-1.1-t2v文生视频只需要 prompt
happyhorse-1.1-i2v图生视频需要一张首帧图片
happyhorse-1.1-r2v参考图生成视频需要 1–9 张参考图片
happyhorse-1.0-video-edit视频编辑需要源视频 URL

happyhorse-1.0-t2vhappyhorse-1.0-i2vhappyhorse-1.0-r2v 继续兼容,但新请求建议使用 1.1。

东京区原价

下表为阿里云百炼东京区原价,不包含限时折扣:

模型720P1080P计费时长
happyhorse-1.1-t2v / happyhorse-1.1-i2v / happyhorse-1.1-r2v¥0.9/秒($0.123769/秒)¥1.2/秒($0.165026/秒)输出视频时长
happyhorse-1.0-video-edit¥0.9/秒($0.123769/秒)¥1.6/秒($0.220034/秒)输入与输出视频时长之和

Video Edit 会先按最大 30 秒预扣,任务完成后根据阿里云返回的 usage.duration 自动退款或补扣;失败任务不计费。

支持模式

模式推荐模型输入方式
文生视频happyhorse-1.1-t2vprompt
图生视频happyhorse-1.1-i2vimageinput_referencemetadata.image_url
参考图生成视频happyhorse-1.1-r2vimagesmetadata.image_urls
视频编辑happyhorse-1.0-video-editinput_referencemetadata.video_urlmetadata.video_urls

请求参数

参数类型必填说明
modelstringHappyHorse 模型名称
promptstring视频生成或编辑描述
durationnumber生成视频时长,范围 315 秒,不传时默认 5;Video Edit 不发送此参数
secondsstring视频时长字符串;与 duration 二选一即可
sizestring可用尺寸或画幅,例如 1920x10801080x19201:116:9
imagestring单张图片 URL,常用于图生视频或参考图
imagesstring[]多张图片 URL,常用于参考图生成或视频编辑辅助素材
input_referencestring参考素材 URL;可以是图片,也可以是视频
metadataobjectHappyHorse 扩展参数

metadata 字段

字段类型说明
resolutionstring输出清晰度,可传 720P1080P
ratiostring输出画幅,例如 16:99:161:14:33:4
watermarkboolean是否添加水印
seednumber随机种子
audio_settingstring音频设置,例如 origin
image_urlstring单张图片 URL
image_urlsstring[]多张图片 URL
video_urlstring源视频 URL,视频编辑时使用
video_urlsstring[]源视频 URL 数组,默认使用第一条
mediaobject[]直接指定素材列表,适合高级场景

media 项支持:

json
{
  "type": "first_frame",
  "url": "https://example.com/first-frame.png"
}

常用 type

type说明
first_frame首帧图片
reference_image参考图片
video源视频

调用示例

文生视频

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "happyhorse-1.1-t2v",
    "prompt": "A cinematic aerial shot of a futuristic cubic city at sunrise, slow camera push-in, realistic lighting",
    "duration": 5,
    "size": "1920x1080",
    "metadata": {
      "resolution": "1080P",
      "ratio": "16:9",
      "watermark": false
    }
  }'

图生视频

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "happyhorse-1.1-i2v",
    "prompt": "Animate the product from the first frame with a slow clockwise rotation, keep the original composition and product shape stable",
    "image": "https://example.com/first-frame.png",
    "duration": 5,
    "metadata": {
      "resolution": "1080P",
      "watermark": false
    }
  }'

也可以使用:

json
{
  "input_reference": "https://example.com/first-frame.png"
}

或:

json
{
  "metadata": {
    "image_url": "https://example.com/first-frame.png"
  }
}

参考图生成视频

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "happyhorse-1.1-r2v",
    "prompt": "Use the reference images to generate a short product showcase video, maintain the product identity and lighting consistency",
    "images": [
      "https://example.com/ref-1.png",
      "https://example.com/ref-2.png"
    ],
    "duration": 6,
    "metadata": {
      "resolution": "1080P",
      "ratio": "16:9",
      "watermark": false
    }
  }'

视频编辑

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "happyhorse-1.0-video-edit",
    "prompt": "Replace the background with a clean studio scene while preserving the person, motion path, and timing of the source video",
    "metadata": {
      "video_url": "https://example.com/source.mp4",
      "resolution": "720P",
      "watermark": false
    }
  }'

源视频也可以放在 input_reference

json
{
  "input_reference": "https://example.com/source.mp4"
}

返回和查询

创建成功后会返回视频任务对象:

json
{
  "id": "video_xxx",
  "task_id": "video_xxx",
  "object": "video",
  "model": "happyhorse-1.1-t2v",
  "status": "queued",
  "progress": 0,
  "created_at": 1770000000
}

idtask_id 都可用于后续查询。

查询任务:

bash
curl https://cubicspaces.cloud/v1/video/generations/video_xxx \
  -H "Authorization: Bearer YOUR_API_KEY"

查询返回:

json
{
  "id": "video_xxx",
  "task_id": "video_xxx",
  "object": "video",
  "model": "happyhorse-1.1-t2v",
  "status": "completed",
  "progress": 100,
  "created_at": 1770000000,
  "completed_at": 1770000120,
  "metadata": {
    "url": "https://example.com/output.mp4"
  }
}

状态值

status说明
queued已排队
in_progress生成中
completed已完成
failed失败

完成后从 metadata.url 读取视频地址。