Skip to content

Commit b0ebf44

Browse files
feat: Add support for video model media params
1 parent 84100cb commit b0ebf44

3 files changed

Lines changed: 125 additions & 6 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 75
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-cb426a424ebc4c1b0c9a774aa167edb2cc78139736fb9cb3314678e8cbdc0b57.yml
3-
openapi_spec_hash: eb45b0703de7ff4daf0502f78597a3b7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-76f8801298719cc87e9dc4c64b321bcfd432416d76488499d340b4bb6bf81b9b.yml
3+
openapi_spec_hash: ce0b83ef0a5f174461bd7d13a379b636
44
config_hash: 52d213100a0ca1a4b2cdcd2718936b51

src/resources/videos.ts

Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,16 @@ export interface VideoCreateParams {
131131
fps?: number;
132132

133133
/**
134-
* Array of images to guide video generation, similar to keyframes.
134+
* @deprecated Deprecated: use media.frame_images instead. Array of images to guide
135+
* video generation, similar to keyframes.
135136
*/
136137
frame_images?: Array<VideoCreateParams.FrameImage>;
137138

139+
/**
140+
* Whether to generate audio for the video.
141+
*/
142+
generate_audio?: boolean;
143+
138144
/**
139145
* Controls how closely the video generation follows your prompt. Higher values
140146
* make the model adhere more strictly to your text description, while lower values
@@ -146,6 +152,12 @@ export interface VideoCreateParams {
146152

147153
height?: number;
148154

155+
/**
156+
* Media inputs for video generation. The accepted fields depend on the model type
157+
* (e.g. i2v, r2v, t2v, videoedit).
158+
*/
159+
media?: VideoCreateParams.Media;
160+
149161
/**
150162
* Similar to prompt, but specifies what to avoid instead of what to include
151163
*/
@@ -167,12 +179,22 @@ export interface VideoCreateParams {
167179
prompt?: string;
168180

169181
/**
170-
* Unlike frame_images which constrain specific timeline positions, reference
171-
* images guide the general appearance that should appear consistently across the
172-
* video.
182+
* Aspect ratio of the video.
183+
*/
184+
ratio?: string;
185+
186+
/**
187+
* @deprecated Deprecated: use media.reference_images instead. Unlike frame_images
188+
* which constrain specific timeline positions, reference images guide the general
189+
* appearance that should appear consistently across the video.
173190
*/
174191
reference_images?: Array<string>;
175192

193+
/**
194+
* Video resolution.
195+
*/
196+
resolution?: string;
197+
176198
/**
177199
* Clip duration in seconds.
178200
*/
@@ -212,6 +234,92 @@ export namespace VideoCreateParams {
212234
*/
213235
frame?: number | 'first' | 'last';
214236
}
237+
238+
/**
239+
* Media inputs for video generation. The accepted fields depend on the model type
240+
* (e.g. i2v, r2v, t2v, videoedit).
241+
*/
242+
export interface Media {
243+
/**
244+
* Array of audio inputs.
245+
*/
246+
audio_inputs?: Array<Media.AudioInput>;
247+
248+
/**
249+
* Array of images to guide video generation at specific timeline positions.
250+
*/
251+
frame_images?: Array<Media.FrameImage>;
252+
253+
/**
254+
* Array of video clips to use as starting clips.
255+
*/
256+
frame_videos?: Array<Media.FrameVideo>;
257+
258+
/**
259+
* Array of image URLs that guide the general appearance across the video.
260+
*/
261+
reference_images?: Array<string>;
262+
263+
/**
264+
* Array of reference videos.
265+
*/
266+
reference_videos?: Array<Media.ReferenceVideo>;
267+
268+
/**
269+
* Source video to edit.
270+
*/
271+
source_video?: Media.SourceVideo;
272+
}
273+
274+
export namespace Media {
275+
export interface AudioInput {
276+
/**
277+
* URL of the audio.
278+
*/
279+
audio: string;
280+
}
281+
282+
export interface FrameImage {
283+
/**
284+
* URL path to hosted image that is used for a frame
285+
*/
286+
input_image: string;
287+
288+
/**
289+
* Optional param to specify where to insert the frame. If this is omitted, the
290+
* following heuristics are applied:
291+
*
292+
* - frame_images size is one, frame is first.
293+
* - If size is two, frames are first and last.
294+
* - If size is larger, frames are first, last and evenly spaced between.
295+
*/
296+
frame?: number | 'first' | 'last';
297+
}
298+
299+
export interface FrameVideo {
300+
/**
301+
* URL of the video.
302+
*/
303+
video: string;
304+
}
305+
306+
export interface ReferenceVideo {
307+
/**
308+
* URL of the video.
309+
*/
310+
video: string;
311+
}
312+
313+
/**
314+
* Source video to edit.
315+
*/
316+
export interface SourceVideo {
317+
/**
318+
* URL of the video.
319+
*/
320+
video: string;
321+
}
322+
}
215323
}
216324

217325
export declare namespace Videos {

tests/api-resources/videos.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,24 @@ describe('resource videos', () => {
2424
model: 'model',
2525
fps: 0,
2626
frame_images: [{ input_image: 'input_image', frame: 0 }],
27+
generate_audio: true,
2728
guidance_scale: 0,
2829
height: 0,
30+
media: {
31+
audio_inputs: [{ audio: 'audio' }],
32+
frame_images: [{ input_image: 'input_image', frame: 0 }],
33+
frame_videos: [{ video: 'video' }],
34+
reference_images: ['string'],
35+
reference_videos: [{ video: 'video' }],
36+
source_video: { video: 'video' },
37+
},
2938
negative_prompt: 'negative_prompt',
3039
output_format: 'MP4',
3140
output_quality: 0,
3241
prompt: 'x',
42+
ratio: 'ratio',
3343
reference_images: ['string'],
44+
resolution: 'resolution',
3445
seconds: 'seconds',
3546
seed: 0,
3647
steps: 10,

0 commit comments

Comments
 (0)