@runapi.ai/kling 0.2.12 → 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/README.md +26 -5
- package/dist/index.d.mts +92 -6
- package/dist/index.d.ts +92 -6
- package/dist/index.js +879 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +854 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/skills/kling/README.md +5 -2
- package/skills/kling/SKILL.md +78 -47
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { BaseClient } from "@runapi.ai/core";
|
|
3
3
|
|
|
4
4
|
// src/resources/text-to-video.ts
|
|
5
|
-
import { ValidationError, compactParams, validateParams } from "@runapi.ai/core";
|
|
5
|
+
import { ValidationError as ValidationError2, compactParams, validateParams } from "@runapi.ai/core";
|
|
6
6
|
import { pollUntilComplete } from "@runapi.ai/core/internal";
|
|
7
7
|
|
|
8
8
|
// src/contract_gen.ts
|
|
@@ -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_task_id": {
|
|
184
|
+
"present": false
|
|
185
|
+
},
|
|
186
|
+
"source_video_url": {
|
|
187
|
+
"present": false
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"required_any": [
|
|
191
|
+
"source_video_url",
|
|
192
|
+
"source_task_id"
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"when": {
|
|
197
|
+
"model": "kling-v3-omni-edit",
|
|
198
|
+
"source_video_url": {
|
|
199
|
+
"present": true
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"forbidden": [
|
|
203
|
+
"source_task_id"
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"when": {
|
|
208
|
+
"model": "kling-v3-omni-edit",
|
|
209
|
+
"source_task_id": {
|
|
210
|
+
"present": true
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"forbidden": [
|
|
214
|
+
"source_video_url"
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"enum": {
|
|
219
|
+
"aspect_ratio": [
|
|
220
|
+
"auto"
|
|
221
|
+
],
|
|
222
|
+
"duration_seconds": [
|
|
223
|
+
5
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
"when": {
|
|
227
|
+
"model": "kling-v3-omni-edit",
|
|
228
|
+
"source_video_url": {
|
|
229
|
+
"present": true
|
|
230
|
+
},
|
|
231
|
+
"reference_image_urls": {
|
|
232
|
+
"present": false
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"required": [
|
|
236
|
+
"aspect_ratio"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"enum": {
|
|
241
|
+
"aspect_ratio": [
|
|
242
|
+
"auto"
|
|
243
|
+
],
|
|
244
|
+
"duration_seconds": [
|
|
245
|
+
5
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
"when": {
|
|
249
|
+
"model": "kling-v3-omni-edit",
|
|
250
|
+
"source_task_id": {
|
|
251
|
+
"present": true
|
|
252
|
+
},
|
|
253
|
+
"reference_image_urls": {
|
|
254
|
+
"present": false
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"required": [
|
|
258
|
+
"aspect_ratio"
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"enum": {
|
|
263
|
+
"aspect_ratio": [
|
|
264
|
+
"16:9",
|
|
265
|
+
"9:16",
|
|
266
|
+
"1:1"
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
"when": {
|
|
270
|
+
"model": "kling-v3-omni-edit",
|
|
271
|
+
"source_video_url": {
|
|
272
|
+
"present": true
|
|
273
|
+
},
|
|
274
|
+
"reference_image_urls": {
|
|
275
|
+
"present": true
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"required": [
|
|
279
|
+
"aspect_ratio"
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"enum": {
|
|
284
|
+
"aspect_ratio": [
|
|
285
|
+
"16:9",
|
|
286
|
+
"9:16",
|
|
287
|
+
"1:1"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
"when": {
|
|
291
|
+
"model": "kling-v3-omni-edit",
|
|
292
|
+
"source_task_id": {
|
|
293
|
+
"present": true
|
|
294
|
+
},
|
|
295
|
+
"reference_image_urls": {
|
|
296
|
+
"present": true
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"required": [
|
|
300
|
+
"aspect_ratio"
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"when": {
|
|
305
|
+
"model": "kling-v3-omni-reference",
|
|
306
|
+
"source_task_id": {
|
|
307
|
+
"present": false
|
|
308
|
+
},
|
|
309
|
+
"source_video_url": {
|
|
310
|
+
"present": false
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"required_any": [
|
|
314
|
+
"source_video_url",
|
|
315
|
+
"source_task_id"
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"when": {
|
|
320
|
+
"model": "kling-v3-omni-reference",
|
|
321
|
+
"source_video_url": {
|
|
322
|
+
"present": true
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"forbidden": [
|
|
326
|
+
"source_task_id"
|
|
327
|
+
]
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"when": {
|
|
331
|
+
"model": "kling-v3-omni-reference",
|
|
332
|
+
"source_task_id": {
|
|
333
|
+
"present": true
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"forbidden": [
|
|
337
|
+
"source_video_url"
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"enum": {
|
|
342
|
+
"aspect_ratio": [
|
|
343
|
+
"auto"
|
|
344
|
+
],
|
|
345
|
+
"enable_sound": [
|
|
346
|
+
false
|
|
347
|
+
],
|
|
348
|
+
"duration_seconds": [
|
|
349
|
+
5
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
"when": {
|
|
353
|
+
"model": "kling-v3-omni-reference",
|
|
354
|
+
"source_video_url": {
|
|
355
|
+
"present": true
|
|
356
|
+
},
|
|
357
|
+
"reference_image_urls": {
|
|
358
|
+
"present": false
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"required": [
|
|
362
|
+
"aspect_ratio"
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"enum": {
|
|
367
|
+
"aspect_ratio": [
|
|
368
|
+
"auto"
|
|
369
|
+
],
|
|
370
|
+
"enable_sound": [
|
|
371
|
+
false
|
|
372
|
+
],
|
|
373
|
+
"duration_seconds": [
|
|
374
|
+
5
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
"when": {
|
|
378
|
+
"model": "kling-v3-omni-reference",
|
|
379
|
+
"source_task_id": {
|
|
380
|
+
"present": true
|
|
381
|
+
},
|
|
382
|
+
"reference_image_urls": {
|
|
383
|
+
"present": false
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"required": [
|
|
387
|
+
"aspect_ratio"
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"enum": {
|
|
392
|
+
"aspect_ratio": [
|
|
393
|
+
"16:9",
|
|
394
|
+
"9:16",
|
|
395
|
+
"1:1"
|
|
396
|
+
],
|
|
397
|
+
"enable_sound": [
|
|
398
|
+
false
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
"when": {
|
|
402
|
+
"model": "kling-v3-omni-reference",
|
|
403
|
+
"source_video_url": {
|
|
404
|
+
"present": true
|
|
405
|
+
},
|
|
406
|
+
"reference_image_urls": {
|
|
407
|
+
"present": true
|
|
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_task_id": {
|
|
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",
|
|
@@ -105,6 +469,7 @@ var contract = {
|
|
|
105
469
|
},
|
|
106
470
|
"image-to-video": {
|
|
107
471
|
"models": [
|
|
472
|
+
"kling-o1",
|
|
108
473
|
"kling-v2.1-master-image-to-video",
|
|
109
474
|
"kling-v2.1-pro",
|
|
110
475
|
"kling-v2.1-standard",
|
|
@@ -114,6 +479,49 @@ var contract = {
|
|
|
114
479
|
"kling-v3-turbo-image-to-video"
|
|
115
480
|
],
|
|
116
481
|
"fields_by_model": {
|
|
482
|
+
"kling-o1": {
|
|
483
|
+
"aspect_ratio": {
|
|
484
|
+
"enum": [
|
|
485
|
+
"16:9",
|
|
486
|
+
"9:16",
|
|
487
|
+
"1:1"
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
"duration_seconds": {
|
|
491
|
+
"enum": [
|
|
492
|
+
5
|
|
493
|
+
],
|
|
494
|
+
"type": "integer"
|
|
495
|
+
},
|
|
496
|
+
"first_frame_image_url": {
|
|
497
|
+
"required": true
|
|
498
|
+
},
|
|
499
|
+
"mode": {
|
|
500
|
+
"enum": [
|
|
501
|
+
"std",
|
|
502
|
+
"pro"
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
"model": {
|
|
506
|
+
"required": true
|
|
507
|
+
},
|
|
508
|
+
"prompt": {
|
|
509
|
+
"required": true,
|
|
510
|
+
"min": 1,
|
|
511
|
+
"max": 2500,
|
|
512
|
+
"length": true
|
|
513
|
+
},
|
|
514
|
+
"reference_image_urls": {
|
|
515
|
+
"min_items": 1,
|
|
516
|
+
"max_items": 7
|
|
517
|
+
},
|
|
518
|
+
"reference_video_type": {
|
|
519
|
+
"enum": [
|
|
520
|
+
"base",
|
|
521
|
+
"feature"
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
},
|
|
117
525
|
"kling-v2.1-master-image-to-video": {
|
|
118
526
|
"duration_seconds": {
|
|
119
527
|
"enum": [
|
|
@@ -306,13 +714,27 @@ var contract = {
|
|
|
306
714
|
}
|
|
307
715
|
},
|
|
308
716
|
"rules": [
|
|
717
|
+
{
|
|
718
|
+
"when": {
|
|
719
|
+
"model": "kling-o1"
|
|
720
|
+
},
|
|
721
|
+
"forbidden": [
|
|
722
|
+
"output_resolution",
|
|
723
|
+
"negative_prompt",
|
|
724
|
+
"cfg_scale"
|
|
725
|
+
]
|
|
726
|
+
},
|
|
309
727
|
{
|
|
310
728
|
"when": {
|
|
311
729
|
"model": "kling-v2.1-master-image-to-video"
|
|
312
730
|
},
|
|
313
731
|
"forbidden": [
|
|
314
732
|
"output_resolution",
|
|
315
|
-
"enable_sound"
|
|
733
|
+
"enable_sound",
|
|
734
|
+
"reference_image_urls",
|
|
735
|
+
"reference_video_url",
|
|
736
|
+
"reference_video_type",
|
|
737
|
+
"preserve_reference_video_audio"
|
|
316
738
|
]
|
|
317
739
|
},
|
|
318
740
|
{
|
|
@@ -321,7 +743,11 @@ var contract = {
|
|
|
321
743
|
},
|
|
322
744
|
"forbidden": [
|
|
323
745
|
"output_resolution",
|
|
324
|
-
"enable_sound"
|
|
746
|
+
"enable_sound",
|
|
747
|
+
"reference_image_urls",
|
|
748
|
+
"reference_video_url",
|
|
749
|
+
"reference_video_type",
|
|
750
|
+
"preserve_reference_video_audio"
|
|
325
751
|
]
|
|
326
752
|
},
|
|
327
753
|
{
|
|
@@ -330,7 +756,11 @@ var contract = {
|
|
|
330
756
|
},
|
|
331
757
|
"forbidden": [
|
|
332
758
|
"output_resolution",
|
|
333
|
-
"enable_sound"
|
|
759
|
+
"enable_sound",
|
|
760
|
+
"reference_image_urls",
|
|
761
|
+
"reference_video_url",
|
|
762
|
+
"reference_video_type",
|
|
763
|
+
"preserve_reference_video_audio"
|
|
334
764
|
]
|
|
335
765
|
},
|
|
336
766
|
{
|
|
@@ -339,7 +769,11 @@ var contract = {
|
|
|
339
769
|
},
|
|
340
770
|
"forbidden": [
|
|
341
771
|
"output_resolution",
|
|
342
|
-
"enable_sound"
|
|
772
|
+
"enable_sound",
|
|
773
|
+
"reference_image_urls",
|
|
774
|
+
"reference_video_url",
|
|
775
|
+
"reference_video_type",
|
|
776
|
+
"preserve_reference_video_audio"
|
|
343
777
|
]
|
|
344
778
|
},
|
|
345
779
|
{
|
|
@@ -349,7 +783,11 @@ var contract = {
|
|
|
349
783
|
"forbidden": [
|
|
350
784
|
"output_resolution",
|
|
351
785
|
"negative_prompt",
|
|
352
|
-
"cfg_scale"
|
|
786
|
+
"cfg_scale",
|
|
787
|
+
"reference_image_urls",
|
|
788
|
+
"reference_video_url",
|
|
789
|
+
"reference_video_type",
|
|
790
|
+
"preserve_reference_video_audio"
|
|
353
791
|
]
|
|
354
792
|
},
|
|
355
793
|
{
|
|
@@ -358,7 +796,11 @@ var contract = {
|
|
|
358
796
|
},
|
|
359
797
|
"forbidden": [
|
|
360
798
|
"negative_prompt",
|
|
361
|
-
"cfg_scale"
|
|
799
|
+
"cfg_scale",
|
|
800
|
+
"reference_image_urls",
|
|
801
|
+
"reference_video_url",
|
|
802
|
+
"reference_video_type",
|
|
803
|
+
"preserve_reference_video_audio"
|
|
362
804
|
]
|
|
363
805
|
},
|
|
364
806
|
{
|
|
@@ -370,7 +812,11 @@ var contract = {
|
|
|
370
812
|
"aspect_ratio",
|
|
371
813
|
"negative_prompt",
|
|
372
814
|
"cfg_scale",
|
|
373
|
-
"last_frame_image_url"
|
|
815
|
+
"last_frame_image_url",
|
|
816
|
+
"reference_image_urls",
|
|
817
|
+
"reference_video_url",
|
|
818
|
+
"reference_video_type",
|
|
819
|
+
"preserve_reference_video_audio"
|
|
374
820
|
]
|
|
375
821
|
}
|
|
376
822
|
]
|
|
@@ -454,10 +900,12 @@ var contract = {
|
|
|
454
900
|
"text-to-video": {
|
|
455
901
|
"models": [
|
|
456
902
|
"kling-3.0",
|
|
903
|
+
"kling-o1",
|
|
457
904
|
"kling-v2.1-master-text-to-video",
|
|
458
905
|
"kling-v2.5-turbo-text-to-video-pro",
|
|
459
906
|
"kling-v2.6",
|
|
460
907
|
"kling-v3-omni",
|
|
908
|
+
"kling-v3-omni-reference",
|
|
461
909
|
"kling-v3-turbo-text-to-video"
|
|
462
910
|
],
|
|
463
911
|
"fields_by_model": {
|
|
@@ -498,6 +946,46 @@ var contract = {
|
|
|
498
946
|
]
|
|
499
947
|
}
|
|
500
948
|
},
|
|
949
|
+
"kling-o1": {
|
|
950
|
+
"aspect_ratio": {
|
|
951
|
+
"enum": [
|
|
952
|
+
"16:9",
|
|
953
|
+
"9:16",
|
|
954
|
+
"1:1"
|
|
955
|
+
]
|
|
956
|
+
},
|
|
957
|
+
"duration_seconds": {
|
|
958
|
+
"enum": [
|
|
959
|
+
5
|
|
960
|
+
],
|
|
961
|
+
"type": "integer"
|
|
962
|
+
},
|
|
963
|
+
"mode": {
|
|
964
|
+
"enum": [
|
|
965
|
+
"std",
|
|
966
|
+
"pro"
|
|
967
|
+
]
|
|
968
|
+
},
|
|
969
|
+
"model": {
|
|
970
|
+
"required": true
|
|
971
|
+
},
|
|
972
|
+
"prompt": {
|
|
973
|
+
"required": true,
|
|
974
|
+
"min": 1,
|
|
975
|
+
"max": 2500,
|
|
976
|
+
"length": true
|
|
977
|
+
},
|
|
978
|
+
"reference_image_urls": {
|
|
979
|
+
"min_items": 1,
|
|
980
|
+
"max_items": 7
|
|
981
|
+
},
|
|
982
|
+
"reference_video_type": {
|
|
983
|
+
"enum": [
|
|
984
|
+
"base",
|
|
985
|
+
"feature"
|
|
986
|
+
]
|
|
987
|
+
}
|
|
988
|
+
},
|
|
501
989
|
"kling-v2.1-master-text-to-video": {
|
|
502
990
|
"aspect_ratio": {
|
|
503
991
|
"enum": [
|
|
@@ -610,6 +1098,55 @@ var contract = {
|
|
|
610
1098
|
"length": true
|
|
611
1099
|
}
|
|
612
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
|
+
},
|
|
613
1150
|
"kling-v3-turbo-text-to-video": {
|
|
614
1151
|
"aspect_ratio": {
|
|
615
1152
|
"enum": [
|
|
@@ -654,12 +1191,54 @@ var contract = {
|
|
|
654
1191
|
}
|
|
655
1192
|
},
|
|
656
1193
|
"rules": [
|
|
1194
|
+
{
|
|
1195
|
+
"when": {
|
|
1196
|
+
"model": "kling-3.0"
|
|
1197
|
+
},
|
|
1198
|
+
"forbidden": [
|
|
1199
|
+
"reference_image_urls",
|
|
1200
|
+
"reference_video_url",
|
|
1201
|
+
"reference_video_type",
|
|
1202
|
+
"preserve_reference_video_audio"
|
|
1203
|
+
]
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
"when": {
|
|
1207
|
+
"model": "kling-o1"
|
|
1208
|
+
},
|
|
1209
|
+
"forbidden": [
|
|
1210
|
+
"output_resolution",
|
|
1211
|
+
"negative_prompt",
|
|
1212
|
+
"cfg_scale",
|
|
1213
|
+
"multi_shots",
|
|
1214
|
+
"multi_prompt",
|
|
1215
|
+
"first_frame_image_url",
|
|
1216
|
+
"last_frame_image_url",
|
|
1217
|
+
"kling_elements"
|
|
1218
|
+
]
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
"when": {
|
|
1222
|
+
"model": "kling-v2.1-master-text-to-video"
|
|
1223
|
+
},
|
|
1224
|
+
"forbidden": [
|
|
1225
|
+
"mode",
|
|
1226
|
+
"reference_image_urls",
|
|
1227
|
+
"reference_video_url",
|
|
1228
|
+
"reference_video_type",
|
|
1229
|
+
"preserve_reference_video_audio"
|
|
1230
|
+
]
|
|
1231
|
+
},
|
|
657
1232
|
{
|
|
658
1233
|
"when": {
|
|
659
1234
|
"model": "kling-v2.5-turbo-text-to-video-pro"
|
|
660
1235
|
},
|
|
661
1236
|
"forbidden": [
|
|
662
|
-
"mode"
|
|
1237
|
+
"mode",
|
|
1238
|
+
"reference_image_urls",
|
|
1239
|
+
"reference_video_url",
|
|
1240
|
+
"reference_video_type",
|
|
1241
|
+
"preserve_reference_video_audio"
|
|
663
1242
|
]
|
|
664
1243
|
},
|
|
665
1244
|
{
|
|
@@ -674,7 +1253,11 @@ var contract = {
|
|
|
674
1253
|
"multi_prompt",
|
|
675
1254
|
"first_frame_image_url",
|
|
676
1255
|
"last_frame_image_url",
|
|
677
|
-
"kling_elements"
|
|
1256
|
+
"kling_elements",
|
|
1257
|
+
"reference_image_urls",
|
|
1258
|
+
"reference_video_url",
|
|
1259
|
+
"reference_video_type",
|
|
1260
|
+
"preserve_reference_video_audio"
|
|
678
1261
|
]
|
|
679
1262
|
},
|
|
680
1263
|
{
|
|
@@ -688,7 +1271,11 @@ var contract = {
|
|
|
688
1271
|
"multi_prompt",
|
|
689
1272
|
"first_frame_image_url",
|
|
690
1273
|
"last_frame_image_url",
|
|
691
|
-
"kling_elements"
|
|
1274
|
+
"kling_elements",
|
|
1275
|
+
"reference_image_urls",
|
|
1276
|
+
"reference_video_url",
|
|
1277
|
+
"reference_video_type",
|
|
1278
|
+
"preserve_reference_video_audio"
|
|
692
1279
|
]
|
|
693
1280
|
},
|
|
694
1281
|
{
|
|
@@ -703,13 +1290,227 @@ var contract = {
|
|
|
703
1290
|
"multi_prompt",
|
|
704
1291
|
"first_frame_image_url",
|
|
705
1292
|
"last_frame_image_url",
|
|
706
|
-
"kling_elements"
|
|
1293
|
+
"kling_elements",
|
|
1294
|
+
"reference_image_urls",
|
|
1295
|
+
"reference_video_url",
|
|
1296
|
+
"reference_video_type",
|
|
1297
|
+
"preserve_reference_video_audio"
|
|
707
1298
|
]
|
|
708
1299
|
}
|
|
709
1300
|
]
|
|
710
1301
|
}
|
|
711
1302
|
};
|
|
712
1303
|
|
|
1304
|
+
// src/resources/o1-reference-validation.ts
|
|
1305
|
+
import { ValidationError } from "@runapi.ai/core";
|
|
1306
|
+
var O1_MODEL = "kling-o1";
|
|
1307
|
+
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png"]);
|
|
1308
|
+
var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov"]);
|
|
1309
|
+
var BLOCKED_IP_CIDRS = [
|
|
1310
|
+
"0.0.0.0/8",
|
|
1311
|
+
"10.0.0.0/8",
|
|
1312
|
+
"100.64.0.0/10",
|
|
1313
|
+
"127.0.0.0/8",
|
|
1314
|
+
"169.254.0.0/16",
|
|
1315
|
+
"172.16.0.0/12",
|
|
1316
|
+
"192.0.0.0/24",
|
|
1317
|
+
"192.0.2.0/24",
|
|
1318
|
+
"192.88.99.0/24",
|
|
1319
|
+
"192.168.0.0/16",
|
|
1320
|
+
"198.18.0.0/15",
|
|
1321
|
+
"198.51.100.0/24",
|
|
1322
|
+
"203.0.113.0/24",
|
|
1323
|
+
"224.0.0.0/4",
|
|
1324
|
+
"240.0.0.0/4",
|
|
1325
|
+
"255.255.255.255/32",
|
|
1326
|
+
"::/128",
|
|
1327
|
+
"::1/128",
|
|
1328
|
+
"64:ff9b::/96",
|
|
1329
|
+
"64:ff9b:1::/48",
|
|
1330
|
+
"100::/64",
|
|
1331
|
+
"2001::/32",
|
|
1332
|
+
"2001:2::/48",
|
|
1333
|
+
"2001:db8::/32",
|
|
1334
|
+
"2002::/16",
|
|
1335
|
+
"3fff::/20",
|
|
1336
|
+
"fc00::/7",
|
|
1337
|
+
"fe80::/10",
|
|
1338
|
+
"ff00::/8"
|
|
1339
|
+
];
|
|
1340
|
+
var BLOCKED_IP_NETWORKS = BLOCKED_IP_CIDRS.map((cidr) => {
|
|
1341
|
+
const [address, prefixText] = cidr.split("/");
|
|
1342
|
+
const parsed = parseIpLiteral(address);
|
|
1343
|
+
if (!parsed) throw new Error("Invalid blocked IP range: " + cidr);
|
|
1344
|
+
return { ...parsed, prefix: Number(prefixText) };
|
|
1345
|
+
});
|
|
1346
|
+
function validateKlingO1References(body) {
|
|
1347
|
+
if (body.model !== O1_MODEL) return;
|
|
1348
|
+
if (body.enable_sound === true) {
|
|
1349
|
+
throw new ValidationError(`enable_sound is not supported by ${O1_MODEL}`);
|
|
1350
|
+
}
|
|
1351
|
+
validateFrameUrls(body);
|
|
1352
|
+
if (typeof body.prompt !== "string") {
|
|
1353
|
+
throw new ValidationError("prompt must be a string");
|
|
1354
|
+
}
|
|
1355
|
+
const prompt = body.prompt;
|
|
1356
|
+
const referenceImages = Array.isArray(body.reference_image_urls) ? body.reference_image_urls : [];
|
|
1357
|
+
if ("reference_video_url" in body && typeof body.reference_video_url !== "string") {
|
|
1358
|
+
throw new ValidationError("reference_video_url must be a string");
|
|
1359
|
+
}
|
|
1360
|
+
const referenceVideoUrl = body.reference_video_url;
|
|
1361
|
+
if (present(body.last_frame_image_url) && (referenceImages.length > 0 || present(referenceVideoUrl))) {
|
|
1362
|
+
throw new ValidationError(
|
|
1363
|
+
"last_frame_image_url cannot be combined with reference_image_urls or reference_video_url"
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1366
|
+
if (referenceVideoUrl && referenceImages.length > 4) {
|
|
1367
|
+
throw new ValidationError(
|
|
1368
|
+
"reference_image_urls must contain at most 4 items when reference_video_url is present"
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
validateReferenceImages(prompt, referenceImages);
|
|
1372
|
+
validateReferenceVideo(body, prompt, referenceVideoUrl);
|
|
1373
|
+
}
|
|
1374
|
+
function validateFrameUrls(body) {
|
|
1375
|
+
for (const field of ["first_frame_image_url", "last_frame_image_url"]) {
|
|
1376
|
+
const value = body[field];
|
|
1377
|
+
if (typeof value !== "string" || value.length === 0) continue;
|
|
1378
|
+
if (!isPublicHttpUrl(value)) {
|
|
1379
|
+
throw new ValidationError(`${field} must be a public HTTP or HTTPS URL`);
|
|
1380
|
+
}
|
|
1381
|
+
if (!IMAGE_EXTENSIONS.has(urlExtension(value))) {
|
|
1382
|
+
throw new ValidationError(`${field} must use a JPG, JPEG, or PNG URL`);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
function validateReferenceImages(prompt, urls) {
|
|
1387
|
+
urls.forEach((url, index) => {
|
|
1388
|
+
if (typeof url !== "string") {
|
|
1389
|
+
throw new ValidationError(`reference_image_urls[${index}] must be a string`);
|
|
1390
|
+
}
|
|
1391
|
+
if (!isPublicHttpUrl(url)) {
|
|
1392
|
+
throw new ValidationError(
|
|
1393
|
+
`reference_image_urls[${index}] must be a public HTTP or HTTPS URL`
|
|
1394
|
+
);
|
|
1395
|
+
}
|
|
1396
|
+
if (!IMAGE_EXTENSIONS.has(urlExtension(url))) {
|
|
1397
|
+
throw new ValidationError(
|
|
1398
|
+
`reference_image_urls[${index}] must use a JPG, JPEG, or PNG URL`
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
const marker = `<<<image_${index + 1}>>>`;
|
|
1402
|
+
if (!prompt.includes(marker)) {
|
|
1403
|
+
throw new ValidationError(
|
|
1404
|
+
`prompt must reference reference_image_urls[${index}] as ${marker}`
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
for (const match of prompt.matchAll(/<<<image_(\d+)>>>/g)) {
|
|
1409
|
+
const index = Number(match[1]);
|
|
1410
|
+
if (index < 1 || index > urls.length) {
|
|
1411
|
+
throw new ValidationError(`prompt references missing image_${index}`);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
function validateReferenceVideo(body, prompt, referenceVideoUrl) {
|
|
1416
|
+
if (!referenceVideoUrl) {
|
|
1417
|
+
if ("reference_video_type" in body) {
|
|
1418
|
+
throw new ValidationError("reference_video_type requires reference_video_url");
|
|
1419
|
+
}
|
|
1420
|
+
if ("preserve_reference_video_audio" in body) {
|
|
1421
|
+
throw new ValidationError("preserve_reference_video_audio requires reference_video_url");
|
|
1422
|
+
}
|
|
1423
|
+
const missingMarker = prompt.match(/<<<video_([^>]+)>>>/);
|
|
1424
|
+
if (missingMarker) {
|
|
1425
|
+
throw new ValidationError(`prompt references missing video_${missingMarker[1]}`);
|
|
1426
|
+
}
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
if (!isPublicHttpUrl(referenceVideoUrl)) {
|
|
1430
|
+
throw new ValidationError("reference_video_url must be a public HTTP or HTTPS URL");
|
|
1431
|
+
}
|
|
1432
|
+
if (!VIDEO_EXTENSIONS.has(urlExtension(referenceVideoUrl))) {
|
|
1433
|
+
throw new ValidationError("reference_video_url must use an MP4 or MOV URL");
|
|
1434
|
+
}
|
|
1435
|
+
if (!prompt.includes("<<<video_1>>>")) {
|
|
1436
|
+
throw new ValidationError("prompt must reference reference_video_url as <<<video_1>>>");
|
|
1437
|
+
}
|
|
1438
|
+
for (const match of prompt.matchAll(/<<<video_([^>]+)>>>/g)) {
|
|
1439
|
+
if (match[1] !== "1") {
|
|
1440
|
+
throw new ValidationError("prompt may only reference video_1");
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
const referenceVideoType = body.reference_video_type ?? "base";
|
|
1444
|
+
if (referenceVideoType === "base" && (present(body.first_frame_image_url) || present(body.last_frame_image_url))) {
|
|
1445
|
+
throw new ValidationError(
|
|
1446
|
+
"reference_video_type base cannot be combined with first_frame_image_url or last_frame_image_url"
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
function present(value) {
|
|
1451
|
+
return typeof value === "string" ? value.trim().length > 0 : value !== void 0 && value !== null;
|
|
1452
|
+
}
|
|
1453
|
+
function urlExtension(value) {
|
|
1454
|
+
try {
|
|
1455
|
+
const path = new URL(value).pathname;
|
|
1456
|
+
const dot = path.lastIndexOf(".");
|
|
1457
|
+
return dot >= 0 ? path.slice(dot).toLowerCase() : "";
|
|
1458
|
+
} catch {
|
|
1459
|
+
return "";
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
function isPublicHttpUrl(value) {
|
|
1463
|
+
try {
|
|
1464
|
+
const url = new URL(value);
|
|
1465
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.hostname.length > 0 && url.username.length === 0 && url.password.length === 0 && !isBlockedHost(url.hostname);
|
|
1466
|
+
} catch {
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function isBlockedHost(hostname) {
|
|
1471
|
+
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
1472
|
+
if (host === "localhost" || host.endsWith(".localhost")) return true;
|
|
1473
|
+
const parsed = parseIpLiteral(host);
|
|
1474
|
+
if (!parsed) return false;
|
|
1475
|
+
return BLOCKED_IP_NETWORKS.some((network) => {
|
|
1476
|
+
if (network.bits !== parsed.bits) return false;
|
|
1477
|
+
const shift = BigInt(parsed.bits - network.prefix);
|
|
1478
|
+
return parsed.value >> shift === network.value >> shift;
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
function parseIpLiteral(value) {
|
|
1482
|
+
const ipv4 = parseIpv4(value);
|
|
1483
|
+
if (ipv4 !== void 0) return { bits: 32, value: ipv4 };
|
|
1484
|
+
if (!value.includes(":")) return void 0;
|
|
1485
|
+
const halves = value.toLowerCase().split("::");
|
|
1486
|
+
if (halves.length > 2) return void 0;
|
|
1487
|
+
const head = parseIpv6Half(halves[0]);
|
|
1488
|
+
const tail = parseIpv6Half(halves[1] ?? "");
|
|
1489
|
+
if (!head || !tail) return void 0;
|
|
1490
|
+
const compressed = halves.length === 2;
|
|
1491
|
+
const missing = 8 - head.length - tail.length;
|
|
1492
|
+
if (!compressed && missing !== 0 || compressed && missing < 1) return void 0;
|
|
1493
|
+
const segments = [...head, ...Array(missing).fill(0), ...tail];
|
|
1494
|
+
const address = segments.reduce((result, segment) => result << 16n | BigInt(segment), 0n);
|
|
1495
|
+
if (address >> 32n === 0xffffn) {
|
|
1496
|
+
return { bits: 32, value: address & 0xffffffffn };
|
|
1497
|
+
}
|
|
1498
|
+
return { bits: 128, value: address };
|
|
1499
|
+
}
|
|
1500
|
+
function parseIpv4(value) {
|
|
1501
|
+
const parts = value.split(".");
|
|
1502
|
+
if (parts.length !== 4 || parts.some((part) => !/^\d+$/.test(part))) return void 0;
|
|
1503
|
+
const octets = parts.map(Number);
|
|
1504
|
+
if (octets.some((octet) => octet < 0 || octet > 255)) return void 0;
|
|
1505
|
+
return octets.reduce((result, octet) => result << 8n | BigInt(octet), 0n);
|
|
1506
|
+
}
|
|
1507
|
+
function parseIpv6Half(value) {
|
|
1508
|
+
if (value === "") return [];
|
|
1509
|
+
const parts = value.split(":");
|
|
1510
|
+
if (parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) return void 0;
|
|
1511
|
+
return parts.map((part) => Number.parseInt(part, 16));
|
|
1512
|
+
}
|
|
1513
|
+
|
|
713
1514
|
// src/resources/text-to-video.ts
|
|
714
1515
|
var ENDPOINT = "/api/v1/kling/text_to_video";
|
|
715
1516
|
var V26_MODEL = "kling-v2.6";
|
|
@@ -754,6 +1555,7 @@ var TextToVideo = class {
|
|
|
754
1555
|
rejectUnsupportedV3TurboFields(body);
|
|
755
1556
|
validateParams(contract["text-to-video"], body);
|
|
756
1557
|
validateV26Params(body);
|
|
1558
|
+
validateKlingO1References(body);
|
|
757
1559
|
return this.http.request("POST", ENDPOINT, {
|
|
758
1560
|
body,
|
|
759
1561
|
...options
|
|
@@ -774,14 +1576,14 @@ var TextToVideo = class {
|
|
|
774
1576
|
function validateV26Params(body) {
|
|
775
1577
|
if (body.model !== V26_MODEL) return;
|
|
776
1578
|
if (body.enable_sound === true && body.mode !== "pro") {
|
|
777
|
-
throw new
|
|
1579
|
+
throw new ValidationError2(`enable_sound requires mode pro for ${V26_MODEL}`);
|
|
778
1580
|
}
|
|
779
1581
|
}
|
|
780
1582
|
function rejectUnsupportedV3TurboFields(body) {
|
|
781
1583
|
if (body.model !== V3_TURBO_MODEL) return;
|
|
782
1584
|
const field = V3_TURBO_UNSUPPORTED_FIELDS.find((candidate) => fieldPresent(body, candidate));
|
|
783
1585
|
if (field) {
|
|
784
|
-
throw new
|
|
1586
|
+
throw new ValidationError2(`${field} is not supported by ${V3_TURBO_MODEL}`);
|
|
785
1587
|
}
|
|
786
1588
|
}
|
|
787
1589
|
function fieldPresent(params, field) {
|
|
@@ -801,7 +1603,7 @@ function presentValue(value) {
|
|
|
801
1603
|
}
|
|
802
1604
|
|
|
803
1605
|
// src/resources/image-to-video.ts
|
|
804
|
-
import { ValidationError as
|
|
1606
|
+
import { ValidationError as ValidationError3, compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
|
|
805
1607
|
import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
|
|
806
1608
|
var ENDPOINT2 = "/api/v1/kling/image_to_video";
|
|
807
1609
|
var V26_MODEL2 = "kling-v2.6";
|
|
@@ -844,6 +1646,7 @@ var ImageToVideo = class {
|
|
|
844
1646
|
validateParams2(contract["image-to-video"], body);
|
|
845
1647
|
validateV26Params2(body);
|
|
846
1648
|
validateV3OmniFields(body);
|
|
1649
|
+
validateKlingO1References(body);
|
|
847
1650
|
return this.http.request("POST", ENDPOINT2, {
|
|
848
1651
|
body,
|
|
849
1652
|
...options
|
|
@@ -864,27 +1667,27 @@ var ImageToVideo = class {
|
|
|
864
1667
|
function validateV26Params2(body) {
|
|
865
1668
|
if (body.model !== V26_MODEL2) return;
|
|
866
1669
|
if (body.enable_sound === true && body.mode !== "pro") {
|
|
867
|
-
throw new
|
|
1670
|
+
throw new ValidationError3(`enable_sound requires mode pro for ${V26_MODEL2}`);
|
|
868
1671
|
}
|
|
869
1672
|
if (!fieldPresent2(body, "last_frame_image_url")) return;
|
|
870
1673
|
if (body.mode !== "pro") {
|
|
871
|
-
throw new
|
|
1674
|
+
throw new ValidationError3(`last_frame_image_url requires mode pro for ${V26_MODEL2}`);
|
|
872
1675
|
}
|
|
873
1676
|
if (body.duration_seconds !== void 0 && body.duration_seconds !== 5) {
|
|
874
|
-
throw new
|
|
1677
|
+
throw new ValidationError3(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL2}`);
|
|
875
1678
|
}
|
|
876
1679
|
}
|
|
877
1680
|
function validateV3OmniFields(body) {
|
|
878
1681
|
if (body.model !== V3_OMNI_MODEL || !fieldPresent2(body, "last_frame_image_url")) return;
|
|
879
1682
|
if ((body.duration_seconds ?? 5) !== 5) {
|
|
880
|
-
throw new
|
|
1683
|
+
throw new ValidationError3(`last_frame_image_url requires duration_seconds 5 for ${V3_OMNI_MODEL}`);
|
|
881
1684
|
}
|
|
882
1685
|
}
|
|
883
1686
|
function rejectUnsupportedV3TurboFields2(body) {
|
|
884
1687
|
if (body.model !== V3_TURBO_MODEL2) return;
|
|
885
1688
|
const field = V3_TURBO_UNSUPPORTED_FIELDS2.find((candidate) => fieldPresent2(body, candidate));
|
|
886
1689
|
if (field) {
|
|
887
|
-
throw new
|
|
1690
|
+
throw new ValidationError3(`${field} is not supported by ${V3_TURBO_MODEL2}`);
|
|
888
1691
|
}
|
|
889
1692
|
}
|
|
890
1693
|
function fieldPresent2(params, field) {
|
|
@@ -1029,6 +1832,32 @@ var ExtendVideo = class {
|
|
|
1029
1832
|
}
|
|
1030
1833
|
};
|
|
1031
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
|
+
|
|
1032
1861
|
// src/client.ts
|
|
1033
1862
|
var KlingClient = class extends BaseClient {
|
|
1034
1863
|
/** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
|
|
@@ -1040,6 +1869,8 @@ var KlingClient = class extends BaseClient {
|
|
|
1040
1869
|
/** Transfer motion from a reference video onto a subject image. */
|
|
1041
1870
|
motionControl;
|
|
1042
1871
|
extendVideo;
|
|
1872
|
+
/** Edit a source video with the selected Kling v3 Omni model. */
|
|
1873
|
+
editVideo;
|
|
1043
1874
|
constructor(options = {}) {
|
|
1044
1875
|
super(options);
|
|
1045
1876
|
this.textToVideo = new TextToVideo(this.http);
|
|
@@ -1047,6 +1878,7 @@ var KlingClient = class extends BaseClient {
|
|
|
1047
1878
|
this.aiAvatar = new AiAvatar(this.http);
|
|
1048
1879
|
this.motionControl = new MotionControl(this.http);
|
|
1049
1880
|
this.extendVideo = new ExtendVideo(this.http);
|
|
1881
|
+
this.editVideo = new EditVideo(this.http);
|
|
1050
1882
|
}
|
|
1051
1883
|
};
|
|
1052
1884
|
|
|
@@ -1056,7 +1888,7 @@ import {
|
|
|
1056
1888
|
AuthenticationError,
|
|
1057
1889
|
InsufficientCreditsError,
|
|
1058
1890
|
NotFoundError,
|
|
1059
|
-
ValidationError as
|
|
1891
|
+
ValidationError as ValidationError4,
|
|
1060
1892
|
RateLimitError,
|
|
1061
1893
|
ServiceUnavailableError,
|
|
1062
1894
|
NetworkError,
|
|
@@ -1076,6 +1908,6 @@ export {
|
|
|
1076
1908
|
TaskFailedError,
|
|
1077
1909
|
TaskTimeoutError,
|
|
1078
1910
|
TimeoutError,
|
|
1079
|
-
|
|
1911
|
+
ValidationError4 as ValidationError
|
|
1080
1912
|
};
|
|
1081
1913
|
//# sourceMappingURL=index.mjs.map
|