查询即梦视频任务
curl --request POST \
--url https://api.aiohub.org/jimeng/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"req_key": "doubao-seedance-2-0-fast-260128",
"task_id": "task_example"
}
'import requests
url = "https://api.aiohub.org/jimeng/"
payload = {
"req_key": "doubao-seedance-2-0-fast-260128",
"task_id": "task_example"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({req_key: 'doubao-seedance-2-0-fast-260128', task_id: 'task_example'})
};
fetch('https://api.aiohub.org/jimeng/', 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/jimeng/",
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([
'req_key' => 'doubao-seedance-2-0-fast-260128',
'task_id' => 'task_example'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.aiohub.org/jimeng/"
payload := strings.NewReader("{\n \"req_key\": \"doubao-seedance-2-0-fast-260128\",\n \"task_id\": \"task_example\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.aiohub.org/jimeng/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"req_key\": \"doubao-seedance-2-0-fast-260128\",\n \"task_id\": \"task_example\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/jimeng/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"req_key\": \"doubao-seedance-2-0-fast-260128\",\n \"task_id\": \"task_example\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"message": "",
"data": {
"task_id": "task_example",
"status": "IN_PROGRESS",
"progress": "50%",
"fail_reason": ""
}
}查询视频 · 即梦兼容
查询任务状态、判断成功或失败,并获取视频下载地址。
POST
/
jimeng
/
查询即梦视频任务
curl --request POST \
--url https://api.aiohub.org/jimeng/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"req_key": "doubao-seedance-2-0-fast-260128",
"task_id": "task_example"
}
'import requests
url = "https://api.aiohub.org/jimeng/"
payload = {
"req_key": "doubao-seedance-2-0-fast-260128",
"task_id": "task_example"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({req_key: 'doubao-seedance-2-0-fast-260128', task_id: 'task_example'})
};
fetch('https://api.aiohub.org/jimeng/', 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/jimeng/",
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([
'req_key' => 'doubao-seedance-2-0-fast-260128',
'task_id' => 'task_example'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.aiohub.org/jimeng/"
payload := strings.NewReader("{\n \"req_key\": \"doubao-seedance-2-0-fast-260128\",\n \"task_id\": \"task_example\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.aiohub.org/jimeng/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"req_key\": \"doubao-seedance-2-0-fast-260128\",\n \"task_id\": \"task_example\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/jimeng/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"req_key\": \"doubao-seedance-2-0-fast-260128\",\n \"task_id\": \"task_example\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"message": "",
"data": {
"task_id": "task_example",
"status": "IN_PROGRESS",
"progress": "50%",
"fail_reason": ""
}
}查询与状态判断
把<TASK_ID> 替换为返回的 task_id,保持相同 req_key,每 10 到 15 秒查询一次:
curl "https://api.aiohub.org/jimeng/?Action=CVSync2AsyncGetResult&Version=2022-08-31" \
-H "Authorization: Bearer <AIOHUB_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"req_key": "doubao-seedance-2-0-fast-260128",
"task_id": "<TASK_ID>"
}'
data.status | 处理 |
|---|---|
SUBMITTED / QUEUED / IN_PROGRESS | 继续查询 |
SUCCESS | 读取 data.result_url 并下载 |
FAILURE | 停止查询,读取 data.fail_reason |
code: success 表示查询请求成功,不代表视频已生成。成功任务的关键字段如下:
{
"code": "success",
"data": {
"status": "SUCCESS",
"result_url": "https://api.aiohub.org/v1/videos/task_example/content"
}
}
失败与重试
查询断线后继续用原task_id 查询;FAILURE 时读取 data.fail_reason。不要用 CVSync2AsyncSubmitTask 重试查询。文件保留 72 小时,任务记录保留 7 天。
收到 429 或临时不可用错误时,等待后重试查询,不要重新创建任务。查询不到任务时,确认任务标识和 API 令牌所属账号。授权
API key (sk-xxx)
查询参数
操作名称,使用此页的固定值。
可用选项:
CVSync2AsyncGetResult 协议版本。
可用选项:
2022-08-31