python/resources/videos/methods/edit/index.md +0 −176 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(VideoEditParams**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: str`
12
13 Text prompt that describes how to edit the source video.
14
15- `video: Video`
16
17 Reference to the completed video to edit.
18
19 - `FileTypes`
20
21 Reference to the completed video to edit.
22
23 - `class VideoVideoReferenceInputParam: …`
24
25 Reference to the completed video.
26
27 - `id: str`
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: str`
38
39 Unique identifier for the video job.
40
41 - `completed_at: Optional[int]`
42
43 Unix timestamp (seconds) for when the job completed, if finished.
44
45 - `created_at: int`
46
47 Unix timestamp (seconds) for when the job was created.
48
49 - `error: Optional[VideoCreateError]`
50
51 Error payload that explains why generation failed, if applicable.
52
53 - `code: str`
54
55 A machine-readable error code that was returned.
56
57 - `message: str`
58
59 A human-readable description of the error that was returned.
60
61 - `expires_at: Optional[int]`
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 - `str`
70
71 - `Literal["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: Literal["video"]`
84
85 The object type, which is always `video`.
86
87 - `"video"`
88
89 - `progress: int`
90
91 Approximate completion percentage for the generation task.
92
93 - `prompt: Optional[str]`
94
95 The prompt that was used to generate the video.
96
97 - `remixed_from_video_id: Optional[str]`
98
99 Identifier of the source video if this video is a remix.
100
101 - `seconds: Union[str, VideoSeconds]`
102
103 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
104
105 - `str`
106
107 - `Literal["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: Literal["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```python
142import os
143from openai import OpenAI
144
145client = OpenAI(
146 api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
147)
148video = client.videos.edit(
149 prompt="x",
150 video=b"Example data",
151)
152print(video.id)
153```
154
155#### Response
156
157```json
158{
159 "id": "id",
160 "completed_at": 0,
161 "created_at": 0,
162 "error": {
163 "code": "code",
164 "message": "message"
165 },
166 "expires_at": 0,
167 "model": "string",
168 "object": "video",
169 "progress": 0,
170 "prompt": "prompt",
171 "remixed_from_video_id": "remixed_from_video_id",
172 "seconds": "string",
173 "size": "720x1280",
174 "status": "queued"
175}
176```