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