创建图生视频任务
curl --request POST \
--url https://www.anyfast.ai/v1/video/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "happyhorse-1.1-i2v",
"input": {
"prompt": "小猫从草地上快速跑过,镜头平稳跟随。",
"media": [
{
"type": "first_frame",
"url": "https://example.com/cat.png"
}
]
},
"parameters": {
"resolution": "720P",
"duration": 5,
"watermark": false
}
}
'import requests
url = "https://www.anyfast.ai/v1/video/generations"
payload = {
"model": "happyhorse-1.1-i2v",
"input": {
"prompt": "小猫从草地上快速跑过,镜头平稳跟随。",
"media": [
{
"type": "first_frame",
"url": "https://example.com/cat.png"
}
]
},
"parameters": {
"resolution": "720P",
"duration": 5,
"watermark": False
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'happyhorse-1.1-i2v',
input: {
prompt: '小猫从草地上快速跑过,镜头平稳跟随。',
media: [{type: 'first_frame', url: 'https://example.com/cat.png'}]
},
parameters: {resolution: '720P', duration: 5, watermark: false}
})
};
fetch('https://www.anyfast.ai/v1/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://www.anyfast.ai/v1/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' => 'happyhorse-1.1-i2v',
'input' => [
'prompt' => '小猫从草地上快速跑过,镜头平稳跟随。',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://example.com/cat.png'
]
]
],
'parameters' => [
'resolution' => '720P',
'duration' => 5,
'watermark' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://www.anyfast.ai/v1/video/generations"
payload := strings.NewReader("{\n \"model\": \"happyhorse-1.1-i2v\",\n \"input\": {\n \"prompt\": \"小猫从草地上快速跑过,镜头平稳跟随。\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/cat.png\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"watermark\": false\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://www.anyfast.ai/v1/video/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"happyhorse-1.1-i2v\",\n \"input\": {\n \"prompt\": \"小猫从草地上快速跑过,镜头平稳跟随。\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/cat.png\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"watermark\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.anyfast.ai/v1/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"happyhorse-1.1-i2v\",\n \"input\": {\n \"prompt\": \"小猫从草地上快速跑过,镜头平稳跟随。\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/cat.png\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"watermark\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "asyntask_jwgfhsG0m2aDjLmiiELRf74eoWmss6ya",
"task_id": "asyntask_jwgfhsG0m2aDjLmiiELRf74eoWmss6ya",
"object": "video",
"model": "happyhorse-1.1-i2v",
"status": "queued",
"progress": 0,
"created_at": 1784520000
}Alibaba
happyhorse-1.1-i2v
提交 HappyHorse 1.1 首帧图生视频任务。输出视频会大致保留输入图片的宽高比。
POST
/
v1
/
video
/
generations
创建图生视频任务
curl --request POST \
--url https://www.anyfast.ai/v1/video/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "happyhorse-1.1-i2v",
"input": {
"prompt": "小猫从草地上快速跑过,镜头平稳跟随。",
"media": [
{
"type": "first_frame",
"url": "https://example.com/cat.png"
}
]
},
"parameters": {
"resolution": "720P",
"duration": 5,
"watermark": false
}
}
'import requests
url = "https://www.anyfast.ai/v1/video/generations"
payload = {
"model": "happyhorse-1.1-i2v",
"input": {
"prompt": "小猫从草地上快速跑过,镜头平稳跟随。",
"media": [
{
"type": "first_frame",
"url": "https://example.com/cat.png"
}
]
},
"parameters": {
"resolution": "720P",
"duration": 5,
"watermark": False
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'happyhorse-1.1-i2v',
input: {
prompt: '小猫从草地上快速跑过,镜头平稳跟随。',
media: [{type: 'first_frame', url: 'https://example.com/cat.png'}]
},
parameters: {resolution: '720P', duration: 5, watermark: false}
})
};
fetch('https://www.anyfast.ai/v1/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://www.anyfast.ai/v1/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' => 'happyhorse-1.1-i2v',
'input' => [
'prompt' => '小猫从草地上快速跑过,镜头平稳跟随。',
'media' => [
[
'type' => 'first_frame',
'url' => 'https://example.com/cat.png'
]
]
],
'parameters' => [
'resolution' => '720P',
'duration' => 5,
'watermark' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://www.anyfast.ai/v1/video/generations"
payload := strings.NewReader("{\n \"model\": \"happyhorse-1.1-i2v\",\n \"input\": {\n \"prompt\": \"小猫从草地上快速跑过,镜头平稳跟随。\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/cat.png\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"watermark\": false\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://www.anyfast.ai/v1/video/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"happyhorse-1.1-i2v\",\n \"input\": {\n \"prompt\": \"小猫从草地上快速跑过,镜头平稳跟随。\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/cat.png\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"watermark\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.anyfast.ai/v1/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"happyhorse-1.1-i2v\",\n \"input\": {\n \"prompt\": \"小猫从草地上快速跑过,镜头平稳跟随。\",\n \"media\": [\n {\n \"type\": \"first_frame\",\n \"url\": \"https://example.com/cat.png\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"720P\",\n \"duration\": 5,\n \"watermark\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "asyntask_jwgfhsG0m2aDjLmiiELRf74eoWmss6ya",
"task_id": "asyntask_jwgfhsG0m2aDjLmiiELRf74eoWmss6ya",
"object": "video",
"model": "happyhorse-1.1-i2v",
"status": "queued",
"progress": 0,
"created_at": 1784520000
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
此页面对您有帮助吗?
⌘I