跳转到内容
EN

下载视频内容

先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。

GET/openai/v1/videos/{video_id}/content● 支持

OpenAI 官方文档 ↗

请求参数

  • video_idstring必填

    path: Id of the video job whose output you want, the id returned by createVideo. The job must be completed; before that the call answers 400.

  • variantany可选◐ 部分支持
    默认 "video"

    query: Spritesheet is not available in this release (400).

    video、thumbnail 生效;spritesheet 返回 400。

    取值 videothumbnailspritesheet
  • indexinteger可选◐ 部分支持

    query: Output index; this release produces index 0. variant takes precedence.

    视频仅支持 index=0;大于 0 或负数返回 400。variant=thumbnail 时 index 接受但当前不生效。

返回

200

任务 completed 后下载视频文件(video,MP4)或缩略图(thumbnail);spritesheet 返回 400,index 只支持 0。任务不存在返回 404。

错误按 OpenAI 格式返回,参见 错误码

请求示例

curl
# 先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
curl https://api.deepraxis.com/openai/v1/videos/video_123/content \
  -H "Authorization: Bearer $PRAXIS_API_KEY" --output video.mp4
Python
# 先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepraxis.com/openai/v1",
    api_key="$PRAXIS_API_KEY",
)

content = client.videos.download_content("video_123")
content.write_to_file("video.mp4")
TypeScript
// 先调用「创建视频」,用返回的 ID 替换 video_123;下载前须轮询至 completed。
import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({
  baseURL: "https://api.deepraxis.com/openai/v1",
  apiKey: "$PRAXIS_API_KEY",
});

const content = await client.videos.downloadContent("video_123");
await fs.promises.writeFile("video.mp4", Buffer.from(await content.arrayBuffer()));

响应示例 200

{
  "content_type": "video/mp4",
  "bytes": 2756743
}

响应

HTTP 200

Video or thumbnail bytes

video/mp4

名称 类型 说明
$ string (binary)

image/jpeg

名称 类型 说明
$ string (binary)