媒体生成
生成视频
根据文本提示生成视频(异步)。
POST
/
api
/
v1
/
video
生成视频
curl --request POST \
--url https://api.example.com/api/v1/video \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"duration": "<string>",
"style": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/video"
payload = {
"prompt": "<string>",
"duration": "<string>",
"style": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>', duration: '<string>', style: '<string>'})
};
fetch('https://api.example.com/api/v1/video', 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/api/v1/video",
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>',
'duration' => '<string>',
'style' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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/api/v1/video"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"duration\": \"<string>\",\n \"style\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/api/v1/video")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"duration\": \"<string>\",\n \"style\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"duration\": \"<string>\",\n \"style\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"job_id": "<string>",
"status": "<string>",
"created": "<string>",
"poll_url": "<string>"
}根据文本提示生成视频。这是一个异步端点——它会立即返回一个任务 ID(HTTP 202),视频将在后台生成。
视频生成是异步的。请使用 获取任务状态 轮询任务状态,或在 SDK 中使用
theo.waitForJob()。AI 披露水印。 由 Theo 返回的每个视频右下角都带有一个小型半透明的 Theo 徽标。这是一个溯源标识,用于标明该片段为 AI 生成,并且始终会被应用(无论品牌偏好设置如何)。每个片段预计会因重新编码而增加 2-15 秒的延迟。
身份验证
需要 Bearer 令牌。参见 身份验证。请求体
string
必填
要生成的视频的文本描述。
string
目标视频时长(例如
"5s"、"10s"、"15s")。string
视觉风格(例如
"cinematic"、"animation"、"timelapse")。请求示例
curl -X POST https://www.hitheo.ai/api/v1/video \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A 5-second animation of a rocket launch",
"duration": "5s",
"style": "cinematic"
}'
const job = await theo.video({
prompt: "A 5-second animation of a rocket launch",
duration: "5s",
style: "cinematic",
});
// Poll until complete
const result = await theo.waitForJob(job.job_id);
console.log(result.result); // Video URL
响应(HTTP 202)
string
唯一的视频请求 ID(以
vid_ 为前缀)。string
用于轮询状态的任务 ID。
string
创建时始终为
"queued"。string
ISO 8601 时间戳。
string
用于轮询任务状态的相对 URL(例如
/api/v1/jobs/{job_id})。响应示例
{
"id": "vid_abc123",
"job_id": "job_xyz789",
"status": "queued",
"created": "2026-04-10T12:00:00Z",
"poll_url": "/api/v1/jobs/job_xyz789"
}
轮询结果
使用 获取任务状态 端点检查进度。当status 为 "completed" 时,result 字段将包含视频 URL。
curl https://www.hitheo.ai/api/v1/jobs/job_xyz789 \
-H "Authorization: Bearer $THEO_API_KEY"
错误
| 状态码 | 代码 | 描述 |
|---|---|---|
| 400 | missing_prompt | 缺少必需的 prompt 参数 |
| 401 | invalid_api_key | API 密钥缺失或无效 |
| 503 | queue_unavailable | 视频生成队列当前不可用——请稍后重试 |
此页面对您有帮助吗?
生成视频
curl --request POST \
--url https://api.example.com/api/v1/video \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"duration": "<string>",
"style": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/video"
payload = {
"prompt": "<string>",
"duration": "<string>",
"style": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>', duration: '<string>', style: '<string>'})
};
fetch('https://api.example.com/api/v1/video', 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/api/v1/video",
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>',
'duration' => '<string>',
'style' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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/api/v1/video"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"duration\": \"<string>\",\n \"style\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/api/v1/video")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"duration\": \"<string>\",\n \"style\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"duration\": \"<string>\",\n \"style\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"job_id": "<string>",
"status": "<string>",
"created": "<string>",
"poll_url": "<string>"
}