go/resources/videos/methods/edit/index.md +0 −192 deleted
File Deleted View Diff
1## Create a new video generation job by editing a source video or existing generated video.
2
3`client.Videos.Edit(ctx, body) (*Video, error)`
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- `body VideoEditParams`
12
13 - `Prompt param.Field[string]`
14
15 Text prompt that describes how to edit the source video.
16
17 - `Video param.Field[VideoEditParamsVideoUnion]`
18
19 Reference to the completed video to edit.
20
21 - `Reader`
22
23 - `type VideoEditParamsVideoVideoReferenceInputParam struct{…}`
24
25 Reference to the completed video.
26
27 - `ID string`
28
29 The identifier of the completed video.
30
31### Returns
32
33- `type Video struct{…}`
34
35 Structured information describing a generated video job.
36
37 - `ID string`
38
39 Unique identifier for the video job.
40
41 - `CompletedAt int64`
42
43 Unix timestamp (seconds) for when the job completed, if finished.
44
45 - `CreatedAt int64`
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 - `ExpiresAt int64`
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`
70
71 - `type VideoModel string`
72
73 - `const VideoModelSora2 VideoModel = "sora-2"`
74
75 - `const VideoModelSora2Pro VideoModel = "sora-2-pro"`
76
77 - `const VideoModelSora2_2025_10_06 VideoModel = "sora-2-2025-10-06"`
78
79 - `const VideoModelSora2Pro2025_10_06 VideoModel = "sora-2-pro-2025-10-06"`
80
81 - `const VideoModelSora2_2025_12_08 VideoModel = "sora-2-2025-12-08"`
82
83 - `Object Video`
84
85 The object type, which is always `video`.
86
87 - `const VideoVideo Video = "video"`
88
89 - `Progress int64`
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 - `RemixedFromVideoID string`
98
99 Identifier of the source video if this video is a remix.
100
101 - `Seconds VideoSeconds`
102
103 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
104
105 - `string`
106
107 - `type VideoSeconds string`
108
109 - `const VideoSeconds4 VideoSeconds = "4"`
110
111 - `const VideoSeconds8 VideoSeconds = "8"`
112
113 - `const VideoSeconds12 VideoSeconds = "12"`
114
115 - `Size VideoSize`
116
117 The resolution of the generated video.
118
119 - `const VideoSize720x1280 VideoSize = "720x1280"`
120
121 - `const VideoSize1280x720 VideoSize = "1280x720"`
122
123 - `const VideoSize1024x1792 VideoSize = "1024x1792"`
124
125 - `const VideoSize1792x1024 VideoSize = "1792x1024"`
126
127 - `Status VideoStatus`
128
129 Current lifecycle status of the video job.
130
131 - `const VideoStatusQueued VideoStatus = "queued"`
132
133 - `const VideoStatusInProgress VideoStatus = "in_progress"`
134
135 - `const VideoStatusCompleted VideoStatus = "completed"`
136
137 - `const VideoStatusFailed VideoStatus = "failed"`
138
139### Example
140
141```go
142package main
143
144import (
145 "bytes"
146 "context"
147 "fmt"
148 "io"
149
150 "github.com/openai/openai-go"
151 "github.com/openai/openai-go/option"
152)
153
154func main() {
155 client := openai.NewClient(
156 option.WithAPIKey("My API Key"),
157 )
158 video, err := client.Videos.Edit(context.TODO(), openai.VideoEditParams{
159 Prompt: "x",
160 Video: openai.VideoEditParamsVideoUnion{
161 OfFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),
162 },
163 })
164 if err != nil {
165 panic(err.Error())
166 }
167 fmt.Printf("%+v\n", video.ID)
168}
169```
170
171#### Response
172
173```json
174{
175 "id": "id",
176 "completed_at": 0,
177 "created_at": 0,
178 "error": {
179 "code": "code",
180 "message": "message"
181 },
182 "expires_at": 0,
183 "model": "string",
184 "object": "video",
185 "progress": 0,
186 "prompt": "prompt",
187 "remixed_from_video_id": "remixed_from_video_id",
188 "seconds": "string",
189 "size": "720x1280",
190 "status": "queued"
191}
192```