Skip to content

OpenAI Video Format

This page overview

Use the OpenAI video generation API to generate videos. It supports models such as Sora, and you can also use the OpenAI video format to call Kling, Jimeng, and vidu.

POST /v1/videos
ParameterTypeRequiredDescription
AuthorizationstringYesUser authentication token (Bearer: sk-xxxx)
Content-TypestringYesmultipart/form-data
ParameterTypeRequiredDescription
promptstringYesText prompt describing the video to generate
modelstringNoVideo generation model, defaults to sora-2
secondsstringNoVideo duration in seconds, defaults to 4 seconds
sizestringNoOutput resolution, in widthxheight format, defaults to 720x1280
input_referencefileNoOptional image reference used to guide generation
Terminal window
curl https://你的4All API服务器地址/v1/videos \
-H "Authorization: Bearer sk-xxxx" \
-F "model=sora-2" \
-F "prompt=A calico cat playing a piano on stage"
{
"id": "video_123",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1712697600,
"size": "1024x1808",
"seconds": "8",
"quality": "standard"
}
FieldTypeDescription
idstringVideo task ID
objectstringObject type, fixed as “video”
modelstringName of the model used
statusstringTask status (queued: queued, processing: in progress, completed: done, failed: failed)
progressintegerProcessing progress (0-100)
created_atintegerCreation timestamp
sizestringVideo resolution
secondsstringVideo duration in seconds
qualitystringVideo quality

Query the status and result of a video generation task by task ID

GET /v1/videos/{video_id}
ParameterTypeRequiredDescription
video_idstringYesVideo task ID
Terminal window
curl 'https://你的4All API服务器地址/v1/videos/video_123' \
-H "Authorization: Bearer sk-xxxx"
{
"id": "video_123",
"object": "video",
"model": "sora-2",
"status": "completed",
"progress": 100,
"created_at": 1712697600,
"size": "1024x1808",
"seconds": "8",
"quality": "standard",
"url": "https://example.com/video.mp4"
}
FieldTypeDescription
idstringVideo task ID
objectstringObject type, fixed as “video”
modelstringName of the model used
statusstringTask status (queued: queued, processing: in progress, completed: done, failed: failed)
progressintegerProcessing progress (0-100)
created_atintegerCreation timestamp
sizestringVideo resolution
secondsstringVideo duration in seconds
qualitystringVideo quality
urlstringVideo download link (when completed)

Get detailed information about a video generation task by task ID

GET /v1/videos/{video_id}
ParameterTypeRequiredDescription
video_idstringYesIdentifier of the video task to retrieve
Terminal window
curl 'https://你的4All API服务器地址/v1/videos/video_123' \
-H "Authorization: Bearer sk-xxxx"
{
"id": "video_123",
"object": "video",
"model": "sora-2",
"status": "completed",
"progress": 100,
"created_at": 1712697600,
"completed_at": 1712698000,
"expires_at": 1712784400,
"size": "1024x1808",
"seconds": "8",
"quality": "standard",
"remixed_from_video_id": null,
"error": null
}
FieldTypeDescription
idstringUnique identifier for the video task
objectstringObject type, fixed as “video”
modelstringName of the model used to generate the video
statusstringCurrent lifecycle status of the video task
progressintegerApproximate completion percentage of the generation task
created_atintegerUnix timestamp in seconds when the task was created
completed_atintegerUnix timestamp in seconds when the task completed, if completed
expires_atintegerUnix timestamp in seconds when the downloadable asset expires, if set
sizestringResolution of the generated video
secondsstringDuration of the generated video clip in seconds
qualitystringVideo quality
remixed_from_video_idstringIf this video is a remix, the identifier of the source video
errorobjectObject containing error information if generation fails

Download the completed video content

GET /v1/videos/{video_id}/content
ParameterTypeRequiredDescription
video_idstringYesIdentifier of the video to download
ParameterTypeRequiredDescription
variantstringNoType of downloadable asset to return, defaults to MP4 video
Terminal window
curl 'https://你的4All API服务器地址/v1/videos/video_123/content' \
-H "Authorization: Bearer sk-xxxx" \
-o "video.mp4"

Returns the video file stream directly, with Content-Type set to video/mp4

FieldTypeDescription
Content-TypestringVideo file type, usually video/mp4
Content-LengthstringVideo file size in bytes
Content-DispositionstringFile download information
{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error",
"code": "invalid_parameter"
}
}
{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "Insufficient permissions",
"type": "permission_error",
"code": "insufficient_permissions"
}
}
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
{
"error": {
"message": "Internal server error",
"type": "server_error",
"code": "internal_error"
}
}