go/resources/videos/methods/extend/index.md +0 −197 deleted
File Deleted View Diff
1## Create an extension of a completed video.
2
3`client.Videos.Extend(ctx, body) (*Video, error)`
4
5**post** `/videos/extensions`
6
7Create an extension of a completed video.
8
9### Parameters
10
11- `body VideoExtendParams`
12
13 - `Prompt param.Field[string]`
14
15 Updated text prompt that directs the extension generation.
16
17 - `Seconds param.Field[VideoSeconds]`
18
19 Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).
20
21 - `Video param.Field[VideoExtendParamsVideoUnion]`
22
23 Reference to the completed video to extend.
24
25 - `Reader`
26
27 - `type VideoExtendParamsVideoVideoReferenceInputParam struct{…}`
28
29 Reference to the completed video.
30
31 - `ID string`
32
33 The identifier of the completed video.
34
35### Returns
36
37- `type Video struct{…}`
38
39 Structured information describing a generated video job.
40
41 - `ID string`
42
43 Unique identifier for the video job.
44
45 - `CompletedAt int64`
46
47 Unix timestamp (seconds) for when the job completed, if finished.
48
49 - `CreatedAt int64`
50
51 Unix timestamp (seconds) for when the job was created.
52
53 - `Error VideoCreateError`
54
55 Error payload that explains why generation failed, if applicable.
56
57 - `Code string`
58
59 A machine-readable error code that was returned.
60
61 - `Message string`
62
63 A human-readable description of the error that was returned.
64
65 - `ExpiresAt int64`
66
67 Unix timestamp (seconds) for when the downloadable assets expire, if set.
68
69 - `Model VideoModel`
70
71 The video generation model that produced the job.
72
73 - `string`
74
75 - `type VideoModel string`
76
77 - `const VideoModelSora2 VideoModel = "sora-2"`
78
79 - `const VideoModelSora2Pro VideoModel = "sora-2-pro"`
80
81 - `const VideoModelSora2_2025_10_06 VideoModel = "sora-2-2025-10-06"`
82
83 - `const VideoModelSora2Pro2025_10_06 VideoModel = "sora-2-pro-2025-10-06"`
84
85 - `const VideoModelSora2_2025_12_08 VideoModel = "sora-2-2025-12-08"`
86
87 - `Object Video`
88
89 The object type, which is always `video`.
90
91 - `const VideoVideo Video = "video"`
92
93 - `Progress int64`
94
95 Approximate completion percentage for the generation task.
96
97 - `Prompt string`
98
99 The prompt that was used to generate the video.
100
101 - `RemixedFromVideoID string`
102
103 Identifier of the source video if this video is a remix.
104
105 - `Seconds VideoSeconds`
106
107 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
108
109 - `string`
110
111 - `type VideoSeconds string`
112
113 - `const VideoSeconds4 VideoSeconds = "4"`
114
115 - `const VideoSeconds8 VideoSeconds = "8"`
116
117 - `const VideoSeconds12 VideoSeconds = "12"`
118
119 - `Size VideoSize`
120
121 The resolution of the generated video.
122
123 - `const VideoSize720x1280 VideoSize = "720x1280"`
124
125 - `const VideoSize1280x720 VideoSize = "1280x720"`
126
127 - `const VideoSize1024x1792 VideoSize = "1024x1792"`
128
129 - `const VideoSize1792x1024 VideoSize = "1792x1024"`
130
131 - `Status VideoStatus`
132
133 Current lifecycle status of the video job.
134
135 - `const VideoStatusQueued VideoStatus = "queued"`
136
137 - `const VideoStatusInProgress VideoStatus = "in_progress"`
138
139 - `const VideoStatusCompleted VideoStatus = "completed"`
140
141 - `const VideoStatusFailed VideoStatus = "failed"`
142
143### Example
144
145```go
146package main
147
148import (
149 "bytes"
150 "context"
151 "fmt"
152 "io"
153
154 "github.com/openai/openai-go"
155 "github.com/openai/openai-go/option"
156)
157
158func main() {
159 client := openai.NewClient(
160 option.WithAPIKey("My API Key"),
161 )
162 video, err := client.Videos.Extend(context.TODO(), openai.VideoExtendParams{
163 Prompt: "x",
164 Seconds: openai.VideoSeconds4,
165 Video: openai.VideoExtendParamsVideoUnion{
166 OfFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),
167 },
168 })
169 if err != nil {
170 panic(err.Error())
171 }
172 fmt.Printf("%+v\n", video.ID)
173}
174```
175
176#### Response
177
178```json
179{
180 "id": "id",
181 "completed_at": 0,
182 "created_at": 0,
183 "error": {
184 "code": "code",
185 "message": "message"
186 },
187 "expires_at": 0,
188 "model": "string",
189 "object": "video",
190 "progress": 0,
191 "prompt": "prompt",
192 "remixed_from_video_id": "remixed_from_video_id",
193 "seconds": "string",
194 "size": "720x1280",
195 "status": "queued"
196}
197```