查询视频生成状态
curl --request GET \
--url https://api.senseaudio.cn/v1/video/status \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.senseaudio.cn/v1/video/status"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.senseaudio.cn/v1/video/status', 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.senseaudio.cn/v1/video/status",
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.senseaudio.cn/v1/video/status"
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.senseaudio.cn/v1/video/status")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.senseaudio.cn/v1/video/status")
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": "<string>",
"model": "<string>",
"task_id": "<string>",
"progress": 123,
"video_url": "<string>",
"duration": 123,
"is_new": true,
"error_message": "<string>",
"created_at": 123,
"completed_at": 123,
"prompt": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"content": [
{
"text": "<string>",
"url": "<string>",
"audio_url": "<string>",
"video_url": "<string>"
}
],
"provider_specific": {
"generate_audio": true
}
}视频生成
查询视频生成状态
GET
/
v1
/
video
/
status
查询视频生成状态
curl --request GET \
--url https://api.senseaudio.cn/v1/video/status \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.senseaudio.cn/v1/video/status"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.senseaudio.cn/v1/video/status', 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.senseaudio.cn/v1/video/status",
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.senseaudio.cn/v1/video/status"
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.senseaudio.cn/v1/video/status")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.senseaudio.cn/v1/video/status")
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": "<string>",
"model": "<string>",
"task_id": "<string>",
"progress": 123,
"video_url": "<string>",
"duration": 123,
"is_new": true,
"error_message": "<string>",
"created_at": 123,
"completed_at": 123,
"prompt": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"content": [
{
"text": "<string>",
"url": "<string>",
"audio_url": "<string>",
"video_url": "<string>"
}
],
"provider_specific": {
"generate_audio": true
}
}说明
根据任务 ID 查询视频生成任务的当前状态、进度与最终结果。视频生成为异步任务,建议创建任务后每 5–10 秒轮询一次状态,直到返回
completed 或 failed。接口概览
| 项目 | 值 |
|---|---|
| 接口地址 | https://api.senseaudio.cn/v1/video/status |
| 请求方式 | GET |
| Content-Type | application/json |
| 鉴权方式 | Bearer Token |
请求头
| 参数名 | 必填 | 说明 | 示例 |
|---|---|---|---|
Authorization | 是 | 鉴权 Token,格式 Bearer SENSEAUDIO_API_KEY | Bearer sk-123456... |
Content-Type | 是 | 固定为 application/json | application/json |
请求参数(Query)
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
id | string | 是 | 创建任务时返回的任务 ID |
响应结构
| 参数名 | 类型 | 描述 |
|---|---|---|
id | string | 记录 ID |
model | string | 模型名称 |
task_id | string | 任务 ID |
status | string | 任务状态,见下表 |
progress | int64 | 进度百分比 |
video_url | string | 视频 URL(completed 后返回) |
duration | int64 | 实际视频时长(秒) |
is_new | boolean | 是否为新视频 |
error_message | string | 错误信息(failed 时返回) |
created_at | int64 | 创建时间戳 |
completed_at | int64 | 完成时间戳 |
prompt | string | 提示词 |
resolution | string | 分辨率,如 720p |
ratio | string | 宽高比,如 16:9、9:16 |
content | array | 描述视频的文字或图片 |
provider_specific | object | 模型特殊参数 |
状态说明
| 状态值 | 说明 |
|---|---|
pending | 等待处理 |
processing | 处理中 |
completed | 已完成 |
failed | 失败 |
响应示例
{
"id": "52e0c397-2f78-4c1f-8774-d51aba5e4e3c",
"model": "Seedance-2.0",
"task_id": "c4666acd-60fa-4e1e-8c8b-72ae129f7a4d",
"status": "pending",
"progress": 0,
"duration": 10,
"is_new": true,
"created_at": 1773822549,
"prompt": "",
"resolution": "720p",
"content": [
{
"type": "text",
"text": "黄昏海边,海浪轻轻拍打礁石,镜头缓慢推进"
}
],
"ratio": "16:9"
}
代码示例
curl -X GET "https://api.senseaudio.cn/v1/video/status?id=task_1234567890" \
-H "Authorization: Bearer SENSEAUDIO_API_KEY" \
-H "Content-Type: application/json"
import requests
import time
API_URL = "https://api.senseaudio.cn/v1/video/status"
HEADERS = {
"Authorization": "Bearer SENSEAUDIO_API_KEY",
"Content-Type": "application/json"
}
def get_video_status(task_id):
resp = requests.get(API_URL, headers=HEADERS, params={"id": task_id})
return resp.json() if resp.status_code == 200 else None
def poll_video_status(task_id, max_attempts=60):
"""轮询视频状态直到完成"""
for _ in range(max_attempts):
result = get_video_status(task_id)
if result:
status = result.get("status")
progress = result.get("progress", 0)
print(f"状态: {status}, 进度: {progress}%")
if status == "completed":
print(f"视频生成完成: {result.get('video_url')}")
return result
if status == "failed":
print(f"生成失败: {result.get('error_message')}")
return result
time.sleep(5)
return None
result = poll_video_status("task_1234567890")
const axios = require('axios');
const API_URL = 'https://api.senseaudio.cn/v1/video/status';
const HEADERS = {
'Authorization': 'Bearer SENSEAUDIO_API_KEY',
'Content-Type': 'application/json'
};
async function getVideoStatus(taskId) {
const res = await axios.get(API_URL, { headers: HEADERS, params: { id: taskId } });
return res.data;
}
async function pollVideoStatus(taskId, maxAttempts = 60) {
for (let i = 0; i < maxAttempts; i++) {
const result = await getVideoStatus(taskId);
if (result) {
const { status, progress } = result;
console.log(`状态: ${status}, 进度: ${progress}%`);
if (status === 'completed') {
console.log(`视频生成完成: ${result.video_url}`);
return result;
}
if (status === 'failed') {
console.log(`生成失败: ${result.error_message}`);
return result;
}
}
await new Promise(r => setTimeout(r, 5000));
}
return null;
}
pollVideoStatus('task_1234567890').then(console.log);
注意事项
- 轮询建议:视频生成需要时间,建议每 5–10 秒查询一次状态
- 超时处理:如果长时间处于
processing状态,可能需要重新创建任务 - 错误处理:当
status为failed时,查看error_message了解失败原因
授权
格式:Bearer <API_KEY>
查询参数
响应
200 - application/json
成功
记录 ID
模型名称
任务 ID
任务状态
可用选项:
pending, processing, completed, failed 进度百分比
视频 URL(completed 后返回)
实际视频时长(秒)
是否为新视频
错误信息(failed 时返回)
创建时间戳
完成时间戳
提示词
分辨率,如 720p、1080p
宽高比,如 16:9、9:16、4:3、3:4、1:1
描述视频的文字、图片、音频或视频
Show child attributes
Show child attributes
厂商特定参数
Show child attributes
Show child attributes
⌘I