Skip to content

创建视频

POST /v1/videos

OpenAI 兼容的视频生成接口。

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

基本信息

项目内容
Base URLhttps://www.yunzhuhub.cn
标签视频生成/Sora兼容格式
Operation IDcreateVideo

认证

  • BearerAuth:使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

密钥安全

请只使用你自己的 API Key。示例中的 <YOUR_API_KEY> 必须在本地替换,不要把真实密钥提交到代码仓库或发送给他人。

参数

无额外路径或查询参数。

请求体

Content-Type: multipart/form-data

json
{
  "type": "object",
  "properties": {
    "model": {
      "description": "模型名称",
      "example": "<MODEL_ID>",
      "type": "string"
    },
    "prompt": {
      "description": "提示词",
      "example": "cute cat dance",
      "type": "string"
    },
    "seconds": {
      "description": "生成秒数",
      "example": "8",
      "type": "string"
    },
    "input_reference": {
      "format": "binary",
      "type": "string",
      "description": "参考图片文件",
      "example": ""
    }
  }
}

请求示例

以下示例只用于复制到本地终端,不会从文档站发送请求。

bash
curl --request POST 'https://www.yunzhuhub.cn/v1/videos' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '<REQUEST_JSON>'

响应

200 成功创建视频任务

json
{
  "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"
  ]
}

400 请求参数错误

json
{
  "title": "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
        }
      }
    }
  }
}

云筑Hub 文档。底层项目基于 New API