@runapi.ai/kling 0.2.13 → 0.3.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.
package/dist/index.js CHANGED
@@ -20,23 +20,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- AuthenticationError: () => import_core8.AuthenticationError,
24
- InsufficientCreditsError: () => import_core8.InsufficientCreditsError,
23
+ AuthenticationError: () => import_core9.AuthenticationError,
24
+ InsufficientCreditsError: () => import_core9.InsufficientCreditsError,
25
25
  KlingClient: () => KlingClient,
26
- NetworkError: () => import_core8.NetworkError,
27
- NotFoundError: () => import_core8.NotFoundError,
28
- RateLimitError: () => import_core8.RateLimitError,
29
- RunApiError: () => import_core8.RunApiError,
30
- ServiceUnavailableError: () => import_core8.ServiceUnavailableError,
31
- TaskFailedError: () => import_core8.TaskFailedError,
32
- TaskTimeoutError: () => import_core8.TaskTimeoutError,
33
- TimeoutError: () => import_core8.TimeoutError,
34
- ValidationError: () => import_core8.ValidationError
26
+ NetworkError: () => import_core9.NetworkError,
27
+ NotFoundError: () => import_core9.NotFoundError,
28
+ RateLimitError: () => import_core9.RateLimitError,
29
+ RunApiError: () => import_core9.RunApiError,
30
+ ServiceUnavailableError: () => import_core9.ServiceUnavailableError,
31
+ TaskFailedError: () => import_core9.TaskFailedError,
32
+ TaskTimeoutError: () => import_core9.TaskTimeoutError,
33
+ TimeoutError: () => import_core9.TimeoutError,
34
+ ValidationError: () => import_core9.ValidationError
35
35
  });
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/client.ts
39
- var import_core7 = require("@runapi.ai/core");
39
+ var import_core8 = require("@runapi.ai/core");
40
40
 
41
41
  // src/resources/text-to-video.ts
42
42
  var import_core2 = require("@runapi.ai/core");
@@ -110,6 +110,370 @@ var contract = {
110
110
  }
111
111
  }
112
112
  },
113
+ "edit-video": {
114
+ "models": [
115
+ "kling-v3-omni-edit",
116
+ "kling-v3-omni-reference"
117
+ ],
118
+ "fields_by_model": {
119
+ "kling-v3-omni-edit": {
120
+ "aspect_ratio": {
121
+ "enum": [
122
+ "auto",
123
+ "16:9",
124
+ "9:16",
125
+ "1:1"
126
+ ]
127
+ },
128
+ "duration_seconds": {
129
+ "enum": [
130
+ 3,
131
+ 4,
132
+ 5,
133
+ 6,
134
+ 7,
135
+ 8,
136
+ 9,
137
+ 10,
138
+ 11,
139
+ 12,
140
+ 13,
141
+ 14,
142
+ 15
143
+ ],
144
+ "type": "integer"
145
+ },
146
+ "model": {
147
+ "required": true
148
+ },
149
+ "output_resolution": {
150
+ "enum": [
151
+ "720p",
152
+ "1080p",
153
+ "4k"
154
+ ]
155
+ },
156
+ "prompt": {
157
+ "required": true,
158
+ "min": 1,
159
+ "max": 2500,
160
+ "length": true
161
+ },
162
+ "reference_image_urls": {
163
+ "min_items": 1,
164
+ "max_items": 4
165
+ }
166
+ },
167
+ "kling-v3-omni-reference": {
168
+ "aspect_ratio": {
169
+ "enum": [
170
+ "auto",
171
+ "16:9",
172
+ "9:16",
173
+ "1:1"
174
+ ]
175
+ },
176
+ "duration_seconds": {
177
+ "enum": [
178
+ 3,
179
+ 4,
180
+ 5,
181
+ 6,
182
+ 7,
183
+ 8,
184
+ 9,
185
+ 10,
186
+ 11,
187
+ 12,
188
+ 13,
189
+ 14,
190
+ 15
191
+ ],
192
+ "type": "integer"
193
+ },
194
+ "model": {
195
+ "required": true
196
+ },
197
+ "output_resolution": {
198
+ "enum": [
199
+ "720p",
200
+ "1080p",
201
+ "4k"
202
+ ]
203
+ },
204
+ "prompt": {
205
+ "required": true,
206
+ "min": 1,
207
+ "max": 2500,
208
+ "length": true
209
+ },
210
+ "reference_image_urls": {
211
+ "min_items": 1,
212
+ "max_items": 4
213
+ }
214
+ }
215
+ },
216
+ "rules": [
217
+ {
218
+ "when": {
219
+ "model": "kling-v3-omni-edit",
220
+ "source_task_id": {
221
+ "present": false
222
+ },
223
+ "source_video_url": {
224
+ "present": false
225
+ }
226
+ },
227
+ "required_any": [
228
+ "source_video_url",
229
+ "source_task_id"
230
+ ]
231
+ },
232
+ {
233
+ "when": {
234
+ "model": "kling-v3-omni-edit",
235
+ "source_video_url": {
236
+ "present": true
237
+ }
238
+ },
239
+ "forbidden": [
240
+ "source_task_id"
241
+ ]
242
+ },
243
+ {
244
+ "when": {
245
+ "model": "kling-v3-omni-edit",
246
+ "source_task_id": {
247
+ "present": true
248
+ }
249
+ },
250
+ "forbidden": [
251
+ "source_video_url"
252
+ ]
253
+ },
254
+ {
255
+ "enum": {
256
+ "aspect_ratio": [
257
+ "auto"
258
+ ],
259
+ "duration_seconds": [
260
+ 5
261
+ ]
262
+ },
263
+ "when": {
264
+ "model": "kling-v3-omni-edit",
265
+ "source_video_url": {
266
+ "present": true
267
+ },
268
+ "reference_image_urls": {
269
+ "present": false
270
+ }
271
+ },
272
+ "required": [
273
+ "aspect_ratio"
274
+ ]
275
+ },
276
+ {
277
+ "enum": {
278
+ "aspect_ratio": [
279
+ "auto"
280
+ ],
281
+ "duration_seconds": [
282
+ 5
283
+ ]
284
+ },
285
+ "when": {
286
+ "model": "kling-v3-omni-edit",
287
+ "source_task_id": {
288
+ "present": true
289
+ },
290
+ "reference_image_urls": {
291
+ "present": false
292
+ }
293
+ },
294
+ "required": [
295
+ "aspect_ratio"
296
+ ]
297
+ },
298
+ {
299
+ "enum": {
300
+ "aspect_ratio": [
301
+ "16:9",
302
+ "9:16",
303
+ "1:1"
304
+ ]
305
+ },
306
+ "when": {
307
+ "model": "kling-v3-omni-edit",
308
+ "source_video_url": {
309
+ "present": true
310
+ },
311
+ "reference_image_urls": {
312
+ "present": true
313
+ }
314
+ },
315
+ "required": [
316
+ "aspect_ratio"
317
+ ]
318
+ },
319
+ {
320
+ "enum": {
321
+ "aspect_ratio": [
322
+ "16:9",
323
+ "9:16",
324
+ "1:1"
325
+ ]
326
+ },
327
+ "when": {
328
+ "model": "kling-v3-omni-edit",
329
+ "source_task_id": {
330
+ "present": true
331
+ },
332
+ "reference_image_urls": {
333
+ "present": true
334
+ }
335
+ },
336
+ "required": [
337
+ "aspect_ratio"
338
+ ]
339
+ },
340
+ {
341
+ "when": {
342
+ "model": "kling-v3-omni-reference",
343
+ "source_task_id": {
344
+ "present": false
345
+ },
346
+ "source_video_url": {
347
+ "present": false
348
+ }
349
+ },
350
+ "required_any": [
351
+ "source_video_url",
352
+ "source_task_id"
353
+ ]
354
+ },
355
+ {
356
+ "when": {
357
+ "model": "kling-v3-omni-reference",
358
+ "source_video_url": {
359
+ "present": true
360
+ }
361
+ },
362
+ "forbidden": [
363
+ "source_task_id"
364
+ ]
365
+ },
366
+ {
367
+ "when": {
368
+ "model": "kling-v3-omni-reference",
369
+ "source_task_id": {
370
+ "present": true
371
+ }
372
+ },
373
+ "forbidden": [
374
+ "source_video_url"
375
+ ]
376
+ },
377
+ {
378
+ "enum": {
379
+ "aspect_ratio": [
380
+ "auto"
381
+ ],
382
+ "enable_sound": [
383
+ false
384
+ ],
385
+ "duration_seconds": [
386
+ 5
387
+ ]
388
+ },
389
+ "when": {
390
+ "model": "kling-v3-omni-reference",
391
+ "source_video_url": {
392
+ "present": true
393
+ },
394
+ "reference_image_urls": {
395
+ "present": false
396
+ }
397
+ },
398
+ "required": [
399
+ "aspect_ratio"
400
+ ]
401
+ },
402
+ {
403
+ "enum": {
404
+ "aspect_ratio": [
405
+ "auto"
406
+ ],
407
+ "enable_sound": [
408
+ false
409
+ ],
410
+ "duration_seconds": [
411
+ 5
412
+ ]
413
+ },
414
+ "when": {
415
+ "model": "kling-v3-omni-reference",
416
+ "source_task_id": {
417
+ "present": true
418
+ },
419
+ "reference_image_urls": {
420
+ "present": false
421
+ }
422
+ },
423
+ "required": [
424
+ "aspect_ratio"
425
+ ]
426
+ },
427
+ {
428
+ "enum": {
429
+ "aspect_ratio": [
430
+ "16:9",
431
+ "9:16",
432
+ "1:1"
433
+ ],
434
+ "enable_sound": [
435
+ false
436
+ ]
437
+ },
438
+ "when": {
439
+ "model": "kling-v3-omni-reference",
440
+ "source_video_url": {
441
+ "present": true
442
+ },
443
+ "reference_image_urls": {
444
+ "present": true
445
+ }
446
+ },
447
+ "required": [
448
+ "aspect_ratio"
449
+ ]
450
+ },
451
+ {
452
+ "enum": {
453
+ "aspect_ratio": [
454
+ "16:9",
455
+ "9:16",
456
+ "1:1"
457
+ ],
458
+ "enable_sound": [
459
+ false
460
+ ]
461
+ },
462
+ "when": {
463
+ "model": "kling-v3-omni-reference",
464
+ "source_task_id": {
465
+ "present": true
466
+ },
467
+ "reference_image_urls": {
468
+ "present": true
469
+ }
470
+ },
471
+ "required": [
472
+ "aspect_ratio"
473
+ ]
474
+ }
475
+ ]
476
+ },
113
477
  "extend-video": {
114
478
  "models": [
115
479
  "kling-v2.5-turbo-image-to-video-pro",
@@ -578,6 +942,7 @@ var contract = {
578
942
  "kling-v2.5-turbo-text-to-video-pro",
579
943
  "kling-v2.6",
580
944
  "kling-v3-omni",
945
+ "kling-v3-omni-reference",
581
946
  "kling-v3-turbo-text-to-video"
582
947
  ],
583
948
  "fields_by_model": {
@@ -770,6 +1135,55 @@ var contract = {
770
1135
  "length": true
771
1136
  }
772
1137
  },
1138
+ "kling-v3-omni-reference": {
1139
+ "aspect_ratio": {
1140
+ "enum": [
1141
+ "16:9",
1142
+ "9:16",
1143
+ "1:1"
1144
+ ],
1145
+ "required": true
1146
+ },
1147
+ "duration_seconds": {
1148
+ "enum": [
1149
+ 3,
1150
+ 4,
1151
+ 5,
1152
+ 6,
1153
+ 7,
1154
+ 8,
1155
+ 9,
1156
+ 10,
1157
+ 11,
1158
+ 12,
1159
+ 13,
1160
+ 14,
1161
+ 15
1162
+ ],
1163
+ "type": "integer"
1164
+ },
1165
+ "model": {
1166
+ "required": true
1167
+ },
1168
+ "output_resolution": {
1169
+ "enum": [
1170
+ "720p",
1171
+ "1080p",
1172
+ "4k"
1173
+ ]
1174
+ },
1175
+ "prompt": {
1176
+ "required": true,
1177
+ "min": 1,
1178
+ "max": 2500,
1179
+ "length": true
1180
+ },
1181
+ "reference_image_urls": {
1182
+ "required": true,
1183
+ "min_items": 1,
1184
+ "max_items": 7
1185
+ }
1186
+ },
773
1187
  "kling-v3-turbo-text-to-video": {
774
1188
  "aspect_ratio": {
775
1189
  "enum": [
@@ -1455,8 +1869,34 @@ var ExtendVideo = class {
1455
1869
  }
1456
1870
  };
1457
1871
 
1872
+ // src/resources/edit-video.ts
1873
+ var import_core7 = require("@runapi.ai/core");
1874
+ var import_internal6 = require("@runapi.ai/core/internal");
1875
+ var ENDPOINT6 = "/api/v1/kling/edit_video";
1876
+ var EditVideo = class {
1877
+ constructor(http) {
1878
+ this.http = http;
1879
+ }
1880
+ http;
1881
+ async run(params, options) {
1882
+ const { id } = await this.create(params, options);
1883
+ return (0, import_internal6.pollUntilComplete)(() => this.get(id, options), {
1884
+ maxWaitMs: options?.maxWaitMs,
1885
+ pollIntervalMs: options?.pollIntervalMs
1886
+ });
1887
+ }
1888
+ async create(params, options) {
1889
+ const body = (0, import_core7.compactParams)(params);
1890
+ (0, import_core7.validateParams)(contract["edit-video"], body);
1891
+ return this.http.request("POST", ENDPOINT6, { body, ...options });
1892
+ }
1893
+ async get(id, options) {
1894
+ return this.http.request("GET", `${ENDPOINT6}/${id}`, { ...options });
1895
+ }
1896
+ };
1897
+
1458
1898
  // src/client.ts
1459
- var KlingClient = class extends import_core7.BaseClient {
1899
+ var KlingClient = class extends import_core8.BaseClient {
1460
1900
  /** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
1461
1901
  textToVideo;
1462
1902
  /** Image-to-video animation from a first-frame image guided by a text prompt. */
@@ -1466,6 +1906,8 @@ var KlingClient = class extends import_core7.BaseClient {
1466
1906
  /** Transfer motion from a reference video onto a subject image. */
1467
1907
  motionControl;
1468
1908
  extendVideo;
1909
+ /** Edit a source video with the selected Kling v3 Omni model. */
1910
+ editVideo;
1469
1911
  constructor(options = {}) {
1470
1912
  super(options);
1471
1913
  this.textToVideo = new TextToVideo(this.http);
@@ -1473,11 +1915,12 @@ var KlingClient = class extends import_core7.BaseClient {
1473
1915
  this.aiAvatar = new AiAvatar(this.http);
1474
1916
  this.motionControl = new MotionControl(this.http);
1475
1917
  this.extendVideo = new ExtendVideo(this.http);
1918
+ this.editVideo = new EditVideo(this.http);
1476
1919
  }
1477
1920
  };
1478
1921
 
1479
1922
  // src/index.ts
1480
- var import_core8 = require("@runapi.ai/core");
1923
+ var import_core9 = require("@runapi.ai/core");
1481
1924
  // Annotate the CommonJS export names for ESM import in node:
1482
1925
  0 && (module.exports = {
1483
1926
  AuthenticationError,