Skip to content
Primary navigation

Create an extension of a completed video.

client.Videos.Extend(ctx, body) (*Video, error)
POST/videos/extensions

Create an extension of a completed video.

ParametersExpand Collapse
body VideoExtendParams
Prompt param.Field[string]

Updated text prompt that directs the extension generation.

maxLength32000
minLength1
Seconds param.Field[VideoSeconds]

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

Video param.Field[VideoExtendParamsVideoUnion]

Reference to the completed video to extend.

Reader
type VideoExtendParamsVideoVideoReferenceInputParam struct{…}

Reference to the completed video.

ID string

The identifier of the completed video.

ReturnsExpand Collapse
type Video struct{…}

Structured information describing a generated video job.

ID string

Unique identifier for the video job.

CompletedAt int64

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

CreatedAt int64

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

Error payload that explains why generation failed, if applicable.

Code string

A machine-readable error code that was returned.

Message string

A human-readable description of the error that was returned.

ExpiresAt int64

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

Model VideoModel

The video generation model that produced the job.

One of the following:
string
type VideoModel string
One of the following:
const VideoModelSora2 VideoModel = "sora-2"
const VideoModelSora2Pro VideoModel = "sora-2-pro"
const VideoModelSora2_2025_10_06 VideoModel = "sora-2-2025-10-06"
const VideoModelSora2Pro2025_10_06 VideoModel = "sora-2-pro-2025-10-06"
const VideoModelSora2_2025_12_08 VideoModel = "sora-2-2025-12-08"
Object Video

The object type, which is always video.

Progress int64

Approximate completion percentage for the generation task.

Prompt string

The prompt that was used to generate the video.

RemixedFromVideoID string

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

Seconds VideoSeconds

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

One of the following:
string
type VideoSeconds string
One of the following:
const VideoSeconds4 VideoSeconds = "4"
const VideoSeconds8 VideoSeconds = "8"
const VideoSeconds12 VideoSeconds = "12"

The resolution of the generated video.

One of the following:
const VideoSize720x1280 VideoSize = "720x1280"
const VideoSize1280x720 VideoSize = "1280x720"
const VideoSize1024x1792 VideoSize = "1024x1792"
const VideoSize1792x1024 VideoSize = "1792x1024"
Status VideoStatus

Current lifecycle status of the video job.

One of the following:
const VideoStatusQueued VideoStatus = "queued"
const VideoStatusInProgress VideoStatus = "in_progress"
const VideoStatusCompleted VideoStatus = "completed"
const VideoStatusFailed VideoStatus = "failed"

Create an extension of a completed video.

package main

import (
  "bytes"
  "context"
  "fmt"
  "io"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  video, err := client.Videos.Extend(context.TODO(), openai.VideoExtendParams{
    Prompt: "x",
    Seconds: openai.VideoSeconds4,
    Video: openai.VideoExtendParamsVideoUnion{
      OfFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", video.ID)
}
{
  "id": "id",
  "completed_at": 0,
  "created_at": 0,
  "error": {
    "code": "code",
    "message": "message"
  },
  "expires_at": 0,
  "model": "string",
  "object": "video",
  "progress": 0,
  "prompt": "prompt",
  "remixed_from_video_id": "remixed_from_video_id",
  "seconds": "string",
  "size": "720x1280",
  "status": "queued"
}
Returns Examples
{
  "id": "id",
  "completed_at": 0,
  "created_at": 0,
  "error": {
    "code": "code",
    "message": "message"
  },
  "expires_at": 0,
  "model": "string",
  "object": "video",
  "progress": 0,
  "prompt": "prompt",
  "remixed_from_video_id": "remixed_from_video_id",
  "seconds": "string",
  "size": "720x1280",
  "status": "queued"
}