Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Create an extension of a completed video.

client.videos.extend(VideoExtendParams { prompt, seconds, video } body, RequestOptionsoptions?): Video { id, completed_at, created_at, 10 more }
POST/videos/extensions

Create an extension of a completed video.

ParametersExpand Collapse
body: VideoExtendParams { prompt, seconds, video }
prompt: string

Updated text prompt that directs the extension generation.

minLength1
maxLength32000
seconds: VideoSeconds

Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).

video: Uploadable | VideoReferenceInputParam { id }

Reference to the completed video to extend.

ReturnsExpand Collapse
Video { id, completed_at, created_at, 10 more }

Structured information describing a generated video job.

id: string

Unique identifier for the video job.

completed_at: number | null

Unix timestamp (seconds) for when the job completed, if finished.

formatunixtime
created_at: number

Unix timestamp (seconds) for when the job was created.

formatunixtime
error: VideoCreateError { code, message } | null

Error payload that explains why generation failed, if applicable.

expires_at: number | null

Unix timestamp (seconds) for when the downloadable assets expire, if set.

formatunixtime
model: VideoModel

The video generation model that produced the job.

object: "video"

The object type, which is always video.

progress: number

Approximate completion percentage for the generation task.

prompt: string | null

The prompt that was used to generate the video.

remixed_from_video_id: string | null

Identifier of the source video if this video is a remix.

seconds: (string & {}) | VideoSeconds

Duration of the generated clip in seconds. For extensions, this is the stitched total duration.

size: VideoSize

The resolution of the generated video.

status: "queued" | "in_progress" | "completed" | "failed"

Current lifecycle status of the video job.

Create an extension of a completed video.

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const video = await client.videos.extend({
  prompt: 'x',
  seconds: '4',
  video: fs.createReadStream('path/to/file'),
});

console.log(video.id);
{
  "id": "id",
  "completed_at": 0,
  "created_at": 0,
  "error": {
    "code": "code",
    "message": "message"
  },
  "expires_at": 0,
  "model": "sora-2",
  "object": "video",
  "progress": 0,
  "prompt": "prompt",
  "remixed_from_video_id": "remixed_from_video_id",
  "seconds": "4",
  "size": "720x1280",
  "status": "queued"
}
Returns Examples
{
  "id": "id",
  "completed_at": 0,
  "created_at": 0,
  "error": {
    "code": "code",
    "message": "message"
  },
  "expires_at": 0,
  "model": "sora-2",
  "object": "video",
  "progress": 0,
  "prompt": "prompt",
  "remixed_from_video_id": "remixed_from_video_id",
  "seconds": "4",
  "size": "720x1280",
  "status": "queued"
}