> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tkhub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建视频 

> OpenAI 兼容的视频生成接口。

参考文档: https://platform.openai.com/docs/api-reference/videos/create




## OpenAPI

````yaml /api.json post /v1/videos
openapi: 3.0.1
info:
  title: TKHub API
  description: TKHub 平台 API 接口文档
  version: 1.0.0
servers:
  - url: https://api.tkhub.ai
    description: 生产环境
  - url: https://api-test.tkhub.ai
    description: 测试环境
security:
  - bearerAuth: []
paths:
  /v1/videos:
    post:
      tags:
        - 视频生成/Sora兼容格式
      summary: '创建视频 '
      description: |
        OpenAI 兼容的视频生成接口。

        参考文档: https://platform.openai.com/docs/api-reference/videos/create
      operationId: createVideo
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                model:
                  description: 模型名称
                  example: sora-2
                  type: string
                prompt:
                  description: 提示词
                  example: cute cat dance
                  type: string
                seconds:
                  description: 生成秒数
                  example: '8'
                  type: string
                input_reference:
                  format: binary
                  type: string
                  description: 参考图片文件
                  example: ''
            examples: {}
      responses:
        '200':
          description: 成功创建视频任务
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 视频 ID
                  object:
                    type: string
                    description: 对象类型
                  model:
                    type: string
                    description: 使用的模型
                  status:
                    type: string
                    description: 任务状态
                  progress:
                    type: integer
                    description: 进度百分比
                  created_at:
                    type: integer
                    description: 创建时间戳
                  seconds:
                    type: string
                    description: 视频时长
                  completed_at:
                    type: integer
                    description: 完成时间戳
                  expires_at:
                    type: integer
                    description: 过期时间戳
                  size:
                    type: string
                    description: 视频尺寸
                  error:
                    $ref: '#/components/schemas/OpenAIVideoError'
                  metadata:
                    type: object
                    description: 额外元数据
                    additionalProperties: true
                    properties: {}
                required:
                  - id
                  - object
                  - model
                  - status
                  - progress
                  - created_at
                  - seconds
              example:
                id: sora-2-123456
                object: video
                model: sora-2
                status: queued
                progress: 0
                created_at: 1764347090922
                seconds: '8'
          headers: {}
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    OpenAIVideoError:
      type: object
      description: OpenAI 视频错误信息
      properties:
        message:
          type: string
          description: 错误信息
        code:
          type: string
          description: 错误码
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: 错误信息
            type:
              type: string
              description: 错误类型
            param:
              type: string
              description: 相关参数
              nullable: true
            code:
              type: string
              description: 错误代码
              nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        使用 Bearer Token 认证。
        格式: `Authorization: Bearer sk-xxxxxx`

````