创建 Vertex 视频任务(项目路径)
curl --request POST \
--url https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"instances": [
{
"prompt": "A blue ceramic cup on a wooden table in daylight."
}
],
"parameters": {
"durationSeconds": 4,
"aspectRatio": "16:9",
"resolution": "720p",
"generateAudio": true,
"sampleCount": 1
}
}
'import requests
url = "https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning"
payload = {
"instances": [{ "prompt": "A blue ceramic cup on a wooden table in daylight." }],
"parameters": {
"durationSeconds": 4,
"aspectRatio": "16:9",
"resolution": "720p",
"generateAudio": True,
"sampleCount": 1
}
}
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({
instances: [{prompt: 'A blue ceramic cup on a wooden table in daylight.'}],
parameters: {
durationSeconds: 4,
aspectRatio: '16:9',
resolution: '720p',
generateAudio: true,
sampleCount: 1
}
})
};
fetch('https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning', 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.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning",
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([
'instances' => [
[
'prompt' => 'A blue ceramic cup on a wooden table in daylight.'
]
],
'parameters' => [
'durationSeconds' => 4,
'aspectRatio' => '16:9',
'resolution' => '720p',
'generateAudio' => true,
'sampleCount' => 1
]
]),
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://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning"
payload := strings.NewReader("{\n \"instances\": [\n {\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 4,\n \"aspectRatio\": \"16:9\",\n \"resolution\": \"720p\",\n \"generateAudio\": true,\n \"sampleCount\": 1\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://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"instances\": [\n {\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 4,\n \"aspectRatio\": \"16:9\",\n \"resolution\": \"720p\",\n \"generateAudio\": true,\n \"sampleCount\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning")
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 \"instances\": [\n {\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 4,\n \"aspectRatio\": \"16:9\",\n \"resolution\": \"720p\",\n \"generateAudio\": true,\n \"sampleCount\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "projects/my-project/locations/us-central1/publishers/bytedance/models/doubao-seedance-2-5-260628/operations/task_example",
"done": false
}{
"code": "invalid_duration",
"message": "duration must be between 4 and 30 seconds for this model"
}创建视频 · Vertex AI 项目路径
通过包含 project 和 location 的 Vertex AI 路径创建 Seedance 视频。
POST
/
v1
/
projects
/
{project}
/
locations
/
{location}
/
publishers
/
{publisher}
/
models
/
{model}
:predictLongRunning
创建 Vertex 视频任务(项目路径)
curl --request POST \
--url https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"instances": [
{
"prompt": "A blue ceramic cup on a wooden table in daylight."
}
],
"parameters": {
"durationSeconds": 4,
"aspectRatio": "16:9",
"resolution": "720p",
"generateAudio": true,
"sampleCount": 1
}
}
'import requests
url = "https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning"
payload = {
"instances": [{ "prompt": "A blue ceramic cup on a wooden table in daylight." }],
"parameters": {
"durationSeconds": 4,
"aspectRatio": "16:9",
"resolution": "720p",
"generateAudio": True,
"sampleCount": 1
}
}
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({
instances: [{prompt: 'A blue ceramic cup on a wooden table in daylight.'}],
parameters: {
durationSeconds: 4,
aspectRatio: '16:9',
resolution: '720p',
generateAudio: true,
sampleCount: 1
}
})
};
fetch('https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning', 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.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning",
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([
'instances' => [
[
'prompt' => 'A blue ceramic cup on a wooden table in daylight.'
]
],
'parameters' => [
'durationSeconds' => 4,
'aspectRatio' => '16:9',
'resolution' => '720p',
'generateAudio' => true,
'sampleCount' => 1
]
]),
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://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning"
payload := strings.NewReader("{\n \"instances\": [\n {\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 4,\n \"aspectRatio\": \"16:9\",\n \"resolution\": \"720p\",\n \"generateAudio\": true,\n \"sampleCount\": 1\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://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"instances\": [\n {\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 4,\n \"aspectRatio\": \"16:9\",\n \"resolution\": \"720p\",\n \"generateAudio\": true,\n \"sampleCount\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1/projects/{project}/locations/{location}/publishers/{publisher}/models/{model}:predictLongRunning")
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 \"instances\": [\n {\n \"prompt\": \"A blue ceramic cup on a wooden table in daylight.\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 4,\n \"aspectRatio\": \"16:9\",\n \"resolution\": \"720p\",\n \"generateAudio\": true,\n \"sampleCount\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "projects/my-project/locations/us-central1/publishers/bytedance/models/doubao-seedance-2-5-260628/operations/task_example",
"done": false
}{
"code": "invalid_duration",
"message": "duration must be between 4 and 30 seconds for this model"
}客户端携带 project 和 location 时使用这个路径。使用 AIOHub API 令牌鉴权;
返回的关键字段如下。保存完整
保存完整
模型上限见 视频模型与计费。不支持任意
publisher 示例为 bytedance,model 填完整 Seedance 模型名。
请求示例
curl "https://api.aiohub.org/v1/projects/<PROJECT>/locations/<LOCATION>/publishers/bytedance/models/doubao-seedance-2-5-260628:predictLongRunning" \
-H "Authorization: Bearer <AIOHUB_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"instances": [{
"prompt": "A blue ceramic cup on a wooden table in daylight."
}],
"parameters": {
"durationSeconds": 4,
"aspectRatio": "16:9",
"resolution": "720p",
"generateAudio": true,
"sampleCount": 1
}
}'
name,包括模型路径和 operations/,不要只保存最后一段 ID。
{
"name": "projects/<PROJECT>/locations/<LOCATION>/publishers/bytedance/models/doubao-seedance-2-5-260628/operations/task_example",
"done": false
}
name,随后使用 项目路径查询接口。
输入与参数
未指定参数时,默认 5 秒、720p、adaptive 比例并生成音频。首尾帧与参考图是两种输入方式,不能在同一个 instances[0] 中混用。
图片对象示例:
{"bytesBase64Encoded": "<BASE64_IMAGE>", "mimeType": "image/png"}
gs:// 输入、视频扩展或全部 Veo 参数。需要参考音频、参考视频或视频编辑时,选择 Ark / Seedance。授权
API key (sk-xxx)
路径参数
客户端路径中的项目标识。
示例:
"my-project"
客户端路径中的区域标识。
示例:
"us-central1"
模型发布者,Seedance 示例使用 bytedance。
示例:
"bytedance"
完整 Seedance 模型名。
示例:
"doubao-seedance-2-5-260628"
请求体
application/json