使用 HappyHorse 1.0 参考图生视频生成视频
curl --request POST \
--url https://api.crun.ai/api/v1/client/job/CreateTask \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "happyhorse-1-0-r2v",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "结合参考图中的角色和风格,生成一段奇幻骑行场景。",
"img_urls": [
"https://example.com/reference-1.jpg",
"https://example.com/reference-2.jpg"
],
"resolution": "720P",
"duration": 5,
"aspect_ratio": "16:9",
"region": "global",
"input_compliance": "enable",
"output_compliance": "enable"
}
}
'import requests
url = "https://api.crun.ai/api/v1/client/job/CreateTask"
payload = {
"model": "happyhorse-1-0-r2v",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "结合参考图中的角色和风格,生成一段奇幻骑行场景。",
"img_urls": ["https://example.com/reference-1.jpg", "https://example.com/reference-2.jpg"],
"resolution": "720P",
"duration": 5,
"aspect_ratio": "16:9",
"region": "global",
"input_compliance": "enable",
"output_compliance": "enable"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'happyhorse-1-0-r2v',
callback_url: 'https://your-domain.com/api/callback',
input: {
prompt: '结合参考图中的角色和风格,生成一段奇幻骑行场景。',
img_urls: ['https://example.com/reference-1.jpg', 'https://example.com/reference-2.jpg'],
resolution: '720P',
duration: 5,
aspect_ratio: '16:9',
region: 'global',
input_compliance: 'enable',
output_compliance: 'enable'
}
})
};
fetch('https://api.crun.ai/api/v1/client/job/CreateTask', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/CreateTask",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'happyhorse-1-0-r2v',
'callback_url' => 'https://your-domain.com/api/callback',
'input' => [
'prompt' => '结合参考图中的角色和风格,生成一段奇幻骑行场景。',
'img_urls' => [
'https://example.com/reference-1.jpg',
'https://example.com/reference-2.jpg'
],
'resolution' => '720P',
'duration' => 5,
'aspect_ratio' => '16:9',
'region' => 'global',
'input_compliance' => 'enable',
'output_compliance' => 'enable'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/CreateTask"
payload := strings.NewReader("{\n \"model\": \"happyhorse-1-0-r2v\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"结合参考图中的角色和风格,生成一段奇幻骑行场景。\",\n \"img_urls\": [\n \"https://example.com/reference-1.jpg\",\n \"https://example.com/reference-2.jpg\"\n ],\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"aspect_ratio\": \"16:9\",\n \"region\": \"global\",\n \"input_compliance\": \"enable\",\n \"output_compliance\": \"enable\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crun.ai/api/v1/client/job/CreateTask")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"happyhorse-1-0-r2v\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"结合参考图中的角色和风格,生成一段奇幻骑行场景。\",\n \"img_urls\": [\n \"https://example.com/reference-1.jpg\",\n \"https://example.com/reference-2.jpg\"\n ],\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"aspect_ratio\": \"16:9\",\n \"region\": \"global\",\n \"input_compliance\": \"enable\",\n \"output_compliance\": \"enable\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/CreateTask")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"happyhorse-1-0-r2v\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"结合参考图中的角色和风格,生成一段奇幻骑行场景。\",\n \"img_urls\": [\n \"https://example.com/reference-1.jpg\",\n \"https://example.com/reference-2.jpg\"\n ],\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"aspect_ratio\": \"16:9\",\n \"region\": \"global\",\n \"input_compliance\": \"enable\",\n \"output_compliance\": \"enable\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "task_12345678"
}
}HappyHorse 1.0
HappyHorse 1.0 参考图生视频
HappyHorse-参考生视频模型支持传入多张参考图像,通过文本提示词描述场景,将图像中的主体角色融合生成一段流畅的视频。
POST
/
api
/
v1
/
client
/
job
/
CreateTask
使用 HappyHorse 1.0 参考图生视频生成视频
curl --request POST \
--url https://api.crun.ai/api/v1/client/job/CreateTask \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "happyhorse-1-0-r2v",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "结合参考图中的角色和风格,生成一段奇幻骑行场景。",
"img_urls": [
"https://example.com/reference-1.jpg",
"https://example.com/reference-2.jpg"
],
"resolution": "720P",
"duration": 5,
"aspect_ratio": "16:9",
"region": "global",
"input_compliance": "enable",
"output_compliance": "enable"
}
}
'import requests
url = "https://api.crun.ai/api/v1/client/job/CreateTask"
payload = {
"model": "happyhorse-1-0-r2v",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "结合参考图中的角色和风格,生成一段奇幻骑行场景。",
"img_urls": ["https://example.com/reference-1.jpg", "https://example.com/reference-2.jpg"],
"resolution": "720P",
"duration": 5,
"aspect_ratio": "16:9",
"region": "global",
"input_compliance": "enable",
"output_compliance": "enable"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'happyhorse-1-0-r2v',
callback_url: 'https://your-domain.com/api/callback',
input: {
prompt: '结合参考图中的角色和风格,生成一段奇幻骑行场景。',
img_urls: ['https://example.com/reference-1.jpg', 'https://example.com/reference-2.jpg'],
resolution: '720P',
duration: 5,
aspect_ratio: '16:9',
region: 'global',
input_compliance: 'enable',
output_compliance: 'enable'
}
})
};
fetch('https://api.crun.ai/api/v1/client/job/CreateTask', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/CreateTask",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'happyhorse-1-0-r2v',
'callback_url' => 'https://your-domain.com/api/callback',
'input' => [
'prompt' => '结合参考图中的角色和风格,生成一段奇幻骑行场景。',
'img_urls' => [
'https://example.com/reference-1.jpg',
'https://example.com/reference-2.jpg'
],
'resolution' => '720P',
'duration' => 5,
'aspect_ratio' => '16:9',
'region' => 'global',
'input_compliance' => 'enable',
'output_compliance' => 'enable'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/CreateTask"
payload := strings.NewReader("{\n \"model\": \"happyhorse-1-0-r2v\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"结合参考图中的角色和风格,生成一段奇幻骑行场景。\",\n \"img_urls\": [\n \"https://example.com/reference-1.jpg\",\n \"https://example.com/reference-2.jpg\"\n ],\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"aspect_ratio\": \"16:9\",\n \"region\": \"global\",\n \"input_compliance\": \"enable\",\n \"output_compliance\": \"enable\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crun.ai/api/v1/client/job/CreateTask")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"happyhorse-1-0-r2v\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"结合参考图中的角色和风格,生成一段奇幻骑行场景。\",\n \"img_urls\": [\n \"https://example.com/reference-1.jpg\",\n \"https://example.com/reference-2.jpg\"\n ],\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"aspect_ratio\": \"16:9\",\n \"region\": \"global\",\n \"input_compliance\": \"enable\",\n \"output_compliance\": \"enable\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/CreateTask")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"happyhorse-1-0-r2v\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"结合参考图中的角色和风格,生成一段奇幻骑行场景。\",\n \"img_urls\": [\n \"https://example.com/reference-1.jpg\",\n \"https://example.com/reference-2.jpg\"\n ],\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"aspect_ratio\": \"16:9\",\n \"region\": \"global\",\n \"input_compliance\": \"enable\",\n \"output_compliance\": \"enable\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "task_12345678"
}
}查询任务状态
提交任务后,使用统一查询端点查看进度并获取结果:获取任务信息
了解如何查询任务状态及获取生成结果
对于生产环境,我们建议在创建任务时使用
callback_url 参数,以便在生成完成时自动接收通知,而非持续轮询状态端点。相关资源
模型概览
探索所有可用模型
通用 API
查询账户剩余积分
授权
所有 API 都需要通过 API Key 认证。
获取 API Key:
- 访问 API Key 管理页面 获取你的 API Key
使用方式: 在请求头中添加:
x-api-key: YOUR_API_KEY
请求体
application/json
此页面对您有帮助吗?
⌘I
