Create video generation task (HappyHorse compatible protocol)
curl --request POST \
--url https://api.example.com/v1/alibaba/video/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"watermark": true,
"seed": 123
}
}
'import requests
url = "https://api.example.com/v1/alibaba/video/generations"
payload = {
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"watermark": True,
"seed": 123
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: {prompt: '<string>', media: [{type: '<string>', url: '<string>'}]},
parameters: {
resolution: '<string>',
ratio: '<string>',
duration: 123,
watermark: true,
seed: 123
}
})
};
fetch('https://api.example.com/v1/alibaba/video/generations', 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.example.com/v1/alibaba/video/generations",
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' => '<string>',
'input' => [
'prompt' => '<string>',
'media' => [
[
'type' => '<string>',
'url' => '<string>'
]
]
],
'parameters' => [
'resolution' => '<string>',
'ratio' => '<string>',
'duration' => 123,
'watermark' => true,
'seed' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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.example.com/v1/alibaba/video/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"watermark\": true,\n \"seed\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.example.com/v1/alibaba/video/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"watermark\": true,\n \"seed\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/alibaba/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"watermark\": true,\n \"seed\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"output": {
"task_id": "<string>",
"task_status": "<string>"
}
}Video
HappyHorse Video Generation
Video generation API compatible with the HappyHorse 1.1 protocol, supporting text-to-video, image-to-video, and video editing
POST
/
v1
/
alibaba
/
video
/
generations
Create video generation task (HappyHorse compatible protocol)
curl --request POST \
--url https://api.example.com/v1/alibaba/video/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"watermark": true,
"seed": 123
}
}
'import requests
url = "https://api.example.com/v1/alibaba/video/generations"
payload = {
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "<string>",
"ratio": "<string>",
"duration": 123,
"watermark": True,
"seed": 123
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: {prompt: '<string>', media: [{type: '<string>', url: '<string>'}]},
parameters: {
resolution: '<string>',
ratio: '<string>',
duration: 123,
watermark: true,
seed: 123
}
})
};
fetch('https://api.example.com/v1/alibaba/video/generations', 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.example.com/v1/alibaba/video/generations",
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' => '<string>',
'input' => [
'prompt' => '<string>',
'media' => [
[
'type' => '<string>',
'url' => '<string>'
]
]
],
'parameters' => [
'resolution' => '<string>',
'ratio' => '<string>',
'duration' => 123,
'watermark' => true,
'seed' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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.example.com/v1/alibaba/video/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"watermark\": true,\n \"seed\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.example.com/v1/alibaba/video/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"watermark\": true,\n \"seed\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/alibaba/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"<string>\",\n \"ratio\": \"<string>\",\n \"duration\": 123,\n \"watermark\": true,\n \"seed\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"output": {
"task_id": "<string>",
"task_status": "<string>"
}
}This endpoint is compatible with the HappyHorse protocol, and the request body follows the official Alibaba structure. The
A successful creation returns the task ID:
X-DashScope-Async header is not required because async semantics are built into the gateway. model must be a platform model identifier (e.g. wan2.7-t2v / wan2.7-i2v / wan2.7-r2v / wan2.7-videoedit), which the gateway rewrites to the channel model name after routing.
Request structure
The request body consists of three parts:model: platform model identifier (required)input: input content, includingpromptand the media element listmedia(first_frame/reference_image/videoto edit; accepts public URLs or base64 data)parameters: generation parameters, includingresolution(480P/720P/1080P),ratio(16:9default /9:16/1:1/4:3/3:4/5:4/4:5/9:21/21:9),duration,watermark, andseed
Authentication
Include theAuthorization header in the format Bearer YOUR_API_KEY.
Supported video models
| Model No | Model Type | Model Description |
|---|---|---|
| happyhorse-1.1-t2v | Text to Video | Based on text generation video |
| happyhorse-1.1-i2v | Image to Video | Based on image generation video |
| happyhorse-1.1-r2v | Reference Video | Based on reference generation video |
| happyhorse-1.0-video-edit | Video Edit | Edit input video |
Quick example
import requests
url = "https://api.haitoken.ai/v1/alibaba/video/generations"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"model": "wan2.7-i2v",
"input": {
"prompt": "A golden retriever runs along the beach at sunset, camera slowly tracking",
"media": [
{
"type": "first_frame",
"url": "https://example.com/images/dog.png"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
"watermark": False
}
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const response = await fetch('https://api.haitoken.ai/v1/alibaba/video/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.7-i2v',
input: {
prompt: 'A golden retriever runs along the beach at sunset, camera slowly tracking',
media: [
{
type: 'first_frame',
url: 'https://example.com/images/dog.png'
}
]
},
parameters: {
resolution: '720P',
ratio: '16:9',
duration: 5,
watermark: false
}
})
});
const data = await response.json();
console.log(data);
curl -X POST 'https://api.haitoken.ai/v1/alibaba/video/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.7-i2v",
"input": {
"prompt": "A golden retriever runs along the beach at sunset, camera slowly tracking",
"media": [
{
"type": "first_frame",
"url": "https://example.com/images/dog.png"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
"watermark": false
}
}'
{
"request_id": "8f3d2c1a-9b7e-4f5a-8c2d-1e6f0a9b3c5d",
"output": {
"task_id": "cgt-20260730120000-a1b2c3",
"task_status": "PENDING"
}
}
Next steps
- See Query HappyHorse video task to retrieve generation results
- See Video generation for the unified protocol
- See the Wan protocol for native Alibaba Wan parameters
- See the model list for available video models
Body
application/json
Platform model identifier (e.g. wan2.7-t2v / wan2.7-i2v / wan2.7-r2v / wan2.7-videoedit), rewritten to the channel model name by the gateway after routing
Input content (prompt and media elements)
Show child attributes
Show child attributes
Generation parameters
Show child attributes
Show child attributes