@runwayml/sdk 4.9.1 → 4.11.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 (95) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +8 -8
  3. package/client.d.mts +6 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +6 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +6 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/generate/generate.d.mts +10 -0
  13. package/resources/generate/generate.d.mts.map +1 -0
  14. package/resources/generate/generate.d.ts +10 -0
  15. package/resources/generate/generate.d.ts.map +1 -0
  16. package/resources/generate/generate.js +17 -0
  17. package/resources/generate/generate.js.map +1 -0
  18. package/resources/generate/generate.mjs +12 -0
  19. package/resources/generate/generate.mjs.map +1 -0
  20. package/resources/generate/index.d.mts +3 -0
  21. package/resources/generate/index.d.mts.map +1 -0
  22. package/resources/generate/index.d.ts +3 -0
  23. package/resources/generate/index.d.ts.map +1 -0
  24. package/resources/generate/index.js +9 -0
  25. package/resources/generate/index.js.map +1 -0
  26. package/resources/generate/index.mjs +4 -0
  27. package/resources/generate/index.mjs.map +1 -0
  28. package/resources/generate/video.d.mts +246 -0
  29. package/resources/generate/video.d.mts.map +1 -0
  30. package/resources/generate/video.d.ts +246 -0
  31. package/resources/generate/video.d.ts.map +1 -0
  32. package/resources/generate/video.js +17 -0
  33. package/resources/generate/video.js.map +1 -0
  34. package/resources/generate/video.mjs +13 -0
  35. package/resources/generate/video.mjs.map +1 -0
  36. package/resources/generate.d.mts +2 -0
  37. package/resources/generate.d.mts.map +1 -0
  38. package/resources/generate.d.ts +2 -0
  39. package/resources/generate.d.ts.map +1 -0
  40. package/resources/generate.js +6 -0
  41. package/resources/generate.js.map +1 -0
  42. package/resources/generate.mjs +3 -0
  43. package/resources/generate.mjs.map +1 -0
  44. package/resources/image-to-video.d.mts +12 -0
  45. package/resources/image-to-video.d.mts.map +1 -1
  46. package/resources/image-to-video.d.ts +12 -0
  47. package/resources/image-to-video.d.ts.map +1 -1
  48. package/resources/index.d.mts +2 -0
  49. package/resources/index.d.mts.map +1 -1
  50. package/resources/index.d.ts +2 -0
  51. package/resources/index.d.ts.map +1 -1
  52. package/resources/index.js +5 -1
  53. package/resources/index.js.map +1 -1
  54. package/resources/index.mjs +2 -0
  55. package/resources/index.mjs.map +1 -1
  56. package/resources/organization.d.mts +20 -2
  57. package/resources/organization.d.mts.map +1 -1
  58. package/resources/organization.d.ts +20 -2
  59. package/resources/organization.d.ts.map +1 -1
  60. package/resources/routers.d.mts +490 -0
  61. package/resources/routers.d.mts.map +1 -0
  62. package/resources/routers.d.ts +490 -0
  63. package/resources/routers.d.ts.map +1 -0
  64. package/resources/routers.js +49 -0
  65. package/resources/routers.js.map +1 -0
  66. package/resources/routers.mjs +45 -0
  67. package/resources/routers.mjs.map +1 -0
  68. package/resources/text-to-image.d.mts +74 -1
  69. package/resources/text-to-image.d.mts.map +1 -1
  70. package/resources/text-to-image.d.ts +74 -1
  71. package/resources/text-to-image.d.ts.map +1 -1
  72. package/resources/text-to-video.d.mts +12 -0
  73. package/resources/text-to-video.d.mts.map +1 -1
  74. package/resources/text-to-video.d.ts +12 -0
  75. package/resources/text-to-video.d.ts.map +1 -1
  76. package/src/client.ts +30 -0
  77. package/src/resources/generate/generate.ts +19 -0
  78. package/src/resources/generate/index.ts +4 -0
  79. package/src/resources/generate/video.ts +300 -0
  80. package/src/resources/generate.ts +3 -0
  81. package/src/resources/image-to-video.ts +15 -0
  82. package/src/resources/index.ts +12 -0
  83. package/src/resources/organization.ts +34 -0
  84. package/src/resources/routers.ts +622 -0
  85. package/src/resources/text-to-image.ts +122 -0
  86. package/src/resources/text-to-video.ts +15 -0
  87. package/src/version.ts +1 -1
  88. package/version.d.mts +1 -1
  89. package/version.d.mts.map +1 -1
  90. package/version.d.ts +1 -1
  91. package/version.d.ts.map +1 -1
  92. package/version.js +1 -1
  93. package/version.js.map +1 -1
  94. package/version.mjs +1 -1
  95. package/version.mjs.map +1 -1
@@ -0,0 +1,300 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { RequestOptions } from '../../internal/request-options';
5
+ import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../../lib/polling';
6
+
7
+ export class Video extends APIResource {
8
+ /**
9
+ * Start a video generation task using a saved Model Router config instead of
10
+ * naming a model.
11
+ */
12
+ create(
13
+ body: VideoCreateParams,
14
+ options?: RequestOptions,
15
+ ): APIPromiseWithAwaitableTask<VideoCreateResponse> {
16
+ return wrapAsWaitableResource<VideoCreateResponse>(this._client)(
17
+ this._client.post('/v1/generate/video', { body, ...options }),
18
+ );
19
+ }
20
+ }
21
+
22
+ export interface VideoCreateResponse {
23
+ /**
24
+ * The ID of the created task. Poll GET /v1/tasks/:id for the result.
25
+ */
26
+ id: string;
27
+
28
+ /**
29
+ * Metadata describing which model the router selected and why.
30
+ */
31
+ routing: VideoCreateResponse.Routing;
32
+ }
33
+
34
+ export namespace VideoCreateResponse {
35
+ /**
36
+ * Metadata describing which model the router selected and why.
37
+ */
38
+ export interface Routing {
39
+ /**
40
+ * The slug of the router config that was applied to this request.
41
+ */
42
+ configId: string;
43
+
44
+ /**
45
+ * Estimated cost, computed against current pricing.
46
+ */
47
+ estimatedCost: Routing.EstimatedCost;
48
+
49
+ /**
50
+ * The public name of the model the router selected.
51
+ */
52
+ model: string;
53
+
54
+ /**
55
+ * The provider of the selected model.
56
+ */
57
+ provider: string;
58
+
59
+ /**
60
+ * Request-side defaults resolved for the routing response. Not necessarily
61
+ * identical to prepared model options.
62
+ */
63
+ resolvedInput: Routing.ResolvedInput;
64
+
65
+ /**
66
+ * The resolved config settings the router used for this request.
67
+ */
68
+ resolvedSettings: Routing.ResolvedSettings;
69
+ }
70
+
71
+ export namespace Routing {
72
+ /**
73
+ * Estimated cost, computed against current pricing.
74
+ */
75
+ export interface EstimatedCost {
76
+ /**
77
+ * Estimated cost of the generation in credits.
78
+ */
79
+ credits: number;
80
+ }
81
+
82
+ /**
83
+ * Request-side defaults resolved for the routing response. Not necessarily
84
+ * identical to prepared model options.
85
+ */
86
+ export interface ResolvedInput {
87
+ /**
88
+ * Duration in seconds used for routing display (request value or router default).
89
+ */
90
+ duration: number;
91
+
92
+ /**
93
+ * Concrete output ratio derived from aspectRatio (e.g. "1280:720"), or the router
94
+ * default.
95
+ */
96
+ ratio: string;
97
+
98
+ /**
99
+ * Resolution tier from the request, or the router default when omitted.
100
+ */
101
+ resolution: string;
102
+ }
103
+
104
+ /**
105
+ * The resolved config settings the router used for this request.
106
+ */
107
+ export interface ResolvedSettings {
108
+ /**
109
+ * The single optimization preference the config selected, used as the soft
110
+ * weighting when scoring eligible models.
111
+ */
112
+ optimizeFor: 'cost' | 'latency' | 'quality';
113
+
114
+ /**
115
+ * The applied maximum credits per generation for this request’s modality, or null
116
+ * if the config sets no ceiling.
117
+ */
118
+ priceCeiling: number | null;
119
+ }
120
+ }
121
+ }
122
+
123
+ export interface VideoCreateParams {
124
+ /**
125
+ * The slug of a saved Model Router config to route this request with.
126
+ */
127
+ configId: string;
128
+
129
+ /**
130
+ * Model-agnostic video generation input. Fields are optional; the router selects a
131
+ * model and maps these options to it.
132
+ */
133
+ input: VideoCreateParams.Input;
134
+ }
135
+
136
+ export namespace VideoCreateParams {
137
+ /**
138
+ * Model-agnostic video generation input. Fields are optional; the router selects a
139
+ * model and maps these options to it.
140
+ */
141
+ export interface Input {
142
+ /**
143
+ * Desired aspect ratio. Models that do not support the requested aspect are
144
+ * excluded.
145
+ */
146
+ aspectRatio?: '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | '21:9';
147
+
148
+ /**
149
+ * Whether to generate native audio with the video. When true, only models that
150
+ * output audio remain eligible; when false, silent models and models with an audio
151
+ * toggle remain eligible (always-on native-audio models are excluded). When
152
+ * omitted, the selected model’s default applies.
153
+ */
154
+ audio?: boolean;
155
+
156
+ /**
157
+ * Settings that affect the behavior of the content moderation system.
158
+ */
159
+ contentModeration?: Input.ContentModeration;
160
+
161
+ /**
162
+ * Desired duration of the output video, in seconds. Unsupported values exclude
163
+ * models; with a source video, V2V duration support applies.
164
+ */
165
+ duration?: number;
166
+
167
+ /**
168
+ * Timed guidance images for video restyle. Requires a source video; unsupported
169
+ * models are excluded.
170
+ */
171
+ keyframes?: Array<Input.UnionMember0 | Input.UnionMember1>;
172
+
173
+ /**
174
+ * A text description of what to avoid in the output.
175
+ */
176
+ negativePrompt?: string;
177
+
178
+ /**
179
+ * A text prompt describing the desired video.
180
+ */
181
+ promptText?: string;
182
+
183
+ /**
184
+ * Optional audio inputs for the generation.
185
+ */
186
+ referenceAudio?: Array<Input.ReferenceAudio>;
187
+
188
+ /**
189
+ * Optional image inputs. Each entry requires a `role`. At most one `first` and one
190
+ * `last` are allowed; multiple `reference` images are allowed.
191
+ */
192
+ referenceImages?: Array<Input.ReferenceImage>;
193
+
194
+ /**
195
+ * Optional video inputs. Each entry requires a `role`. Use `source` for
196
+ * video-to-video; use `reference` for additional context videos (only models that
197
+ * support them remain eligible). At most one `source` is allowed.
198
+ */
199
+ referenceVideos?: Array<Input.ReferenceVideo>;
200
+
201
+ /**
202
+ * Desired output resolution tier. Models that do not support the requested tier
203
+ * are excluded.
204
+ */
205
+ resolution?: '480p' | '720p' | '1080p' | '4k';
206
+
207
+ /**
208
+ * A seed for reproducible generation. Random if omitted.
209
+ */
210
+ seed?: number;
211
+ }
212
+
213
+ export namespace Input {
214
+ /**
215
+ * Settings that affect the behavior of the content moderation system.
216
+ */
217
+ export interface ContentModeration {
218
+ /**
219
+ * When set to `low`, the content moderation system will be less strict about
220
+ * preventing generations that include recognizable public figures.
221
+ */
222
+ publicFigureThreshold?: 'auto' | 'low';
223
+ }
224
+
225
+ export interface UnionMember0 {
226
+ seconds: number;
227
+
228
+ /**
229
+ * A HTTPS URL.
230
+ */
231
+ uri: string;
232
+
233
+ range?: UnionMember0.Range;
234
+ }
235
+
236
+ export namespace UnionMember0 {
237
+ export interface Range {
238
+ end_seconds: number;
239
+
240
+ start_seconds: number;
241
+ }
242
+ }
243
+
244
+ export interface UnionMember1 {
245
+ at: number;
246
+
247
+ /**
248
+ * A HTTPS URL.
249
+ */
250
+ uri: string;
251
+
252
+ range?: UnionMember1.Range;
253
+ }
254
+
255
+ export namespace UnionMember1 {
256
+ export interface Range {
257
+ end_seconds: number;
258
+
259
+ start_seconds: number;
260
+ }
261
+ }
262
+
263
+ export interface ReferenceAudio {
264
+ /**
265
+ * A HTTPS URL.
266
+ */
267
+ uri: string;
268
+ }
269
+
270
+ export interface ReferenceImage {
271
+ /**
272
+ * How the image is used. `first` is the starting frame; `last` is an end frame;
273
+ * `reference` is additional image context.
274
+ */
275
+ role: 'first' | 'last' | 'reference';
276
+
277
+ /**
278
+ * A HTTPS URL.
279
+ */
280
+ uri: string;
281
+ }
282
+
283
+ export interface ReferenceVideo {
284
+ /**
285
+ * How the video is used. `source` is the primary video-to-video input; `reference`
286
+ * is additional video context.
287
+ */
288
+ role: 'source' | 'reference';
289
+
290
+ /**
291
+ * A HTTPS URL.
292
+ */
293
+ uri: string;
294
+ }
295
+ }
296
+ }
297
+
298
+ export declare namespace Video {
299
+ export { type VideoCreateResponse as VideoCreateResponse, type VideoCreateParams as VideoCreateParams };
300
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './generate/index';
@@ -193,6 +193,11 @@ export declare namespace ImageToVideoCreateParams {
193
193
  */
194
194
  duration?: 4 | 6 | 8;
195
195
 
196
+ /**
197
+ * Text describing what should not appear in the output video.
198
+ */
199
+ negativePrompt?: string;
200
+
196
201
  /**
197
202
  * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
198
203
  * should describe in detail what should appear in the output.
@@ -241,6 +246,11 @@ export declare namespace ImageToVideoCreateParams {
241
246
  */
242
247
  duration?: 4 | 6 | 8;
243
248
 
249
+ /**
250
+ * Text describing what should not appear in the output video.
251
+ */
252
+ negativePrompt?: string;
253
+
244
254
  /**
245
255
  * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
246
256
  * should describe in detail what should appear in the output.
@@ -609,6 +619,11 @@ export declare namespace ImageToVideoCreateParams {
609
619
  */
610
620
  ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
611
621
 
622
+ /**
623
+ * Text describing what should not appear in the output video.
624
+ */
625
+ negativePrompt?: string;
626
+
612
627
  /**
613
628
  * A non-empty string up to 1000 characters (measured in UTF-16 code units). This
614
629
  * should describe in detail what should appear in the output.
@@ -36,6 +36,7 @@ export {
36
36
  type DocumentListParams,
37
37
  type DocumentListResponsesCursorPage,
38
38
  } from './documents';
39
+ export { Generate } from './generate/generate';
39
40
  export {
40
41
  ImageToVideo,
41
42
  type ImageToVideoCreateResponse,
@@ -75,6 +76,17 @@ export {
75
76
  type RecipeProductSwapParams,
76
77
  type RecipeProductUgcParams,
77
78
  } from './recipes';
79
+ export {
80
+ Routers,
81
+ type RouterCreateResponse,
82
+ type RouterRetrieveResponse,
83
+ type RouterUpdateResponse,
84
+ type RouterListResponse,
85
+ type RouterCreateParams,
86
+ type RouterUpdateParams,
87
+ type RouterListParams,
88
+ type RouterListResponsesCursorPage,
89
+ } from './routers';
78
90
  export { SoundEffect, type SoundEffectCreateResponse, type SoundEffectCreateParams } from './sound-effect';
79
91
  export {
80
92
  SpeechToSpeech,
@@ -115,7 +115,11 @@ export interface OrganizationRetrieveUsageResponse {
115
115
  | 'gemini_2.5_flash'
116
116
  | 'gemini_image3_pro'
117
117
  | 'gemini_image3.1_flash'
118
+ | 'seedream5_pro'
119
+ | 'seedream5_lite'
120
+ | 'gemini_omni_flash'
118
121
  | 'eleven_multilingual_v2'
122
+ | 'seed_audio'
119
123
  | 'eleven_v3'
120
124
  | 'eleven_text_to_sound_v2'
121
125
  | 'eleven_voice_isolation'
@@ -128,6 +132,7 @@ export interface OrganizationRetrieveUsageResponse {
128
132
  | 'voice_processing'
129
133
  | 'seedance2'
130
134
  | 'seedance2_fast'
135
+ | 'seedance2_mini'
131
136
  | 'magnific_precision_upscaler_v2'
132
137
  | 'magnific_video_upscaler_creative'
133
138
  | 'kling2.5_turbo_pro'
@@ -149,6 +154,16 @@ export interface OrganizationRetrieveUsageResponse {
149
154
  >;
150
155
 
151
156
  results: Array<OrganizationRetrieveUsageResponse.Result>;
157
+
158
+ /**
159
+ * Reserved for future use.
160
+ */
161
+ apiKeys?: Array<string>;
162
+
163
+ /**
164
+ * Reserved for future use.
165
+ */
166
+ resultsByApiKey?: Array<OrganizationRetrieveUsageResponse.ResultsByAPIKey>;
152
167
  }
153
168
 
154
169
  export namespace OrganizationRetrieveUsageResponse {
@@ -191,7 +206,11 @@ export namespace OrganizationRetrieveUsageResponse {
191
206
  | 'gemini_2.5_flash'
192
207
  | 'gemini_image3_pro'
193
208
  | 'gemini_image3.1_flash'
209
+ | 'seedream5_pro'
210
+ | 'seedream5_lite'
211
+ | 'gemini_omni_flash'
194
212
  | 'eleven_multilingual_v2'
213
+ | 'seed_audio'
195
214
  | 'eleven_v3'
196
215
  | 'eleven_text_to_sound_v2'
197
216
  | 'eleven_voice_isolation'
@@ -204,6 +223,7 @@ export namespace OrganizationRetrieveUsageResponse {
204
223
  | 'voice_processing'
205
224
  | 'seedance2'
206
225
  | 'seedance2_fast'
226
+ | 'seedance2_mini'
207
227
  | 'magnific_precision_upscaler_v2'
208
228
  | 'magnific_video_upscaler_creative'
209
229
  | 'kling2.5_turbo_pro'
@@ -224,6 +244,20 @@ export namespace OrganizationRetrieveUsageResponse {
224
244
  | 'ad_localization';
225
245
  }
226
246
  }
247
+
248
+ export interface ResultsByAPIKey {
249
+ date: string;
250
+
251
+ usedCredits: Array<ResultsByAPIKey.UsedCredit>;
252
+ }
253
+
254
+ export namespace ResultsByAPIKey {
255
+ export interface UsedCredit {
256
+ amount: number;
257
+
258
+ apiKeyId: string;
259
+ }
260
+ }
227
261
  }
228
262
 
229
263
  export interface OrganizationRetrieveUsageParams {