Skip to content

HappyHorse Video

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

接口地址

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

请求需要携带 API Key:

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

支持模型

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

请求参数

参数类型必填说明
modelstringHappyHorse 模型名称
promptstring视频生成或编辑描述
durationnumber视频时长,单位秒;不传时默认 5
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.0-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.0-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.0-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.0-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.0-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 读取视频地址。