@runapi.ai/kling 0.2.13 → 0.3.1

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.
package/dist/index.mjs CHANGED
@@ -73,6 +73,370 @@ var contract = {
73
73
  }
74
74
  }
75
75
  },
76
+ "edit-video": {
77
+ "models": [
78
+ "kling-v3-omni-edit",
79
+ "kling-v3-omni-reference"
80
+ ],
81
+ "fields_by_model": {
82
+ "kling-v3-omni-edit": {
83
+ "aspect_ratio": {
84
+ "enum": [
85
+ "auto",
86
+ "16:9",
87
+ "9:16",
88
+ "1:1"
89
+ ]
90
+ },
91
+ "duration_seconds": {
92
+ "enum": [
93
+ 3,
94
+ 4,
95
+ 5,
96
+ 6,
97
+ 7,
98
+ 8,
99
+ 9,
100
+ 10,
101
+ 11,
102
+ 12,
103
+ 13,
104
+ 14,
105
+ 15
106
+ ],
107
+ "type": "integer"
108
+ },
109
+ "model": {
110
+ "required": true
111
+ },
112
+ "output_resolution": {
113
+ "enum": [
114
+ "720p",
115
+ "1080p",
116
+ "4k"
117
+ ]
118
+ },
119
+ "prompt": {
120
+ "required": true,
121
+ "min": 1,
122
+ "max": 2500,
123
+ "length": true
124
+ },
125
+ "reference_image_urls": {
126
+ "min_items": 1,
127
+ "max_items": 4
128
+ }
129
+ },
130
+ "kling-v3-omni-reference": {
131
+ "aspect_ratio": {
132
+ "enum": [
133
+ "auto",
134
+ "16:9",
135
+ "9:16",
136
+ "1:1"
137
+ ]
138
+ },
139
+ "duration_seconds": {
140
+ "enum": [
141
+ 3,
142
+ 4,
143
+ 5,
144
+ 6,
145
+ 7,
146
+ 8,
147
+ 9,
148
+ 10,
149
+ 11,
150
+ 12,
151
+ 13,
152
+ 14,
153
+ 15
154
+ ],
155
+ "type": "integer"
156
+ },
157
+ "model": {
158
+ "required": true
159
+ },
160
+ "output_resolution": {
161
+ "enum": [
162
+ "720p",
163
+ "1080p",
164
+ "4k"
165
+ ]
166
+ },
167
+ "prompt": {
168
+ "required": true,
169
+ "min": 1,
170
+ "max": 2500,
171
+ "length": true
172
+ },
173
+ "reference_image_urls": {
174
+ "min_items": 1,
175
+ "max_items": 4
176
+ }
177
+ }
178
+ },
179
+ "rules": [
180
+ {
181
+ "when": {
182
+ "model": "kling-v3-omni-edit",
183
+ "source_video_url": {
184
+ "present": true
185
+ }
186
+ },
187
+ "forbidden": [
188
+ "source_task_id"
189
+ ]
190
+ },
191
+ {
192
+ "when": {
193
+ "model": "kling-v3-omni-edit",
194
+ "source_task_id": {
195
+ "present": true
196
+ }
197
+ },
198
+ "forbidden": [
199
+ "source_video_url"
200
+ ]
201
+ },
202
+ {
203
+ "enum": {
204
+ "aspect_ratio": [
205
+ "auto"
206
+ ],
207
+ "duration_seconds": [
208
+ 5
209
+ ]
210
+ },
211
+ "when": {
212
+ "model": "kling-v3-omni-edit",
213
+ "source_video_url": {
214
+ "present": true
215
+ },
216
+ "reference_image_urls": {
217
+ "present": false
218
+ }
219
+ },
220
+ "required": [
221
+ "aspect_ratio"
222
+ ]
223
+ },
224
+ {
225
+ "enum": {
226
+ "aspect_ratio": [
227
+ "auto"
228
+ ],
229
+ "duration_seconds": [
230
+ 5
231
+ ]
232
+ },
233
+ "when": {
234
+ "model": "kling-v3-omni-edit",
235
+ "source_task_id": {
236
+ "present": true
237
+ },
238
+ "reference_image_urls": {
239
+ "present": false
240
+ }
241
+ },
242
+ "required": [
243
+ "aspect_ratio"
244
+ ]
245
+ },
246
+ {
247
+ "enum": {
248
+ "aspect_ratio": [
249
+ "16:9",
250
+ "9:16",
251
+ "1:1"
252
+ ]
253
+ },
254
+ "when": {
255
+ "model": "kling-v3-omni-edit",
256
+ "source_video_url": {
257
+ "present": true
258
+ },
259
+ "reference_image_urls": {
260
+ "present": true
261
+ }
262
+ },
263
+ "required": [
264
+ "aspect_ratio"
265
+ ]
266
+ },
267
+ {
268
+ "enum": {
269
+ "aspect_ratio": [
270
+ "16:9",
271
+ "9:16",
272
+ "1:1"
273
+ ]
274
+ },
275
+ "when": {
276
+ "model": "kling-v3-omni-edit",
277
+ "source_task_id": {
278
+ "present": true
279
+ },
280
+ "reference_image_urls": {
281
+ "present": true
282
+ }
283
+ },
284
+ "required": [
285
+ "aspect_ratio"
286
+ ]
287
+ },
288
+ {
289
+ "when": {
290
+ "model": "kling-v3-omni-edit",
291
+ "source_task_id": {
292
+ "present": false
293
+ },
294
+ "source_video_url": {
295
+ "present": false
296
+ }
297
+ },
298
+ "required_any": [
299
+ "source_video_url",
300
+ "source_task_id"
301
+ ]
302
+ },
303
+ {
304
+ "enum": {
305
+ "aspect_ratio": [
306
+ "16:9",
307
+ "9:16",
308
+ "1:1"
309
+ ],
310
+ "enable_sound": [
311
+ false
312
+ ]
313
+ },
314
+ "when": {
315
+ "model": "kling-v3-omni-reference",
316
+ "source_task_id": {
317
+ "present": true
318
+ },
319
+ "reference_image_urls": {
320
+ "present": true
321
+ }
322
+ },
323
+ "required": [
324
+ "aspect_ratio"
325
+ ]
326
+ },
327
+ {
328
+ "when": {
329
+ "model": "kling-v3-omni-reference",
330
+ "source_task_id": {
331
+ "present": false
332
+ },
333
+ "source_video_url": {
334
+ "present": false
335
+ }
336
+ },
337
+ "required_any": [
338
+ "source_video_url",
339
+ "source_task_id"
340
+ ]
341
+ },
342
+ {
343
+ "when": {
344
+ "model": "kling-v3-omni-reference",
345
+ "source_video_url": {
346
+ "present": true
347
+ }
348
+ },
349
+ "forbidden": [
350
+ "source_task_id"
351
+ ]
352
+ },
353
+ {
354
+ "when": {
355
+ "model": "kling-v3-omni-reference",
356
+ "source_task_id": {
357
+ "present": true
358
+ }
359
+ },
360
+ "forbidden": [
361
+ "source_video_url"
362
+ ]
363
+ },
364
+ {
365
+ "enum": {
366
+ "aspect_ratio": [
367
+ "auto"
368
+ ],
369
+ "enable_sound": [
370
+ false
371
+ ],
372
+ "duration_seconds": [
373
+ 5
374
+ ]
375
+ },
376
+ "when": {
377
+ "model": "kling-v3-omni-reference",
378
+ "source_video_url": {
379
+ "present": true
380
+ },
381
+ "reference_image_urls": {
382
+ "present": false
383
+ }
384
+ },
385
+ "required": [
386
+ "aspect_ratio"
387
+ ]
388
+ },
389
+ {
390
+ "enum": {
391
+ "aspect_ratio": [
392
+ "auto"
393
+ ],
394
+ "enable_sound": [
395
+ false
396
+ ],
397
+ "duration_seconds": [
398
+ 5
399
+ ]
400
+ },
401
+ "when": {
402
+ "model": "kling-v3-omni-reference",
403
+ "source_task_id": {
404
+ "present": true
405
+ },
406
+ "reference_image_urls": {
407
+ "present": false
408
+ }
409
+ },
410
+ "required": [
411
+ "aspect_ratio"
412
+ ]
413
+ },
414
+ {
415
+ "enum": {
416
+ "aspect_ratio": [
417
+ "16:9",
418
+ "9:16",
419
+ "1:1"
420
+ ],
421
+ "enable_sound": [
422
+ false
423
+ ]
424
+ },
425
+ "when": {
426
+ "model": "kling-v3-omni-reference",
427
+ "source_video_url": {
428
+ "present": true
429
+ },
430
+ "reference_image_urls": {
431
+ "present": true
432
+ }
433
+ },
434
+ "required": [
435
+ "aspect_ratio"
436
+ ]
437
+ }
438
+ ]
439
+ },
76
440
  "extend-video": {
77
441
  "models": [
78
442
  "kling-v2.5-turbo-image-to-video-pro",
@@ -541,6 +905,7 @@ var contract = {
541
905
  "kling-v2.5-turbo-text-to-video-pro",
542
906
  "kling-v2.6",
543
907
  "kling-v3-omni",
908
+ "kling-v3-omni-reference",
544
909
  "kling-v3-turbo-text-to-video"
545
910
  ],
546
911
  "fields_by_model": {
@@ -733,6 +1098,55 @@ var contract = {
733
1098
  "length": true
734
1099
  }
735
1100
  },
1101
+ "kling-v3-omni-reference": {
1102
+ "aspect_ratio": {
1103
+ "enum": [
1104
+ "16:9",
1105
+ "9:16",
1106
+ "1:1"
1107
+ ],
1108
+ "required": true
1109
+ },
1110
+ "duration_seconds": {
1111
+ "enum": [
1112
+ 3,
1113
+ 4,
1114
+ 5,
1115
+ 6,
1116
+ 7,
1117
+ 8,
1118
+ 9,
1119
+ 10,
1120
+ 11,
1121
+ 12,
1122
+ 13,
1123
+ 14,
1124
+ 15
1125
+ ],
1126
+ "type": "integer"
1127
+ },
1128
+ "model": {
1129
+ "required": true
1130
+ },
1131
+ "output_resolution": {
1132
+ "enum": [
1133
+ "720p",
1134
+ "1080p",
1135
+ "4k"
1136
+ ]
1137
+ },
1138
+ "prompt": {
1139
+ "required": true,
1140
+ "min": 1,
1141
+ "max": 2500,
1142
+ "length": true
1143
+ },
1144
+ "reference_image_urls": {
1145
+ "required": true,
1146
+ "min_items": 1,
1147
+ "max_items": 7
1148
+ }
1149
+ },
736
1150
  "kling-v3-turbo-text-to-video": {
737
1151
  "aspect_ratio": {
738
1152
  "enum": [
@@ -1418,6 +1832,32 @@ var ExtendVideo = class {
1418
1832
  }
1419
1833
  };
1420
1834
 
1835
+ // src/resources/edit-video.ts
1836
+ import { compactParams as compactParams6, validateParams as validateParams6 } from "@runapi.ai/core";
1837
+ import { pollUntilComplete as pollUntilComplete6 } from "@runapi.ai/core/internal";
1838
+ var ENDPOINT6 = "/api/v1/kling/edit_video";
1839
+ var EditVideo = class {
1840
+ constructor(http) {
1841
+ this.http = http;
1842
+ }
1843
+ http;
1844
+ async run(params, options) {
1845
+ const { id } = await this.create(params, options);
1846
+ return pollUntilComplete6(() => this.get(id, options), {
1847
+ maxWaitMs: options?.maxWaitMs,
1848
+ pollIntervalMs: options?.pollIntervalMs
1849
+ });
1850
+ }
1851
+ async create(params, options) {
1852
+ const body = compactParams6(params);
1853
+ validateParams6(contract["edit-video"], body);
1854
+ return this.http.request("POST", ENDPOINT6, { body, ...options });
1855
+ }
1856
+ async get(id, options) {
1857
+ return this.http.request("GET", `${ENDPOINT6}/${id}`, { ...options });
1858
+ }
1859
+ };
1860
+
1421
1861
  // src/client.ts
1422
1862
  var KlingClient = class extends BaseClient {
1423
1863
  /** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
@@ -1429,6 +1869,8 @@ var KlingClient = class extends BaseClient {
1429
1869
  /** Transfer motion from a reference video onto a subject image. */
1430
1870
  motionControl;
1431
1871
  extendVideo;
1872
+ /** Edit a source video with the selected Kling v3 Omni model. */
1873
+ editVideo;
1432
1874
  constructor(options = {}) {
1433
1875
  super(options);
1434
1876
  this.textToVideo = new TextToVideo(this.http);
@@ -1436,6 +1878,7 @@ var KlingClient = class extends BaseClient {
1436
1878
  this.aiAvatar = new AiAvatar(this.http);
1437
1879
  this.motionControl = new MotionControl(this.http);
1438
1880
  this.extendVideo = new ExtendVideo(this.http);
1881
+ this.editVideo = new EditVideo(this.http);
1439
1882
  }
1440
1883
  };
1441
1884