java/resources/videos/methods/extend/index.md +0 −185 deleted
File Deleted View Diff
1## Create an extension of a completed video.
2
3`Video videos().extend(VideoExtendParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
4
5**post** `/videos/extensions`
6
7Create an extension of a completed video.
8
9### Parameters
10
11- `VideoExtendParams params`
12
13 - `String prompt`
14
15 Updated text prompt that directs the extension generation.
16
17 - `VideoSeconds seconds`
18
19 Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).
20
21 - `Video video`
22
23 Reference to the completed video to extend.
24
25 - `String`
26
27 - `class VideoReferenceInputParam:`
28
29 Reference to the completed video.
30
31 - `String id`
32
33 The identifier of the completed video.
34
35### Returns
36
37- `class Video:`
38
39 Structured information describing a generated video job.
40
41 - `String id`
42
43 Unique identifier for the video job.
44
45 - `Optional<Long> completedAt`
46
47 Unix timestamp (seconds) for when the job completed, if finished.
48
49 - `long createdAt`
50
51 Unix timestamp (seconds) for when the job was created.
52
53 - `Optional<VideoCreateError> error`
54
55 Error payload that explains why generation failed, if applicable.
56
57 - `String code`
58
59 A machine-readable error code that was returned.
60
61 - `String message`
62
63 A human-readable description of the error that was returned.
64
65 - `Optional<Long> expiresAt`
66
67 Unix timestamp (seconds) for when the downloadable assets expire, if set.
68
69 - `VideoModel model`
70
71 The video generation model that produced the job.
72
73 - `SORA_2("sora-2")`
74
75 - `SORA_2_PRO("sora-2-pro")`
76
77 - `SORA_2_2025_10_06("sora-2-2025-10-06")`
78
79 - `SORA_2_PRO_2025_10_06("sora-2-pro-2025-10-06")`
80
81 - `SORA_2_2025_12_08("sora-2-2025-12-08")`
82
83 - `JsonValue; object_ "video"constant`
84
85 The object type, which is always `video`.
86
87 - `VIDEO("video")`
88
89 - `long progress`
90
91 Approximate completion percentage for the generation task.
92
93 - `Optional<String> prompt`
94
95 The prompt that was used to generate the video.
96
97 - `Optional<String> remixedFromVideoId`
98
99 Identifier of the source video if this video is a remix.
100
101 - `VideoSeconds seconds`
102
103 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
104
105 - `_4("4")`
106
107 - `_8("8")`
108
109 - `_12("12")`
110
111 - `VideoSize size`
112
113 The resolution of the generated video.
114
115 - `_720X1280("720x1280")`
116
117 - `_1280X720("1280x720")`
118
119 - `_1024X1792("1024x1792")`
120
121 - `_1792X1024("1792x1024")`
122
123 - `Status status`
124
125 Current lifecycle status of the video job.
126
127 - `QUEUED("queued")`
128
129 - `IN_PROGRESS("in_progress")`
130
131 - `COMPLETED("completed")`
132
133 - `FAILED("failed")`
134
135### Example
136
137```java
138package com.openai.example;
139
140import com.openai.client.OpenAIClient;
141import com.openai.client.okhttp.OpenAIOkHttpClient;
142import com.openai.models.videos.Video;
143import com.openai.models.videos.VideoExtendParams;
144import com.openai.models.videos.VideoSeconds;
145import java.io.ByteArrayInputStream;
146import java.io.InputStream;
147
148public final class Main {
149 private Main() {}
150
151 public static void main(String[] args) {
152 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
153
154 VideoExtendParams params = VideoExtendParams.builder()
155 .prompt("x")
156 .seconds(VideoSeconds._4)
157 .video(new ByteArrayInputStream("Example data".getBytes()))
158 .build();
159 Video video = client.videos().extend(params);
160 }
161}
162```
163
164#### Response
165
166```json
167{
168 "id": "id",
169 "completed_at": 0,
170 "created_at": 0,
171 "error": {
172 "code": "code",
173 "message": "message"
174 },
175 "expires_at": 0,
176 "model": "string",
177 "object": "video",
178 "progress": 0,
179 "prompt": "prompt",
180 "remixed_from_video_id": "remixed_from_video_id",
181 "seconds": "string",
182 "size": "720x1280",
183 "status": "queued"
184}
185```