HappyHorse 1.0

POST https://api.beatapi.io/v1/videos/tasks

把一张照片变成 3–15 秒的 720p 或 1080p 视频,必须提供图片输入。

支持的生成方式

生成方式必填参数使用规则
图生视频model, prompt, images必填。该模型没有文生视频模式。
多张源图model, prompt, images最多传入同一主体的九个角度。

异步任务流程

创建任务后保存 data.id,每 5–10 秒调用 GET /v1/tasks/{task_id} 查询状态。statussucceeded 时读取 data.output.media,为 failed 时读取 data.error_codedata.error_message,随后按错误与重试策略处理。

使用本地文件

请先上传本地输入,再将返回的 data.url 填入请求。

鉴权

Authorization   string   必填

Authorization 请求头中以 Bearer 令牌发送服务端 API 密钥,可在控制台创建。

Authorization: Bearer <BEATAPI_API_KEY>

永久 API 密钥只能保存在可信服务端,不能写入浏览器、移动端、公开脚本、日志或截图。请求体必须使用 Content-Type: application/json。建议为每个逻辑创建请求设置唯一的 Idempotency-Key,只有完全相同的请求体才能安全复用原键。

请求体

字段名、类型和枚举值保留英文原样,用途和限制用中文说明。

model   string   必填

稳定的公开模型 ID,必须使用当前页面列出的值。

取值与默认值: 固定值 happyhorse-1.0


prompt   string   必填

描述生成、编辑或分析目标的提示词。

取值与默认值: 长度 1–5000 字符


images   string[]   必填

按当前模型或工作流要求排序的公网 HTTPS 图片 URL 列表。

取值与默认值: 1–9 项


duration   integer   选填

请求的输出时长,单位为秒。

取值与默认值: 默认值 5;取值范围 3–15


aspect_ratio   enum<string>   选填

输出素材的宽高比。

取值与默认值: 可选值 16:99:161:14:33:4;默认值 16:9


resolution   enum<string>   选填

输出素材的分辨率或质量档位。

取值与默认值: 可选值 720p1080p;默认值 720p

请求示例

图生视频

$curl --request POST \
> --url https://api.beatapi.io/v1/videos/tasks \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "happyhorse-1.0",
> "prompt": "The woman turns toward the camera and smiles, hair moving in the breeze.",
> "images": [
> "https://media.beatapi.io/samples/neon-singer.png"
> ],
> "duration": 5,
> "aspect_ratio": "9:16",
> "resolution": "720p"
>}'

多张源图

$curl --request POST \
> --url https://api.beatapi.io/v1/videos/tasks \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "happyhorse-1.0",
> "prompt": "Hold the product exactly as photographed while the camera pushes in.",
> "images": [
> "https://media.beatapi.io/samples/smart-bottle.png",
> "https://media.beatapi.io/samples/neon-singer.png"
> ],
> "duration": 10,
> "aspect_ratio": "16:9",
> "resolution": "1080p"
>}'

响应

成功请求返回 HTTP 201,响应体如下。

1{
2 "data": {
3 "id": "task_8K2qA",
4 "object": "task",
5 "task_kind": "video",
6 "capability_id": "happyhorse-1.0",
7 "capability_version": null,
8 "media_type": "video",
9 "model": "happyhorse-1.0",
10 "status": "queued",
11 "stage": "queued",
12 "created_at": 1782210000,
13 "updated_at": 1782210000,
14 "completed_at": null,
15 "output": null,
16 "usage": {
17 "credits_reserved": 0.7,
18 "credits_charged": 0.7,
19 "billable_duration_seconds": 5,
20 "credits_settled": 0,
21 "credits_refunded": 0
22 },
23 "request_id": "req_abc123",
24 "error_code": null,
25 "error_message": null
26 }
27}

下一步

保存接受响应中的 data.id,每 5–10 秒轮询 GET /v1/tasks/{task_id}。任务成功后从 data.output.media 读取托管结果。

错误

状态码含义与处理方式
400请求字段、格式、取值或参数组合不合法,请修正后重新请求。
401API 密钥缺失、无效或未启用。
402USD 余额不足,请充值后再创建付费任务。
409幂等键已对应其他请求体,仅能对完全相同的逻辑请求复用原键。
429超过请求频率或并发上限,请遵守 Retry-After 或返回的等待时间。