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(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.

minLength1
maxLength32000
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.

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.

formatunixtime
CreatedAt int64

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

formatunixtime

Error payload that explains why generation failed, if applicable.

ExpiresAt int64

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 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.

The resolution of the generated video.

Status VideoStatus

Current lifecycle status of the video job.

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": "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"
}