@runwayml/sdk 3.23.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/avatar-conversations.d.mts +648 -0
  12. package/resources/avatar-conversations.d.mts.map +1 -0
  13. package/resources/avatar-conversations.d.ts +648 -0
  14. package/resources/avatar-conversations.d.ts.map +1 -0
  15. package/resources/avatar-conversations.js +41 -0
  16. package/resources/avatar-conversations.js.map +1 -0
  17. package/resources/avatar-conversations.mjs +37 -0
  18. package/resources/avatar-conversations.mjs.map +1 -0
  19. package/resources/avatars.d.mts +63 -1
  20. package/resources/avatars.d.mts.map +1 -1
  21. package/resources/avatars.d.ts +63 -1
  22. package/resources/avatars.d.ts.map +1 -1
  23. package/resources/avatars.js +16 -0
  24. package/resources/avatars.js.map +1 -1
  25. package/resources/avatars.mjs +16 -0
  26. package/resources/avatars.mjs.map +1 -1
  27. package/resources/image-to-video.d.mts +58 -66
  28. package/resources/image-to-video.d.mts.map +1 -1
  29. package/resources/image-to-video.d.ts +58 -66
  30. package/resources/image-to-video.d.ts.map +1 -1
  31. package/resources/image-to-video.js +0 -9
  32. package/resources/image-to-video.js.map +1 -1
  33. package/resources/image-to-video.mjs +0 -9
  34. package/resources/image-to-video.mjs.map +1 -1
  35. package/resources/index.d.mts +3 -2
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +3 -2
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +3 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +1 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/organization.d.mts +2 -2
  44. package/resources/organization.d.mts.map +1 -1
  45. package/resources/organization.d.ts +2 -2
  46. package/resources/organization.d.ts.map +1 -1
  47. package/resources/text-to-video.d.mts +75 -3
  48. package/resources/text-to-video.d.mts.map +1 -1
  49. package/resources/text-to-video.d.ts +75 -3
  50. package/resources/text-to-video.d.ts.map +1 -1
  51. package/resources/video-to-video.d.mts +81 -93
  52. package/resources/video-to-video.d.mts.map +1 -1
  53. package/resources/video-to-video.d.ts +81 -93
  54. package/resources/video-to-video.d.ts.map +1 -1
  55. package/resources/video-to-video.js +1 -1
  56. package/resources/video-to-video.mjs +1 -1
  57. package/resources/voices.d.mts +97 -1
  58. package/resources/voices.d.mts.map +1 -1
  59. package/resources/voices.d.ts +97 -1
  60. package/resources/voices.d.ts.map +1 -1
  61. package/resources/voices.js +6 -0
  62. package/resources/voices.js.map +1 -1
  63. package/resources/voices.mjs +6 -0
  64. package/resources/voices.mjs.map +1 -1
  65. package/src/client.ts +25 -0
  66. package/src/resources/avatar-conversations.ts +787 -0
  67. package/src/resources/avatars.ts +76 -0
  68. package/src/resources/image-to-video.ts +81 -76
  69. package/src/resources/index.ts +11 -0
  70. package/src/resources/organization.ts +5 -1
  71. package/src/resources/text-to-video.ts +101 -2
  72. package/src/resources/video-to-video.ts +106 -116
  73. package/src/resources/voices.ts +128 -0
  74. package/src/version.ts +1 -1
  75. package/version.d.mts +1 -1
  76. package/version.d.mts.map +1 -1
  77. package/version.d.ts +1 -1
  78. package/version.d.ts.map +1 -1
  79. package/version.js +1 -1
  80. package/version.js.map +1 -1
  81. package/version.mjs +1 -1
  82. package/version.mjs.map +1 -1
@@ -94,6 +94,23 @@ export class Avatars extends APIResource {
94
94
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
95
95
  });
96
96
  }
97
+
98
+ /**
99
+ * Get aggregate usage statistics for avatar conversations, including total
100
+ * duration, session counts, average duration, and a per-day breakdown. Per-day
101
+ * buckets are keyed by UTC calendar date. The date range must not exceed 90 days.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const response = await client.avatars.getUsage({
106
+ * endDate: '2019-12-27T18:11:19.117Z',
107
+ * startDate: '2019-12-27T18:11:19.117Z',
108
+ * });
109
+ * ```
110
+ */
111
+ getUsage(query: AvatarGetUsageParams, options?: RequestOptions): APIPromise<AvatarGetUsageResponse> {
112
+ return this._client.get('/v1/avatar_usage', { query, ...options });
113
+ }
97
114
  }
98
115
 
99
116
  export type AvatarListResponsesCursorPage = CursorPage<AvatarListResponse>;
@@ -1830,6 +1847,51 @@ export namespace AvatarListResponse {
1830
1847
  }
1831
1848
  }
1832
1849
 
1850
+ export interface AvatarGetUsageResponse {
1851
+ /**
1852
+ * Average duration in seconds across conversations with a measured duration, or 0
1853
+ * if none completed. May not equal `totalSeconds / totalSessions` because
1854
+ * unfinished conversations contribute to the session count but not the duration.
1855
+ */
1856
+ avgDurationSeconds: number;
1857
+
1858
+ /**
1859
+ * Per-day usage across the date range. Days with no sessions are included with
1860
+ * zeroes.
1861
+ */
1862
+ byDay: Array<AvatarGetUsageResponse.ByDay>;
1863
+
1864
+ /**
1865
+ * Total seconds across conversations with a measured duration in the date range.
1866
+ */
1867
+ totalSeconds: number;
1868
+
1869
+ /**
1870
+ * Number of conversations started in the date range. Includes unfinished and
1871
+ * failed conversations.
1872
+ */
1873
+ totalSessions: number;
1874
+ }
1875
+
1876
+ export namespace AvatarGetUsageResponse {
1877
+ export interface ByDay {
1878
+ /**
1879
+ * The UTC calendar date (YYYY-MM-DD).
1880
+ */
1881
+ date: string;
1882
+
1883
+ /**
1884
+ * Total seconds of measured conversation duration on this date.
1885
+ */
1886
+ seconds: number;
1887
+
1888
+ /**
1889
+ * Number of conversations started on this date.
1890
+ */
1891
+ sessions: number;
1892
+ }
1893
+ }
1894
+
1833
1895
  export interface AvatarCreateParams {
1834
1896
  /**
1835
1897
  * The character name for the avatar.
@@ -2035,15 +2097,29 @@ export namespace AvatarUpdateParams {
2035
2097
 
2036
2098
  export interface AvatarListParams extends CursorPageParams {}
2037
2099
 
2100
+ export interface AvatarGetUsageParams {
2101
+ /**
2102
+ * End of the date range in UTC (exclusive). Required.
2103
+ */
2104
+ endDate: string;
2105
+
2106
+ /**
2107
+ * Start of the date range in UTC (inclusive). Required.
2108
+ */
2109
+ startDate: string;
2110
+ }
2111
+
2038
2112
  export declare namespace Avatars {
2039
2113
  export {
2040
2114
  type AvatarCreateResponse as AvatarCreateResponse,
2041
2115
  type AvatarRetrieveResponse as AvatarRetrieveResponse,
2042
2116
  type AvatarUpdateResponse as AvatarUpdateResponse,
2043
2117
  type AvatarListResponse as AvatarListResponse,
2118
+ type AvatarGetUsageResponse as AvatarGetUsageResponse,
2044
2119
  type AvatarListResponsesCursorPage as AvatarListResponsesCursorPage,
2045
2120
  type AvatarCreateParams as AvatarCreateParams,
2046
2121
  type AvatarUpdateParams as AvatarUpdateParams,
2047
2122
  type AvatarListParams as AvatarListParams,
2123
+ type AvatarGetUsageParams as AvatarGetUsageParams,
2048
2124
  };
2049
2125
  }
@@ -10,15 +10,6 @@ import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../lib/poll
10
10
  export class ImageToVideo extends APIResource {
11
11
  /**
12
12
  * This endpoint will start a new task to generate a video from an image.
13
- *
14
- * @example
15
- * ```ts
16
- * const imageToVideo = await client.imageToVideo.create({
17
- * model: 'gen3a_turbo',
18
- * promptImage: 'https://example.com/file',
19
- * promptText: 'A beautiful sunset over a calm ocean.',
20
- * });
21
- * ```
22
13
  */
23
14
  create(
24
15
  body: ImageToVideoCreateParams,
@@ -41,10 +32,10 @@ export type ImageToVideoCreateParams =
41
32
  | ImageToVideoCreateParams.Gen4_5
42
33
  | ImageToVideoCreateParams.Gen4Turbo
43
34
  | ImageToVideoCreateParams.Veo3_1
44
- | ImageToVideoCreateParams.Gen3aTurbo
45
35
  | ImageToVideoCreateParams.Veo3_1Fast
46
36
  | ImageToVideoCreateParams.Happyhorse1_0
47
37
  | ImageToVideoCreateParams.Seedance2
38
+ | ImageToVideoCreateParams.Seedance2Fast
48
39
  | ImageToVideoCreateParams.Veo3;
49
40
 
50
41
  export declare namespace ImageToVideoCreateParams {
@@ -223,70 +214,6 @@ export declare namespace ImageToVideoCreateParams {
223
214
  }
224
215
  }
225
216
 
226
- export interface Gen3aTurbo {
227
- model: 'gen3a_turbo';
228
-
229
- /**
230
- * A HTTPS URL.
231
- */
232
- promptImage: string | Array<Gen3aTurbo.PromptImage>;
233
-
234
- /**
235
- * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
236
- * should describe in detail what should appear in the output.
237
- */
238
- promptText: string;
239
-
240
- /**
241
- * Settings that affect the behavior of the content moderation system.
242
- */
243
- contentModeration?: Gen3aTurbo.ContentModeration;
244
-
245
- /**
246
- * The duration of the output video in seconds.
247
- */
248
- duration?: 5 | 10;
249
-
250
- /**
251
- * The resolution of the output video.
252
- */
253
- ratio?: '768:1280' | '1280:768';
254
-
255
- /**
256
- * If unspecified, a random number is chosen. Varying the seed integer is a way to
257
- * get different results for the same other request parameters. Using the same seed
258
- * integer for an identical request will produce similar results.
259
- */
260
- seed?: number;
261
- }
262
-
263
- export namespace Gen3aTurbo {
264
- export interface PromptImage {
265
- /**
266
- * The position of the image in the output video. "first" will use the image as the
267
- * first frame of the video, "last" will use the image as the last frame of the
268
- * video.
269
- */
270
- position: 'first' | 'last';
271
-
272
- /**
273
- * A HTTPS URL.
274
- */
275
- uri: string;
276
- }
277
-
278
- /**
279
- * Settings that affect the behavior of the content moderation system.
280
- */
281
- export interface ContentModeration {
282
- /**
283
- * When set to `low`, the content moderation system will be less strict about
284
- * preventing generations that include recognizable public figures.
285
- */
286
- publicFigureThreshold?: 'auto' | 'low';
287
- }
288
- }
289
-
290
217
  export interface Veo3_1Fast {
291
218
  model: 'veo3.1_fast';
292
219
 
@@ -395,8 +322,8 @@ export declare namespace ImageToVideoCreateParams {
395
322
  duration?: number;
396
323
 
397
324
  /**
398
- * An optional text prompt up to 3500 characters (measured in UTF-16 code units).
399
- * This should describe in detail what should appear in the output.
325
+ * An optional text prompt up to 3500 characters describing what should appear in
326
+ * the output.
400
327
  */
401
328
  promptText?: string;
402
329
 
@@ -458,6 +385,84 @@ export declare namespace ImageToVideoCreateParams {
458
385
  }
459
386
  }
460
387
 
388
+ export interface Seedance2Fast {
389
+ model: 'seedance2_fast';
390
+
391
+ /**
392
+ * An image or array of images. Use position `first`/`last` for keyframe mode, or
393
+ * omit position for reference images. The two modes cannot be mixed.
394
+ */
395
+ promptImage: string | Array<Seedance2Fast.PromptImage>;
396
+
397
+ /**
398
+ * Whether to generate audio for the video. Audio inclusion affects pricing.
399
+ */
400
+ audio?: boolean;
401
+
402
+ /**
403
+ * The number of seconds of duration for the output video.
404
+ */
405
+ duration?: number;
406
+
407
+ /**
408
+ * An optional text prompt up to 3500 characters describing what should appear in
409
+ * the output.
410
+ */
411
+ promptText?: string;
412
+
413
+ /**
414
+ * The resolution of the output video. Seedance 2.0 Fast supports 480p and 720p
415
+ * only.
416
+ */
417
+ ratio?:
418
+ | '992:432'
419
+ | '864:496'
420
+ | '752:560'
421
+ | '640:640'
422
+ | '560:752'
423
+ | '496:864'
424
+ | '1470:630'
425
+ | '1280:720'
426
+ | '1112:834'
427
+ | '960:960'
428
+ | '834:1112'
429
+ | '720:1280';
430
+
431
+ /**
432
+ * An optional array of audio references. Audio references require a text prompt,
433
+ * and the total combined duration must not exceed 15 seconds.
434
+ */
435
+ referenceAudio?: Array<Seedance2Fast.ReferenceAudio>;
436
+ }
437
+
438
+ export namespace Seedance2Fast {
439
+ export interface PromptImage {
440
+ /**
441
+ * A HTTPS URL.
442
+ */
443
+ uri: string;
444
+
445
+ /**
446
+ * The position of the image in the output video. "first" will use the image as the
447
+ * first frame, "last" as the last frame. Omit for a reference image.
448
+ */
449
+ position?: 'first' | 'last';
450
+ }
451
+
452
+ /**
453
+ * An audio reference allows the model to use the audio as additional context for
454
+ * the output.
455
+ */
456
+ export interface ReferenceAudio {
457
+ type: 'audio';
458
+
459
+ /**
460
+ * A HTTPS URL.
461
+ */
462
+ uri: string;
463
+ }
464
+ }
465
+
461
466
  export interface Veo3 {
462
467
  /**
463
468
  * The number of seconds of duration for the output video.
@@ -1,5 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ AvatarConversations,
5
+ type AvatarConversationRetrieveResponse,
6
+ type AvatarConversationListResponse,
7
+ type AvatarConversationListParams,
8
+ type AvatarConversationListResponsesCursorPage,
9
+ } from './avatar-conversations';
3
10
  export { AvatarVideos, type AvatarVideoCreateResponse, type AvatarVideoCreateParams } from './avatar-videos';
4
11
  export {
5
12
  Avatars,
@@ -7,9 +14,11 @@ export {
7
14
  type AvatarRetrieveResponse,
8
15
  type AvatarUpdateResponse,
9
16
  type AvatarListResponse,
17
+ type AvatarGetUsageResponse,
10
18
  type AvatarCreateParams,
11
19
  type AvatarUpdateParams,
12
20
  type AvatarListParams,
21
+ type AvatarGetUsageParams,
13
22
  type AvatarListResponsesCursorPage,
14
23
  } from './avatars';
15
24
  export {
@@ -82,9 +91,11 @@ export {
82
91
  Voices,
83
92
  type VoiceCreateResponse,
84
93
  type VoiceRetrieveResponse,
94
+ type VoiceUpdateResponse,
85
95
  type VoiceListResponse,
86
96
  type VoicePreviewResponse,
87
97
  type VoiceCreateParams,
98
+ type VoiceUpdateParams,
88
99
  type VoiceListParams,
89
100
  type VoicePreviewParams,
90
101
  type VoiceListResponsesCursorPage,
@@ -127,6 +127,7 @@ export interface OrganizationRetrieveUsageResponse {
127
127
  | 'gwm1_avatar_async_text_to_video'
128
128
  | 'voice_processing'
129
129
  | 'seedance2'
130
+ | 'seedance2_fast'
130
131
  | 'magnific_precision_upscaler_v2'
131
132
  | 'kling2.5_turbo_pro'
132
133
  | 'kling3.0_pro'
@@ -137,6 +138,7 @@ export interface OrganizationRetrieveUsageResponse {
137
138
  | 'klingO3_4k'
138
139
  | 'happyhorse_1_0'
139
140
  | 'aleph2'
141
+ | 'product_swap'
140
142
  >;
141
143
 
142
144
  results: Array<OrganizationRetrieveUsageResponse.Result>;
@@ -194,6 +196,7 @@ export namespace OrganizationRetrieveUsageResponse {
194
196
  | 'gwm1_avatar_async_text_to_video'
195
197
  | 'voice_processing'
196
198
  | 'seedance2'
199
+ | 'seedance2_fast'
197
200
  | 'magnific_precision_upscaler_v2'
198
201
  | 'kling2.5_turbo_pro'
199
202
  | 'kling3.0_pro'
@@ -203,7 +206,8 @@ export namespace OrganizationRetrieveUsageResponse {
203
206
  | 'klingO3_standard'
204
207
  | 'klingO3_4k'
205
208
  | 'happyhorse_1_0'
206
- | 'aleph2';
209
+ | 'aleph2'
210
+ | 'product_swap';
207
211
  }
208
212
  }
209
213
  }
@@ -34,6 +34,7 @@ export type TextToVideoCreateParams =
34
34
  | TextToVideoCreateParams.Veo3_1Fast
35
35
  | TextToVideoCreateParams.Happyhorse1_0
36
36
  | TextToVideoCreateParams.Seedance2
37
+ | TextToVideoCreateParams.Seedance2Fast
37
38
  | TextToVideoCreateParams.Veo3;
38
39
 
39
40
  export declare namespace TextToVideoCreateParams {
@@ -167,8 +168,8 @@ export declare namespace TextToVideoCreateParams {
167
168
  model: 'seedance2';
168
169
 
169
170
  /**
170
- * A non-empty string up to 3500 characters (measured in UTF-16 code units). This
171
- * should describe in detail what should appear in the output.
171
+ * A non-empty text prompt up to 3500 characters describing what should appear in
172
+ * the output.
172
173
  */
173
174
  promptText: string;
174
175
 
@@ -266,6 +267,104 @@ export declare namespace TextToVideoCreateParams {
266
267
  }
267
268
  }
268
269
 
270
+ export interface Seedance2Fast {
271
+ model: 'seedance2_fast';
272
+
273
+ /**
274
+ * A non-empty text prompt up to 3500 characters describing what should appear in
275
+ * the output.
276
+ */
277
+ promptText: string;
278
+
279
+ /**
280
+ * Whether to generate audio for the video. Audio inclusion affects pricing.
281
+ */
282
+ audio?: boolean;
283
+
284
+ /**
285
+ * The number of seconds of duration for the output video.
286
+ */
287
+ duration?: number;
288
+
289
+ /**
290
+ * The resolution of the output video. Seedance 2.0 Fast supports 480p and 720p
291
+ * only.
292
+ */
293
+ ratio?:
294
+ | '992:432'
295
+ | '864:496'
296
+ | '752:560'
297
+ | '640:640'
298
+ | '560:752'
299
+ | '496:864'
300
+ | '1470:630'
301
+ | '1280:720'
302
+ | '1112:834'
303
+ | '960:960'
304
+ | '834:1112'
305
+ | '720:1280';
306
+
307
+ /**
308
+ * An optional array of audio references. Audio references require a text prompt,
309
+ * and the total combined duration must not exceed 15 seconds.
310
+ */
311
+ referenceAudio?: Array<Seedance2Fast.ReferenceAudio>;
312
+
313
+ /**
314
+ * An optional array of image references (up to 9). See
315
+ * [our docs](/assets/inputs#images) on image inputs for more information.
316
+ */
317
+ references?: Array<Seedance2Fast.Reference>;
318
+
319
+ /**
320
+ * An optional array of video references. The combined duration across all video
321
+ * references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on
322
+ * video inputs for more information.
323
+ */
324
+ referenceVideos?: Array<Seedance2Fast.ReferenceVideo>;
325
+ }
326
+
327
+ export namespace Seedance2Fast {
328
+ /**
329
+ * An audio reference allows the model to use the audio as additional context for
330
+ * the output.
331
+ */
332
+ export interface ReferenceAudio {
333
+ type: 'audio';
334
+
335
+ /**
336
+ * A HTTPS URL.
337
+ */
338
+ uri: string;
339
+ }
340
+
341
+ export interface Reference {
342
+ /**
343
+ * A HTTPS URL.
344
+ */
345
+ uri: string;
346
+
347
+ /**
348
+ * The position of the image in the output video. "first" will use the image as the
349
+ * first frame, "last" as the last frame. Omit for a reference image.
350
+ */
351
+ position?: 'first' | 'last';
352
+ }
353
+
354
+ /**
355
+ * A video reference allows the model to use the video as additional context for
356
+ * the output.
357
+ */
358
+ export interface ReferenceVideo {
359
+ type: 'video';
360
+
361
+ /**
362
+ * A HTTPS URL.
363
+ */
364
+ uri: string;
365
+ }
366
+ }
367
+
269
368
  export interface Veo3 {
270
369
  /**
271
370
  * The number of seconds of duration for the output video.