HappyHorse 1.1 参考图生成视频
接口
POST /videos/generations
完整 URL: https://modelfold.ai/v1/videos/generations
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。
生成任务的输入参数。
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于生成的模型名称。该接口必须使用 happyhorse-1-1/reference-to-video。 默认值:"happyhorse-1-1/reference-to-video"。 可选值:happyhorse-1-1/reference-to-video。 示例:happyhorse-1-1/reference-to-video。 |
prompt | string | 是 | 本站网关要求传入 prompt,最长 2000 字。对生成视频所需元素与视觉风格的描述。支持任意语言输入,最多 5000 个字符。使用「[Image 1]」「[Image 2]」引用 reference_image 中对应的参考图,顺序与 reference_image 一致。引用时请指明图片中的对象,例如「[Image 1] 中身穿红色旗袍的女子」。 maxLength: 2000. 示例:A cat running on the grass。 |
reference_image | array<string> | 是 | 参考图像的 URL。 图像要求: 1. 格式:JPEG、JPG、PNG、WEBP。 2. 分辨率:最短边不小于 400 像素,建议使用 720P 或更高分辨率的清晰图像;避免使用过小、模糊或过度压缩的图像,否则会降低输出质量。 3. 文件大小:不超过 20 MB。 maxItems: 9. |
resolution | string | 否 | 生成视频的分辨率档位。 可选值:720p; 1080p 默认值: "1080p"。 可选值:720p / 1080p。 示例:1080p。 |
aspect_ratio | string | 否 | 生成视频的宽高比。 可选值:16:9; 9:16; 3:4; 4:3; 4:5; 5:4; 1:1; 9:21; 21:9 默认值: "16:9"。 可选值:16:9 / 9:16 / 3:4 / 4:3 / 4:5 / 5:4 / 1:1 / 9:21 / 21:9。 示例:16:9。 |
duration | number | 否 | 生成视频的时长(单位:秒)。取值范围:3 到 15 之间的整数。 默认值:5。 minimum: 3. maximum: 15. 示例:5。 |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/videos/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "happyhorse-1-1/reference-to-video",
"prompt": "A cat running on the grass",
"reference_image": [
"https://example.com/reference.png"
],
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5
}'json
{
"model": "happyhorse-1-1/reference-to-video",
"prompt": "A cat running on the grass",
"reference_image": [
"https://example.com/reference.png"
],
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 5
}响应
200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.mp4"
}
],
"usage": {}
}