go/resources/videos/methods/retrieve/index.md +0 −189 deleted
File Deleted View Diff
1## Retrieve video
2
3`client.Videos.Get(ctx, videoID) (*Video, error)`
4
5**get** `/videos/{video_id}`
6
7Fetch the latest metadata for a generated video.
8
9### Parameters
10
11- `videoID string`
12
13### Returns
14
15- `type Video struct{…}`
16
17 Structured information describing a generated video job.
18
19 - `ID string`
20
21 Unique identifier for the video job.
22
23 - `CompletedAt int64`
24
25 Unix timestamp (seconds) for when the job completed, if finished.
26
27 - `CreatedAt int64`
28
29 Unix timestamp (seconds) for when the job was created.
30
31 - `Error VideoCreateError`
32
33 Error payload that explains why generation failed, if applicable.
34
35 - `Code string`
36
37 A machine-readable error code that was returned.
38
39 - `Message string`
40
41 A human-readable description of the error that was returned.
42
43 - `ExpiresAt int64`
44
45 Unix timestamp (seconds) for when the downloadable assets expire, if set.
46
47 - `Model VideoModel`
48
49 The video generation model that produced the job.
50
51 - `string`
52
53 - `type VideoModel string`
54
55 - `const VideoModelSora2 VideoModel = "sora-2"`
56
57 - `const VideoModelSora2Pro VideoModel = "sora-2-pro"`
58
59 - `const VideoModelSora2_2025_10_06 VideoModel = "sora-2-2025-10-06"`
60
61 - `const VideoModelSora2Pro2025_10_06 VideoModel = "sora-2-pro-2025-10-06"`
62
63 - `const VideoModelSora2_2025_12_08 VideoModel = "sora-2-2025-12-08"`
64
65 - `Object Video`
66
67 The object type, which is always `video`.
68
69 - `const VideoVideo Video = "video"`
70
71 - `Progress int64`
72
73 Approximate completion percentage for the generation task.
74
75 - `Prompt string`
76
77 The prompt that was used to generate the video.
78
79 - `RemixedFromVideoID string`
80
81 Identifier of the source video if this video is a remix.
82
83 - `Seconds VideoSeconds`
84
85 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
86
87 - `string`
88
89 - `type VideoSeconds string`
90
91 - `const VideoSeconds4 VideoSeconds = "4"`
92
93 - `const VideoSeconds8 VideoSeconds = "8"`
94
95 - `const VideoSeconds12 VideoSeconds = "12"`
96
97 - `Size VideoSize`
98
99 The resolution of the generated video.
100
101 - `const VideoSize720x1280 VideoSize = "720x1280"`
102
103 - `const VideoSize1280x720 VideoSize = "1280x720"`
104
105 - `const VideoSize1024x1792 VideoSize = "1024x1792"`
106
107 - `const VideoSize1792x1024 VideoSize = "1792x1024"`
108
109 - `Status VideoStatus`
110
111 Current lifecycle status of the video job.
112
113 - `const VideoStatusQueued VideoStatus = "queued"`
114
115 - `const VideoStatusInProgress VideoStatus = "in_progress"`
116
117 - `const VideoStatusCompleted VideoStatus = "completed"`
118
119 - `const VideoStatusFailed VideoStatus = "failed"`
120
121### Example
122
123```go
124package main
125
126import (
127 "context"
128 "fmt"
129
130 "github.com/openai/openai-go"
131 "github.com/openai/openai-go/option"
132)
133
134func main() {
135 client := openai.NewClient(
136 option.WithAPIKey("My API Key"),
137 )
138 video, err := client.Videos.Get(context.TODO(), "video_123")
139 if err != nil {
140 panic(err.Error())
141 }
142 fmt.Printf("%+v\n", video.ID)
143}
144```
145
146#### Response
147
148```json
149{
150 "id": "id",
151 "completed_at": 0,
152 "created_at": 0,
153 "error": {
154 "code": "code",
155 "message": "message"
156 },
157 "expires_at": 0,
158 "model": "string",
159 "object": "video",
160 "progress": 0,
161 "prompt": "prompt",
162 "remixed_from_video_id": "remixed_from_video_id",
163 "seconds": "string",
164 "size": "720x1280",
165 "status": "queued"
166}
167```
168
169### Example
170
171```go
172package main
173
174import (
175 "context"
176 "fmt"
177
178 "github.com/openai/openai-go"
179)
180
181func main() {
182 client := openai.NewClient()
183 video, err := client.Videos.Get(context.TODO(), "video_123")
184 if err != nil {
185 panic(err.Error())
186 }
187 fmt.Printf("%+v\n", video.ID)
188}
189```