跳转到主要内容
POST
/
v3
/
async
/
veo-3.0-generate-preview-text2video
Veo 3.0 Preview 文生视频
curl --request POST \
  --url https://api.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "prompt": "<string>",
  "aspect_ratio": "<string>",
  "duration_seconds": 123,
  "enhance_prompt": true,
  "generate_audio": true,
  "negative_prompt": "<string>",
  "person_generation": "<string>",
  "resolution": "<string>",
  "sample_count": 123,
  "seed": {}
}
'
import requests

url = "https://api.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video"

payload = {
"prompt": "<string>",
"aspect_ratio": "<string>",
"duration_seconds": 123,
"enhance_prompt": True,
"generate_audio": True,
"negative_prompt": "<string>",
"person_generation": "<string>",
"resolution": "<string>",
"sample_count": 123,
"seed": {}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
prompt: '<string>',
aspect_ratio: '<string>',
duration_seconds: 123,
enhance_prompt: true,
generate_audio: true,
negative_prompt: '<string>',
person_generation: '<string>',
resolution: '<string>',
sample_count: 123,
seed: {}
})
};

fetch('https://api.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video', 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.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video",
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([
'prompt' => '<string>',
'aspect_ratio' => '<string>',
'duration_seconds' => 123,
'enhance_prompt' => true,
'generate_audio' => true,
'negative_prompt' => '<string>',
'person_generation' => '<string>',
'resolution' => '<string>',
'sample_count' => 123,
'seed' => [

]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);

$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.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video"

payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"duration_seconds\": 123,\n \"enhance_prompt\": true,\n \"generate_audio\": true,\n \"negative_prompt\": \"<string>\",\n \"person_generation\": \"<string>\",\n \"resolution\": \"<string>\",\n \"sample_count\": 123,\n \"seed\": {}\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")

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.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"duration_seconds\": 123,\n \"enhance_prompt\": true,\n \"generate_audio\": true,\n \"negative_prompt\": \"<string>\",\n \"person_generation\": \"<string>\",\n \"resolution\": \"<string>\",\n \"sample_count\": 123,\n \"seed\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.highwayapi.ai/v3/async/veo-3.0-generate-preview-text2video")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"<string>\",\n \"duration_seconds\": 123,\n \"enhance_prompt\": true,\n \"generate_audio\": true,\n \"negative_prompt\": \"<string>\",\n \"person_generation\": \"<string>\",\n \"resolution\": \"<string>\",\n \"sample_count\": 123,\n \"seed\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "task_id": "<string>"
}
使用 Veo 3.0 Preview 视频生成模型,通过文本描述生成高质量视频内容。该接口采用异步处理方式,需要通过 task_id 查询最终生成结果。

请求头

Content-Type
string
必填
枚举值: application/json
Authorization
string
必填
Bearer 身份验证格式: Bearer {{API 密钥}}。

请求体

prompt
string
必填
描述您想要生成的视频的文本字符串。
aspect_ratio
string
指定生成视频的宽高比。枚举值: 16:99:16。默认值为 16:9
duration_seconds
integer
您想要生成的视频文件的长度(秒)。枚举值: 468。默认值为 8
enhance_prompt
boolean
指定是否使用 Gemini 增强您的提示词。默认值: true
generate_audio
boolean
必填
指定是否为视频生成音频。
negative_prompt
string
描述您想要阻止模型生成的内容的文本字符串。
person_generation
string
控制是否允许人物或面部生成的安全设置。枚举值:
  • allow_adult (默认): 仅允许生成成人
  • dont_allow: 不允许在图像中包含人物或面部
  • allow_all: 允许生成所有年龄段的人物(需项目在 allowlist 中)
resolution
string
生成视频的分辨率。枚举值: 720p (默认) 或 1080p
sample_count
integer
要生成的视频数量。取值范围: 1-4
seed
uint32
用于初始化随机生成过程的数字。使用相同的种子、提示词和其他参数会产生相同的输出视频,使生成过程具有确定性。取值范围: 0-4,294,967,295

响应信息参数

task_id
string
必填
异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 以获取生成结果