Skip to content

Commit bd6712c

Browse files
committed
Add Videos API
1 parent 8ee1d9a commit bd6712c

File tree

14 files changed

+12957
-9715
lines changed

14 files changed

+12957
-9715
lines changed

api/OpenAI.net8.0.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public class OpenAIClient {
3737
public virtual RealtimeClient GetRealtimeClient();
3838
[Experimental("OPENAI001")]
3939
public virtual VectorStoreClient GetVectorStoreClient();
40+
[Experimental("OPENAI001")]
41+
public virtual Videos.VideosClient GetVideosClient();
4042
}
4143
public class OpenAIClientOptions : ClientPipelineOptions {
4244
public Uri Endpoint { get; set; }
@@ -6815,4 +6817,31 @@ public enum VectorStoreStatus {
68156817
Completed = 2,
68166818
Expired = 3
68176819
}
6820+
}
6821+
namespace OpenAI.Videos {
6822+
[Experimental("OPENAI001")]
6823+
public class VideosClient {
6824+
protected VideosClient();
6825+
public VideosClient(ApiKeyCredential credential, OpenAIClientOptions options);
6826+
public VideosClient(ApiKeyCredential credential);
6827+
public VideosClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOptions options);
6828+
public VideosClient(AuthenticationPolicy authenticationPolicy);
6829+
protected internal VideosClient(ClientPipeline pipeline, OpenAIClientOptions options);
6830+
public VideosClient(string apiKey);
6831+
[Experimental("OPENAI001")]
6832+
public Uri Endpoint { get; }
6833+
public ClientPipeline Pipeline { get; }
6834+
public virtual ClientResult CreateVideo(BinaryContent content, string contentType, RequestOptions options = null);
6835+
public virtual Task<ClientResult> CreateVideoAsync(BinaryContent content, string contentType, RequestOptions options = null);
6836+
public virtual ClientResult CreateVideoRemix(string videoId, BinaryContent content, string contentType, RequestOptions options = null);
6837+
public virtual Task<ClientResult> CreateVideoRemixAsync(string videoId, BinaryContent content, string contentType, RequestOptions options = null);
6838+
public virtual ClientResult DeleteVideo(string videoId, RequestOptions options = null);
6839+
public virtual Task<ClientResult> DeleteVideoAsync(string videoId, RequestOptions options = null);
6840+
public virtual ClientResult GetVideo(string videoId, RequestOptions options = null);
6841+
public virtual Task<ClientResult> GetVideoAsync(string videoId, RequestOptions options = null);
6842+
public virtual ClientResult GetVideos(long? limit = null, string order = null, string after = null, RequestOptions options = null);
6843+
public virtual Task<ClientResult> GetVideosAsync(long? limit = null, string order = null, string after = null, RequestOptions options = null);
6844+
public virtual ClientResult RetrieveVideoContent(string videoId, string variant = null, RequestOptions options = null);
6845+
public virtual Task<ClientResult> RetrieveVideoContentAsync(string videoId, string variant = null, RequestOptions options = null);
6846+
}
68186847
}

api/OpenAI.netstandard2.0.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class OpenAIClient {
2525
public virtual OpenAIResponseClient GetOpenAIResponseClient(string model);
2626
public virtual RealtimeClient GetRealtimeClient();
2727
public virtual VectorStoreClient GetVectorStoreClient();
28+
public virtual Videos.VideosClient GetVideosClient();
2829
}
2930
public class OpenAIClientOptions : ClientPipelineOptions {
3031
public Uri Endpoint { get; set; }
@@ -6007,4 +6008,29 @@ public enum VectorStoreStatus {
60076008
Completed = 2,
60086009
Expired = 3
60096010
}
6011+
}
6012+
namespace OpenAI.Videos {
6013+
public class VideosClient {
6014+
protected VideosClient();
6015+
public VideosClient(ApiKeyCredential credential, OpenAIClientOptions options);
6016+
public VideosClient(ApiKeyCredential credential);
6017+
public VideosClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOptions options);
6018+
public VideosClient(AuthenticationPolicy authenticationPolicy);
6019+
protected internal VideosClient(ClientPipeline pipeline, OpenAIClientOptions options);
6020+
public VideosClient(string apiKey);
6021+
public Uri Endpoint { get; }
6022+
public ClientPipeline Pipeline { get; }
6023+
public virtual ClientResult CreateVideo(BinaryContent content, string contentType, RequestOptions options = null);
6024+
public virtual Task<ClientResult> CreateVideoAsync(BinaryContent content, string contentType, RequestOptions options = null);
6025+
public virtual ClientResult CreateVideoRemix(string videoId, BinaryContent content, string contentType, RequestOptions options = null);
6026+
public virtual Task<ClientResult> CreateVideoRemixAsync(string videoId, BinaryContent content, string contentType, RequestOptions options = null);
6027+
public virtual ClientResult DeleteVideo(string videoId, RequestOptions options = null);
6028+
public virtual Task<ClientResult> DeleteVideoAsync(string videoId, RequestOptions options = null);
6029+
public virtual ClientResult GetVideo(string videoId, RequestOptions options = null);
6030+
public virtual Task<ClientResult> GetVideoAsync(string videoId, RequestOptions options = null);
6031+
public virtual ClientResult GetVideos(long? limit = null, string order = null, string after = null, RequestOptions options = null);
6032+
public virtual Task<ClientResult> GetVideosAsync(long? limit = null, string order = null, string after = null, RequestOptions options = null);
6033+
public virtual ClientResult RetrieveVideoContent(string videoId, string variant = null, RequestOptions options = null);
6034+
public virtual Task<ClientResult> RetrieveVideoContentAsync(string videoId, string variant = null, RequestOptions options = null);
6035+
}
60106036
}

specification/base/typespec/common/models.tsp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,12 @@ union ServiceTier {
468468
"flex",
469469
"scale",
470470
}
471+
472+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Auto-suppressed warnings non-applicable rules during import."
473+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
474+
enum OrderEnum {
475+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
476+
asc,
477+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
478+
desc,
479+
}

specification/base/typespec/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ import "./runs";
1919
import "./threads";
2020
import "./responses";
2121
import "./vector-stores";
22+
import "./videos";
2223
import "./uploads";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import "./models.tsp";
2+
import "./operations.tsp";
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
import "@typespec/openapi";
2+
import "@typespec/http";
3+
using TypeSpec.OpenAPI;
4+
using TypeSpec.Http;
5+
namespace OpenAI;
6+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
7+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
8+
model `Error-2` {
9+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
10+
code: string;
11+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
12+
message: string;
13+
}
14+
15+
/** Structured information describing a generated video job. */
16+
@summary("Video job")
17+
model VideoResource {
18+
/** Unique identifier for the video job. */
19+
id: string;
20+
21+
/** The object type, which is always `video`. */
22+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Auto-suppressed warnings non-applicable rules during import."
23+
@extension("x-stainless-const", true)
24+
object: "video" = "video";
25+
26+
/** The video generation model that produced the job. */
27+
`model`: VideoModel;
28+
29+
/** Current lifecycle status of the video job. */
30+
status: VideoStatus;
31+
32+
/** Approximate completion percentage for the generation task. */
33+
#suppress "@azure-tools/typespec-azure-core/no-generic-numeric" "Auto-suppressed warnings non-applicable rules during import."
34+
progress: integer;
35+
36+
/** Unix timestamp (seconds) for when the job was created. */
37+
#suppress "@azure-tools/typespec-azure-core/no-generic-numeric" "Auto-suppressed warnings non-applicable rules during import."
38+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
39+
created_at: integer;
40+
41+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
42+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
43+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "Auto-suppressed warnings non-applicable rules during import."
44+
completed_at: integer | null;
45+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
46+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
47+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "Auto-suppressed warnings non-applicable rules during import."
48+
expires_at: integer | null;
49+
50+
/** The resolution of the generated video. */
51+
size: VideoSize;
52+
53+
/** Duration of the generated clip in seconds. */
54+
seconds: VideoSeconds;
55+
56+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
57+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
58+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "Auto-suppressed warnings non-applicable rules during import."
59+
remixed_from_video_id: string | null;
60+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
61+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "Auto-suppressed warnings non-applicable rules during import."
62+
error: `Error-2` | null;
63+
}
64+
65+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Auto-suppressed warnings non-applicable rules during import."
66+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
67+
enum VideoModel {
68+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
69+
`sora-2`,
70+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
71+
`sora-2-pro`,
72+
}
73+
74+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Auto-suppressed warnings non-applicable rules during import."
75+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
76+
enum VideoStatus {
77+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
78+
queued,
79+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
80+
in_progress,
81+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
82+
completed,
83+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
84+
failed,
85+
}
86+
87+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Auto-suppressed warnings non-applicable rules during import."
88+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
89+
enum VideoSize {
90+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
91+
`720x1280`,
92+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
93+
`1280x720`,
94+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
95+
`1024x1792`,
96+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
97+
`1792x1024`,
98+
}
99+
100+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Auto-suppressed warnings non-applicable rules during import."
101+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
102+
enum VideoSeconds {
103+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
104+
`4`,
105+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
106+
`8`,
107+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
108+
`12`,
109+
}
110+
111+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
112+
model VideoListResource {
113+
/** The type of object returned, must be `list`. */
114+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Auto-suppressed warnings non-applicable rules during import."
115+
@extension("x-stainless-const", true)
116+
object: "list" = "list";
117+
118+
/** A list of items */
119+
data: VideoResource[];
120+
121+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
122+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
123+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "Auto-suppressed warnings non-applicable rules during import."
124+
first_id: string | null;
125+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
126+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
127+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "Auto-suppressed warnings non-applicable rules during import."
128+
last_id: string | null;
129+
130+
/** Whether there are more items available. */
131+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
132+
has_more: boolean;
133+
}
134+
135+
/** Parameters for creating a new video generation job. */
136+
@summary("Create video request")
137+
model CreateVideoBody {
138+
/** The video generation model to use. Defaults to `sora-2`. */
139+
`model`?: HttpPart<VideoModel>;
140+
141+
/** Text prompt that describes the video to generate. */
142+
prompt: HttpPart<VideoPrompt>;
143+
144+
/** Optional image reference that guides generation. */
145+
#suppress "@azure-tools/typespec-azure-core/casing-style" "Auto-suppressed warnings non-applicable rules during import."
146+
input_reference?: HttpPart<bytes>;
147+
148+
/** Clip duration in seconds. Defaults to 4 seconds. */
149+
seconds?: HttpPart<VideoSeconds>;
150+
151+
/** Output resolution formatted as width x height. Defaults to 720x1280. */
152+
size?: HttpPart<VideoSize>;
153+
}
154+
155+
/** Confirmation payload returned after deleting a video. */
156+
@summary("Deleted video response")
157+
model DeletedVideoResource {
158+
/** The object type that signals the deletion response. */
159+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "Auto-suppressed warnings non-applicable rules during import."
160+
@extension("x-stainless-const", true)
161+
object: "video.deleted" = "video.deleted";
162+
163+
/** Indicates that the video resource was deleted. */
164+
deleted: boolean;
165+
166+
/** Identifier of the deleted video. */
167+
id: string;
168+
}
169+
170+
/** Parameters for remixing an existing generated video. */
171+
@summary("Create video remix request")
172+
model CreateVideoRemixBody {
173+
/** Updated text prompt that directs the remix generation. */
174+
prompt: HttpPart<VideoPrompt>;
175+
}
176+
177+
@maxLength(32000)
178+
@minLength(1)
179+
scalar VideoPrompt extends string;
180+
181+
#suppress "@azure-tools/typespec-azure-core/no-enum" "Auto-suppressed warnings non-applicable rules during import."
182+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
183+
enum VideoContentVariant {
184+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
185+
video,
186+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
187+
thumbnail,
188+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "Auto-suppressed warnings non-applicable rules during import."
189+
spritesheet,
190+
}

0 commit comments

Comments
 (0)