查询视频任务
curl --request GET \
--url https://api.aiohub.org/v1/contents/generations/tasks/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1/contents/generations/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aiohub.org/v1/contents/generations/tasks/{task_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.aiohub.org/v1/contents/generations/tasks/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.aiohub.org/v1/contents/generations/tasks/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.aiohub.org/v1/contents/generations/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1/contents/generations/tasks/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ",
"model": "doubao-seedance-2-5-260628",
"status": "succeeded",
"error": null,
"content": {
"video_url": "https://api.aiohub.org/v1/videos/task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ/content"
},
"usage": {
"completion_tokens": 87300,
"total_tokens": 87300
},
"output_format": "mp4",
"framespersecond": 24,
"resolution": "720p",
"ratio": "16:9",
"duration": 4,
"generate_audio": true,
"priority": 0,
"service_tier": "default",
"execution_expires_after": 172800,
"created_at": 1791275108,
"updated_at": 1791275315
}{
"code": "invalid_duration",
"message": "duration must be between 4 and 30 seconds for this model"
}查询视频 · Ark / Seedance
查询任务状态、判断成功或失败,并获取视频下载地址。
GET
/
v1
/
contents
/
generations
/
tasks
/
{task_id}
查询视频任务
curl --request GET \
--url https://api.aiohub.org/v1/contents/generations/tasks/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1/contents/generations/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aiohub.org/v1/contents/generations/tasks/{task_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.aiohub.org/v1/contents/generations/tasks/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.aiohub.org/v1/contents/generations/tasks/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.aiohub.org/v1/contents/generations/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1/contents/generations/tasks/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ",
"model": "doubao-seedance-2-5-260628",
"status": "succeeded",
"error": null,
"content": {
"video_url": "https://api.aiohub.org/v1/videos/task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ/content"
},
"usage": {
"completion_tokens": 87300,
"total_tokens": 87300
},
"output_format": "mp4",
"framespersecond": 24,
"resolution": "720p",
"ratio": "16:9",
"duration": 4,
"generate_audio": true,
"priority": 0,
"service_tier": "default",
"execution_expires_after": 172800,
"created_at": 1791275108,
"updated_at": 1791275315
}{
"code": "invalid_duration",
"message": "duration must be between 4 and 30 seconds for this model"
}查询与状态判断
将<TASK_ID> 替换为返回的 id,每 10 到 15 秒查询一次:
curl "https://api.aiohub.org/v1/contents/generations/tasks/<TASK_ID>" \
-H "Authorization: Bearer <AIOHUB_API_KEY>"
status | 处理 |
|---|---|
queued / running | 继续查询 |
succeeded | 下载视频 |
failed / cancelled / expired | 停止查询,读取 error.message(如有) |
读取成功结果
成功响应的关键字段如下,下载地址以实际响应为准:{
"id": "task_example",
"status": "succeeded",
"content": {
"video_url": "https://api.aiohub.org/v1/videos/task_example/content"
}
}
失败与重试
查询断线后使用原id 继续查询。任务记录保留 7 天;找不到任务时,请确认任务标识和 API 令牌所属账号。failed、cancelled、expired 都应停止轮询。
收到 429 或临时不可用错误时,等待后重试查询,不要重新创建任务。查询不到任务时,确认任务标识和 API 令牌所属账号。授权
API key (sk-xxx)
路径参数
创建任务时返回的 id
响应
任务对象
视频任务对象。
任务 ID
示例:
"task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ"
示例:
"doubao-seedance-2-5-260628"
任务状态
可用选项:
queued, running, succeeded, failed, cancelled, expired 任务未成功时的错误,成功时为 null。
Show child attributes
Show child attributes
状态为 succeeded 时的产物地址,下载时携带同一个 API 令牌。
Show child attributes
Show child attributes
Show child attributes
Show child attributes
示例:
"mp4"
示例:
24
运行中为请求值,成功后为实际交付值。
运行中为请求值,成功后为实际交付值。
运行中为请求值,成功后为实际交付值。
示例:
"default"
示例:
172800
创建时间(Unix 秒)
最近更新时间(Unix 秒)