Skip to content

文生视频

Sora 文生视频接口,用于将文本提示生成短视频。


概览

  • 请求方法:POST
  • 请求路径:/v1/videos
  • 内容类型:application/json
  • 分类:视频模型(Video)/sora视频

认证方式

  • Header:Authorization: Bearer <token>

请求参数

字段类型必填描述
promptstring生成视频的文本提示
modelstring模型名称,支持 sora-2sora-2-pro,默认 sora-2
secondsstring视频时长,字符串类型,支持 4812,默认 4
sizestring视频尺寸,支持 720x12801280x7201024x17921792x1024,1792 尺寸仅支持 sora-2-pro

请求示例

curl 示例

bash
curl -X POST "https://api.gpt.ge/v1/videos" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $YOUR_TOKEN" \
  -d '{
    "prompt": "一只凶猛的老虎破门闯入农家小院,土狗吓得跑开,猫咪跳出来击败吓跑老虎。",
    "model": "sora-2",
    "seconds": "8",
    "size": "1280x720"
  }'

JavaScript (fetch) 示例

javascript
fetch('https://api.gpt.ge/v1/videos', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: JSON.stringify({
    prompt: '一只凶猛的老虎破门闯入农家小院,土狗吓得跑开,猫咪跳出来击败吓跑老虎。',
    model: 'sora-2',
    seconds: '8',
    size: '1280x720'
  })
})
  .then(res => res.json())
  .then(console.log)

Python 示例(requests)

python
import requests

resp = requests.post(
    'https://api.gpt.ge/v1/videos',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
    },
    json={
        'prompt': '一只凶猛的老虎破门闯入农家小院,土狗吓得跑开,猫咪跳出来击败吓跑老虎。',
        'model': 'sora-2',
        'seconds': '8',
        'size': '1280x720'
    }
)
print(resp.json())

返回字段说明

字段类型描述
idstring视频任务 ID
objectstring返回对象类型,一般为 video
created_atinteger创建时间戳
statusstring任务状态
completed_atnull完成时间,未完成时为 null
errornull错误信息,成功时为 null
expires_atnull过期时间,当前返回 null
modelstring使用的模型
progressinteger任务进度
remixed_from_video_idnullremix 源视频 ID,当前未使用时为 null
secondsstring视频时长
sizestring视频尺寸

返回示例(200)

json
{
  "id": "video_68f082321ed08193a4eaf01376fa10bc0284bd663de64dc5",
  "object": "video",
  "created_at": 1760592434,
  "status": "queued",
  "completed_at": null,
  "error": null,
  "expires_at": null,
  "model": "sora-2",
  "progress": 0,
  "remixed_from_video_id": null,
  "seconds": "8",
  "size": "1280x720"
}