OpenAI Video Format
OpenAI Video Format
Section titled “OpenAI Video Format”This page overview
OpenAI Video Format
Section titled “OpenAI Video Format”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.
Generate Video
Section titled “Generate Video”API Endpoint
Section titled “API Endpoint”POST /v1/videosRequest Headers
Section titled “Request Headers”| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | User authentication token (Bearer: sk-xxxx) |
| Content-Type | string | Yes | multipart/form-data |
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text prompt describing the video to generate |
| model | string | No | Video generation model, defaults to sora-2 |
| seconds | string | No | Video duration in seconds, defaults to 4 seconds |
| size | string | No | Output resolution, in widthxheight format, defaults to 720x1280 |
| input_reference | file | No | Optional image reference used to guide generation |
Request Example
Section titled “Request Example”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"Response Format
Section titled “Response Format”200 - Successful Response
Section titled “200 - Successful Response”{ "id": "video_123", "object": "video", "model": "sora-2", "status": "queued", "progress": 0, "created_at": 1712697600, "size": "1024x1808", "seconds": "8", "quality": "standard"}Response Field Descriptions
Section titled “Response Field Descriptions”| Field | Type | Description |
|---|---|---|
| id | string | Video task ID |
| object | string | Object type, fixed as “video” |
| model | string | Name of the model used |
| status | string | Task status (queued: queued, processing: in progress, completed: done, failed: failed) |
| progress | integer | Processing progress (0-100) |
| created_at | integer | Creation timestamp |
| size | string | Video resolution |
| seconds | string | Video duration in seconds |
| quality | string | Video quality |
Query Video
Section titled “Query Video”Query the status and result of a video generation task by task ID
API Endpoint
Section titled “API Endpoint”GET /v1/videos/{video_id}Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| video_id | string | Yes | Video task ID |
Request Example
Section titled “Request Example”curl 'https://你的4All API服务器地址/v1/videos/video_123' \ -H "Authorization: Bearer sk-xxxx"Response Format
Section titled “Response Format”200 - Successful Response
Section titled “200 - Successful Response”{ "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"}Response Field Descriptions
Section titled “Response Field Descriptions”| Field | Type | Description |
|---|---|---|
| id | string | Video task ID |
| object | string | Object type, fixed as “video” |
| model | string | Name of the model used |
| status | string | Task status (queued: queued, processing: in progress, completed: done, failed: failed) |
| progress | integer | Processing progress (0-100) |
| created_at | integer | Creation timestamp |
| size | string | Video resolution |
| seconds | string | Video duration in seconds |
| quality | string | Video quality |
| url | string | Video download link (when completed) |
Get Video Task Status
Section titled “Get Video Task Status”Get detailed information about a video generation task by task ID
API Endpoint
Section titled “API Endpoint”GET /v1/videos/{video_id}Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| video_id | string | Yes | Identifier of the video task to retrieve |
Request Example
Section titled “Request Example”curl 'https://你的4All API服务器地址/v1/videos/video_123' \ -H "Authorization: Bearer sk-xxxx"Response Format
Section titled “Response Format”200 - Successful Response
Section titled “200 - Successful Response”{ "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}Response Field Descriptions
Section titled “Response Field Descriptions”| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the video task |
| object | string | Object type, fixed as “video” |
| model | string | Name of the model used to generate the video |
| status | string | Current lifecycle status of the video task |
| progress | integer | Approximate completion percentage of the generation task |
| created_at | integer | Unix timestamp in seconds when the task was created |
| completed_at | integer | Unix timestamp in seconds when the task completed, if completed |
| expires_at | integer | Unix timestamp in seconds when the downloadable asset expires, if set |
| size | string | Resolution of the generated video |
| seconds | string | Duration of the generated video clip in seconds |
| quality | string | Video quality |
| remixed_from_video_id | string | If this video is a remix, the identifier of the source video |
| error | object | Object containing error information if generation fails |
Get Video Content
Section titled “Get Video Content”Download the completed video content
API Endpoint
Section titled “API Endpoint”GET /v1/videos/{video_id}/contentPath Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| video_id | string | Yes | Identifier of the video to download |
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| variant | string | No | Type of downloadable asset to return, defaults to MP4 video |
Request Example
Section titled “Request Example”curl 'https://你的4All API服务器地址/v1/videos/video_123/content' \ -H "Authorization: Bearer sk-xxxx" \ -o "video.mp4"Response Format
Section titled “Response Format”200 - Successful Response
Section titled “200 - Successful Response”Returns the video file stream directly, with Content-Type set to video/mp4
Response Header Descriptions
Section titled “Response Header Descriptions”| Field | Type | Description |
|---|---|---|
| Content-Type | string | Video file type, usually video/mp4 |
| Content-Length | string | Video file size in bytes |
| Content-Disposition | string | File download information |
Error Responses
Section titled “Error Responses”400 - Invalid Request Parameters
Section titled “400 - Invalid Request Parameters”{ "error": { "message": "Invalid request parameters", "type": "invalid_request_error", "code": "invalid_parameter" }}401 - Unauthorized
Section titled “401 - Unauthorized”{ "error": { "message": "Invalid API key", "type": "authentication_error", "code": "invalid_api_key" }}403 - Forbidden
Section titled “403 - Forbidden”{ "error": { "message": "Insufficient permissions", "type": "permission_error", "code": "insufficient_permissions" }}429 - Rate Limit Exceeded
Section titled “429 - Rate Limit Exceeded”{ "error": { "message": "Rate limit exceeded", "type": "rate_limit_error", "code": "rate_limit_exceeded" }}500 - Internal Server Error
Section titled “500 - Internal Server Error”{ "error": { "message": "Internal server error", "type": "server_error", "code": "internal_error" }}