文档

HappyHorse 1.1 视频生成

- 阿里云百炼 HappyHorse 1.1 视频生成模型(统一入口,单模型自动路由)

  • 阿里云百炼 HappyHorse 1.1 视频生成模型(统一入口,单模型自动路由)
  • 根据传入字段自动路由:T2V(仅 prompt)/ I2V(first_frame_image)/ R2V(image_urls)
  • 支持 720P/1080P 分辨率,3-15 秒任意整数时长
  • 仅按分辨率 × 视频秒数计费,与具体能力无关

请求示例

bash curl --request POST \ --url https://api.openveer.com/v1/videos/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "happyhorse-1.1", "prompt": "一个小女孩走在路上,电影感画面", "resolution": "1080P", "size": "16:9", "duration": 5, "seed": 42 }'

```python
import requests

url = "https://api.openveer.com/v1/videos/generations"

payload = {
"model": "happyhorse-1.1",
"prompt": "一个小女孩走在路上,电影感画面",
"resolution": "1080P",
"size": "16:9",
"duration": 5,
"seed": 42
}

headers = {
"Authorization": "Bearer ",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = "https://api.openveer.com/v1/videos/generations";

const payload = {
model: "happyhorse-1.1",
prompt: "一个小女孩走在路上,电影感画面",
resolution: "1080P",
size: "16:9",
duration: 5,
seed: 42
};

const headers = {
"Authorization": "Bearer ",
"Content-Type": "application/json"
};

fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

```go
package main

import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)

func main() {
url := "https://api.openveer.com/v1/videos/generations"

  payload := map[string]interface{}{
      "model":      "happyhorse-1.1",
      "prompt":     "一个小女孩走在路上,电影感画面",
      "resolution": "1080P",
      "size":       "16:9",
      "duration":   5,
      "seed":       42,
  }

  jsonData, _ := json.Marshal(payload)

  req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
  req.Header.Set("Authorization", "Bearer <token>")
  req.Header.Set("Content-Type", "application/json")

  client := &http.Client{}
  resp, err := client.Do(req)
  if err != nil {
      panic(err)
  }
  defer resp.Body.Close()

  body, _ := ioutil.ReadAll(resp.Body)
  fmt.Println(string(body))

}
```

```java
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.openveer.com/v1/videos/generations";

      String payload = """
      {
        "model": "happyhorse-1.1",
        "prompt": "一个小女孩走在路上,电影感画面",
        "resolution": "1080P",
        "size": "16:9",
        "duration": 5,
        "seed": 42
      }
      """;

      HttpClient client = HttpClient.newHttpClient();
      HttpRequest request = HttpRequest.newBuilder()
          .uri(URI.create(url))
          .header("Authorization", "Bearer <token>")
          .header("Content-Type", "application/json")
          .POST(HttpRequest.BodyPublishers.ofString(payload))
          .build();

      HttpResponse<String> response = client.send(request,
          HttpResponse.BodyHandlers.ofString());

      System.out.println(response.body());
  }

}
```

```php
"happyhorse-1.1", "prompt" => "一个小女孩走在路上,电影感画面", "resolution" => "1080P", "size" => "16:9", "duration" => 5, "seed" => 42 ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer ", "Content-Type: application/json" ]); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

```

```ruby
require 'net/http'
require 'json'
require 'uri'

url = URI("https://api.openveer.com/v1/videos/generations")

payload = {
model: "happyhorse-1.1",
prompt: "一个小女孩走在路上,电影感画面",
resolution: "1080P",
size: "16:9",
duration: 5,
seed: 42
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer "
request["Content-Type"] = "application/json"
request.body = payload.to_json

response = http.request(request)
puts response.body
```

```swift
import Foundation

let url = URL(string: "https://api.openveer.com/v1/videos/generations")!

let payload: [String: Any] = [
"model": "happyhorse-1.1",
"prompt": "一个小女孩走在路上,电影感画面",
"resolution": "1080P",
"size": "16:9",
"duration": 5,
"seed": 42
]

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer ", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: (error)")
return
}

  if let data = data, let responseString = String(data: data, encoding: .utf8) {
      print(responseString)
  }

}

task.resume()
```

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
static async Task Main(string[] args)
{
var url = "https://api.openveer.com/v1/videos/generations";

      var payload = @"{
          ""model"": ""happyhorse-1.1"",
          ""prompt"": ""一个小女孩走在路上,电影感画面"",
          ""resolution"": ""1080P"",
          ""size"": ""16:9"",
          ""duration"": 5,
          ""seed"": 42
      }";

      using var client = new HttpClient();
      client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

      var content = new StringContent(payload, Encoding.UTF8, "application/json");
      var response = await client.PostAsync(url, content);
      var result = await response.Content.ReadAsStringAsync();

      Console.WriteLine(result);
  }

}
```

响应示例

json { "code": 200, "data": [ { "status": "submitted", "task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ" } ] }

json { "error": { "code": 400, "message": "请求参数无效", "type": "invalid_request_error" } }

json { "error": { "code": 401, "message": "身份验证失败,请检查您的API密钥", "type": "authentication_error" } }

json { "error": { "code": 402, "message": "账户余额不足,请充值后再试", "type": "payment_required" } }

json { "error": { "code": 429, "message": "请求过于频繁,请稍后再试", "type": "rate_limit_error" } }

json { "error": { "code": 500, "message": "服务器内部错误,请稍后重试", "type": "server_error" } }

认证

Authorization string
所有接口均需要使用 Bearer Token 进行认证 获取 API Key: 访问 [API Key 管理页面](https://openveer.com) 获取您的 API Key 使用时在请求头中添加: ``` Authorization: Bearer YOUR_API_KEY ```

模式路由

happyhorse-1.1 是文生视频 / 图生视频 / 参考图生视频的统一入口,后端根据传入参数自动判断模式,所有模式按统一规则计费(仅按分辨率 × 秒)

你传的字段 路由到 模式说明
prompt 文生视频(T2V) 纯文字描述生成视频
prompt + first_frame_image 图生视频(I2V) 以图为首帧动起来
prompt + image_urls(1\~9 张) 参考图生视频(R2V) 一组参考图生成全新画面

路由优先级(从高到低):first_frame_image > image_urls > 仅 prompt

字段互斥规则:两个媒体字段(first_frame_image / image_urls互斥。同时传两个互斥字段会返回 400 mixed_media_not_allowed

请求参数

model string
视频生成模型名称,固定为 `happyhorse-1.1`
prompt string
视频内容描述,最多 2500 字符,不能包含特殊 token 示例:`"一个小女孩走在路上,电影感画面"`
first_frame_image string
首帧图片,触发 **I2V**(图生视频)。支持 URL 或 base64(`data:image/;base64,`,网关自动转储到 OSS) 与 `image_urls` 互斥
注意
**首帧图片要求:** * 格式:JPEG / JPG / PNG / BMP / WEBP * 短边像素:≥ 300px * 宽高比:`1:2.5 ~ 2.5:1` * 大小:≤ 10MB
image_urls string
"> 图片数组(**R2V 模式**):1\~9 张,作为主体/风格参考生成全新画面 支持 URL 或 base64 与 `first_frame_image` 互斥
注意
**参考图要求:** * 格式:JPEG / JPG / PNG / BMP / WEBP * 短边像素:推荐 ≥ 720p * 宽高比:短边 / 长边 ≥ 0.4 * 大小:≤ 10MB * 数量:1\~9 张
resolution string
视频分辨率(影响计费) 可选值: * `720P` - 标清 * `1080P` - 高清(默认)
duration integer
视频时长(秒,影响计费) 支持范围:`3` \~ `15` 的任意整数 默认值:`5`
size string
画面宽高比 支持的格式: * `16:9` - 横版宽屏(默认) * `9:16` - 竖版长屏 * `1:1` - 正方形 * `4:3` - 横版 * `3:4` - 竖版
警告
**I2V 模式下此参数会被忽略**,输出宽高比由输入媒体(首帧图)自动决定
watermark boolean
是否在生成的视频上添加水印 * `true`:添加水印 * `false`:不添加水印(默认)
seed integer
随机种子,用于控制生成内容的随机性 取值范围:`[0, 2147483647]`,省略则随机
注意
* 相同的请求下,模型收到不同的 seed 值(如:不指定 seed 值),将生成不同的结果 * 相同的请求下,模型收到相同的 seed 值,会生成类似的结果,但不保证完全一致

响应

code integer
响应状态码,成功时为 200
data array
返回数据数组 任务状态,初始提交时为 `submitted`
task_id string
任务唯一标识符,用于查询任务状态和结果

使用场景

场景 1:文生视频 T2V(最简请求)

{
  "model": "happyhorse-1.1",
  "prompt": "一个小女孩走在路上,电影感画面"
}

场景 2:文生视频 T2V(完整参数)

{
  "model": "happyhorse-1.1",
  "prompt": "夕阳下的海边公路,慢镜头推进,电影感画面",
  "resolution": "1080P",
  "size": "16:9",
  "duration": 8,
  "seed": 42
}

场景 3:图生视频 I2V(first_frame_image)

{
  "model": "happyhorse-1.1",
  "prompt": "让图片中的场景动起来",
  "first_frame_image": "https://example.com/first_frame.png",
  "resolution": "1080P",
  "duration": 5
}

场景 4:参考图生视频 R2V(多张参考图)

{
  "model": "happyhorse-1.1",
  "prompt": "图1中的主角在图2的场景中奔跑,随后拿起图3中的道具。画面保持3D卡通风格,动作流畅。",
  "image_urls": [
    "https://example.com/img_01.jpg",
    "https://example.com/img_02.png",
    "https://example.com/img_03.jpeg"
  ],
  "resolution": "1080P",
  "size": "16:9",
  "duration": 5
}

场景 5:720P 节省额度

{
  "model": "happyhorse-1.1",
  "prompt": "海浪拍打沙滩,日落时分",
  "resolution": "720P",
  "size": "16:9",
  "duration": 5
}

模式选择建议

需求 推荐方式
纯文字描述生成视频 仅传 prompt(T2V)
让图片"动起来"(以图为首帧) first_frame_image(I2V)
用一组参考图生成全新画面 image_urls(1\~9 张,R2V)
节省额度 指定 resolution: "720P"

使用建议

  1. 统一入口逻辑:根据传入字段自动路由模式,注意两个媒体字段(first_frame_image / image_urls)互斥
  2. size 仅 T2V/R2V 生效:I2V 模式下 size 会被忽略,输出宽高比由输入媒体决定
  3. 时长建议:5\~10 秒为甜点区,过短动作不连贯,过长上游耗时显著增加
  4. 首帧图片质量:清晰、构图明确、主体居中,能显著提升 I2V 效果
  5. prompt 写作:描述运动 / 镜头 / 氛围(如 "缓慢推近、电影感、暖色调"),比单纯描述静态场景效果更好
注意
**查询任务结果** 视频生成为异步任务,提交后会返回 `task_id`。使用 [获取任务状态](/cn/api-reference/tasks/status) 接口查询生成进度和结果。