python/resources/videos/methods/extend/index.md +0 −187 deleted
File Deleted View Diff
1## Create an extension of a completed video.
2
3`videos.extend(VideoExtendParams**kwargs) -> Video`
4
5**post** `/videos/extensions`
6
7Create an extension of a completed video.
8
9### Parameters
10
11- `prompt: str`
12
13 Updated text prompt that directs the extension generation.
14
15- `seconds: VideoSeconds`
16
17 Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).
18
19 - `"4"`
20
21 - `"8"`
22
23 - `"12"`
24
25- `video: Video`
26
27 Reference to the completed video to extend.
28
29 - `FileTypes`
30
31 Reference to the completed video to extend.
32
33 - `class VideoVideoReferenceInputParam: …`
34
35 Reference to the completed video.
36
37 - `id: str`
38
39 The identifier of the completed video.
40
41### Returns
42
43- `class Video: …`
44
45 Structured information describing a generated video job.
46
47 - `id: str`
48
49 Unique identifier for the video job.
50
51 - `completed_at: Optional[int]`
52
53 Unix timestamp (seconds) for when the job completed, if finished.
54
55 - `created_at: int`
56
57 Unix timestamp (seconds) for when the job was created.
58
59 - `error: Optional[VideoCreateError]`
60
61 Error payload that explains why generation failed, if applicable.
62
63 - `code: str`
64
65 A machine-readable error code that was returned.
66
67 - `message: str`
68
69 A human-readable description of the error that was returned.
70
71 - `expires_at: Optional[int]`
72
73 Unix timestamp (seconds) for when the downloadable assets expire, if set.
74
75 - `model: VideoModel`
76
77 The video generation model that produced the job.
78
79 - `str`
80
81 - `Literal["sora-2", "sora-2-pro", "sora-2-2025-10-06", 2 more]`
82
83 - `"sora-2"`
84
85 - `"sora-2-pro"`
86
87 - `"sora-2-2025-10-06"`
88
89 - `"sora-2-pro-2025-10-06"`
90
91 - `"sora-2-2025-12-08"`
92
93 - `object: Literal["video"]`
94
95 The object type, which is always `video`.
96
97 - `"video"`
98
99 - `progress: int`
100
101 Approximate completion percentage for the generation task.
102
103 - `prompt: Optional[str]`
104
105 The prompt that was used to generate the video.
106
107 - `remixed_from_video_id: Optional[str]`
108
109 Identifier of the source video if this video is a remix.
110
111 - `seconds: Union[str, VideoSeconds]`
112
113 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
114
115 - `str`
116
117 - `Literal["4", "8", "12"]`
118
119 - `"4"`
120
121 - `"8"`
122
123 - `"12"`
124
125 - `size: VideoSize`
126
127 The resolution of the generated video.
128
129 - `"720x1280"`
130
131 - `"1280x720"`
132
133 - `"1024x1792"`
134
135 - `"1792x1024"`
136
137 - `status: Literal["queued", "in_progress", "completed", "failed"]`
138
139 Current lifecycle status of the video job.
140
141 - `"queued"`
142
143 - `"in_progress"`
144
145 - `"completed"`
146
147 - `"failed"`
148
149### Example
150
151```python
152import os
153from openai import OpenAI
154
155client = OpenAI(
156 api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
157)
158video = client.videos.extend(
159 prompt="x",
160 seconds="4",
161 video=b"Example data",
162)
163print(video.id)
164```
165
166#### Response
167
168```json
169{
170 "id": "id",
171 "completed_at": 0,
172 "created_at": 0,
173 "error": {
174 "code": "code",
175 "message": "message"
176 },
177 "expires_at": 0,
178 "model": "string",
179 "object": "video",
180 "progress": 0,
181 "prompt": "prompt",
182 "remixed_from_video_id": "remixed_from_video_id",
183 "seconds": "string",
184 "size": "720x1280",
185 "status": "queued"
186}
187```