跳转至

图像生成视频(查询状态)

POST /api/v5/video/status

根据请求ID(request_id)查询图像生成视频任务的生成状态与结果。视频生成成功时返回视频URL,失败时返回错误信息。

访问令牌支持说明

  • AtomGit 用户访问令牌(AtomGit user access tokens)

是否允许匿名访问

此接口允许匿名访问

请求参数

参数名 位置 类型 必填 说明
Authorization header string 否 用户访问令牌;此接口允许匿名访问,也可不携带

Request Body:

请求体为一个 JSON 对象,包含图像生成视频接口下发的请求ID。

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "request_id": {
      "description": "请求ID",
      "type": "string",
      "minLength": 1,
      "example": "009522a671394f3f5ac02c63b1a62662"
    }
  },
  "required": ["request_id"]
}

响应参数

字段 类型 必返 可为空 说明
request_id string 是 否 请求ID(有效时长为 24h,请尽快获取结果)
status string 是 否 处理状态,枚举:running / failed / succeeded
video_url string 否 是 视频URL(仅成功返回,且有效时长为 10 分钟)
error_message string 否 是 错误信息(仅异常时出现)

失败响应

接口在参数校验失败、未登录或业务失败(状态为 failed)时返回 400,系统异常时返回 500。

400 参数错误或业务失败

{
  "request_id": "009522a671394f3f5ac02c63b1a62662",
  "status": "failed",
  "error_message": "用户未登录"
}

500 系统异常

{
  "request_id": "009522a671394f3f5ac02c63b1a62662",
  "status": "failed",
  "error_message": "系统异常,请稍后重试"
}

HTTP 响应状态码

状态码 说明
200 成功(OK)—— 查询成功,状态为 succeeded 或 running
400 参数错误或业务失败(Bad Request)
500 系统内部错误(Internal Server Error)

请求示例

参数说明

<request_id> 替换为图像生成视频接口返回的请求ID;<token> 替换为你的 AtomGit 用户访问令牌。此接口允许匿名访问,认证头可不携带。

cURL

curl -X POST 'https://api.atomgit.com/api/v5/video/status' \
  -H 'Authorization: <token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"request_id": "<request_id>"}'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v5/video/status", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "<YOUR-TOKEN>",
  },
  body: JSON.stringify({
    request_id: "<request_id>",
  }),
});

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v5/video/status",
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json",
        "Authorization": "<YOUR-TOKEN>",
    },
    json={"request_id": "<request_id>"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

响应示例

状态码: 200

{
  "request_id": "2600c2714f184f9087060b014fb2f7a3",
  "status": "succeeded",
  "video_url": "https://ai-inference-cdn-static.gitcode.com/video-2600c2714f184f9087060b014fb2f7a3-output.mp4?auth_key=1765510460-86c58596bd5944b1af78aa3587cfb902-0-44a97eda8e44774e561eaced4dd124865c7855ca2e251f3099b3ec3aea77c62b"
}

错误码

错误码 说明
400 参数错误、未登录或业务失败(状态为 failed)
401 未认证或凭证无效(缺少/无效的访问凭证)
404 请求路径不存在
405 请求方法不支持
429 请求过于频繁,触发限流
500 系统内部错误

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 gitcode-dev/atomgit-api-doc