资源
获取任务状态
轮询异步任务(视频、研究等)的状态。
GET
/
api
/
v1
/
jobs
/
{id}
获取任务状态
curl --request GET \
--url https://api.example.com/api/v1/jobs/{id}import requests
url = "https://api.example.com/api/v1/jobs/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/jobs/{id}', 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/jobs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/jobs/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/jobs/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/jobs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"status": "<string>",
"progress": 123,
"result": {},
"error": {},
"created_at": {},
"completed_at": {}
}获取一个异步任务的当前状态。用于从 Video 和 Research 端点轮询结果。
认证
需要 Bearer 令牌。参见认证。路径参数
string
必填
异步端点返回的任务 ID(例如
job_xyz789)。请求示例
curl https://www.hitheo.ai/api/v1/jobs/job_xyz789 \
-H "Authorization: Bearer $THEO_API_KEY"
// 单次轮询
const status = await theo.job("job_xyz789");
console.log(status.status, status.progress);
// 自动轮询直到完成(推荐)
const result = await theo.waitForJob("job_xyz789");
console.log(result.result);
响应
string
任务 ID。
string
任务类型(例如
"video"、"research")。string
当前状态:
"queued"、"active"、"completed" 或 "failed"。number
进度百分比(0–100)。
object | null
任务结果。在状态变为
"completed" 之前为 null。其具体结构取决于任务的 type —— 参见下方的各类型的结果模式。任何提供方/模型标识始终以 Theo 品牌呈现(engine / model),绝不暴露原始上游名称。string | null
当状态为
"failed" 时的错误信息。string | null
任务创建的时间。
string | null
任务完成(或失败)的时间。
响应示例(已完成)
result 是一个对象,而非单纯的 URL。以视频任务为例:
{
"id": "job_xyz789",
"type": "video",
"status": "completed",
"progress": 100,
"result": {
"videoUrl": "https://artifacts.hitheo.ai/video/xyz789.mp4",
"model": "Theo Motion",
"engine": "theo-motion",
"durationMs": 90000
},
"error": null,
"created_at": "2026-04-10T12:00:00Z",
"completed_at": "2026-04-10T12:01:30Z"
}
响应示例(进行中)
{
"id": "job_xyz789",
"type": "research",
"status": "active",
"progress": 45,
"result": null,
"error": null,
"created_at": "2026-04-10T12:00:00Z",
"completed_at": null
}
SDK 的
theo.waitForJob(jobId, { intervalMs, maxWaitMs, signal, onProgress }) 会以可配置的间隔(默认 2 秒)自动轮询,支持整体超时(默认 5 分钟)、可选的 AbortSignal,以及 onProgress 回调。旧版的位置参数形式 waitForJob(id, intervalMs, maxWaitMs) 依然可用。参见异步任务指南。各类型的结果模式
result 对象因任务 type 而异。这些结构与 SDK 中的类型化结果接口(ResearchJobResult、VideoJobResult、ImageJobResult、DocumentJobResult)一一对应 —— 使用 theo.waitForJob<VideoJobResult>(...) 轮询即可获得对应类型。
research
{
"report": "# Markdown report with inline citations...",
"sources": [{ "title": "Source title", "url": "https://..." }],
"queries": ["generated search query"],
"sourceCount": 8
}
video
{ "videoUrl": "https://...", "model": "Theo Motion", "engine": "theo-motion", "durationMs": 90000 }
image
{ "imageUrl": "https://...", "model": "Theo Studio", "engine": "theo-studio" }
document
{ "title": "Report", "format": "pdf", "downloadUrl": "https://...", "sizeBytes": 248000 }
端点
GET /api/v1/jobs/{id}
需要通过 Bearer 令牌进行认证。参见认证。此页面对您有帮助吗?
获取任务状态
curl --request GET \
--url https://api.example.com/api/v1/jobs/{id}import requests
url = "https://api.example.com/api/v1/jobs/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/jobs/{id}', 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/jobs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/jobs/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/jobs/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/jobs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"status": "<string>",
"progress": 123,
"result": {},
"error": {},
"created_at": {},
"completed_at": {}
}