媒體生成
生成視頻
根據文本提示生成視頻(異步)。
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>"
}