@runapi.ai/kling 0.3.5 → 0.5.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.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +26 -1637
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1619
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -20,1548 +20,28 @@ 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: () =>
|
|
24
|
-
InsufficientCreditsError: () =>
|
|
23
|
+
AuthenticationError: () => import_core8.AuthenticationError,
|
|
24
|
+
InsufficientCreditsError: () => import_core8.InsufficientCreditsError,
|
|
25
25
|
KlingClient: () => KlingClient,
|
|
26
|
-
NetworkError: () =>
|
|
27
|
-
NotFoundError: () =>
|
|
28
|
-
RateLimitError: () =>
|
|
29
|
-
RunApiError: () =>
|
|
30
|
-
ServiceUnavailableError: () =>
|
|
31
|
-
TaskFailedError: () =>
|
|
32
|
-
TaskTimeoutError: () =>
|
|
33
|
-
TimeoutError: () =>
|
|
34
|
-
ValidationError: () =>
|
|
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
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/client.ts
|
|
39
|
-
var
|
|
39
|
+
var import_core7 = require("@runapi.ai/core");
|
|
40
40
|
|
|
41
41
|
// src/resources/text-to-video.ts
|
|
42
|
-
var import_core2 = require("@runapi.ai/core");
|
|
43
|
-
var import_internal = require("@runapi.ai/core/internal");
|
|
44
|
-
|
|
45
|
-
// src/contract_gen.ts
|
|
46
|
-
var contract = {
|
|
47
|
-
"avatar": {
|
|
48
|
-
"models": [
|
|
49
|
-
"kling-ai-avatar-pro",
|
|
50
|
-
"kling-ai-avatar-standard",
|
|
51
|
-
"kling-ai-avatar-v1-pro",
|
|
52
|
-
"kling-v1-avatar-standard"
|
|
53
|
-
],
|
|
54
|
-
"fields_by_model": {
|
|
55
|
-
"kling-ai-avatar-pro": {
|
|
56
|
-
"model": {
|
|
57
|
-
"required": true
|
|
58
|
-
},
|
|
59
|
-
"prompt": {
|
|
60
|
-
"required": true
|
|
61
|
-
},
|
|
62
|
-
"source_audio_url": {
|
|
63
|
-
"required": true
|
|
64
|
-
},
|
|
65
|
-
"source_image_url": {
|
|
66
|
-
"required": true
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"kling-ai-avatar-standard": {
|
|
70
|
-
"model": {
|
|
71
|
-
"required": true
|
|
72
|
-
},
|
|
73
|
-
"prompt": {
|
|
74
|
-
"required": true
|
|
75
|
-
},
|
|
76
|
-
"source_audio_url": {
|
|
77
|
-
"required": true
|
|
78
|
-
},
|
|
79
|
-
"source_image_url": {
|
|
80
|
-
"required": true
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"kling-ai-avatar-v1-pro": {
|
|
84
|
-
"model": {
|
|
85
|
-
"required": true
|
|
86
|
-
},
|
|
87
|
-
"prompt": {
|
|
88
|
-
"required": true
|
|
89
|
-
},
|
|
90
|
-
"source_audio_url": {
|
|
91
|
-
"required": true
|
|
92
|
-
},
|
|
93
|
-
"source_image_url": {
|
|
94
|
-
"required": true
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"kling-v1-avatar-standard": {
|
|
98
|
-
"model": {
|
|
99
|
-
"required": true
|
|
100
|
-
},
|
|
101
|
-
"prompt": {
|
|
102
|
-
"required": true
|
|
103
|
-
},
|
|
104
|
-
"source_audio_url": {
|
|
105
|
-
"required": true
|
|
106
|
-
},
|
|
107
|
-
"source_image_url": {
|
|
108
|
-
"required": true
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
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
|
-
},
|
|
477
|
-
"extend-video": {
|
|
478
|
-
"models": [
|
|
479
|
-
"kling-v2.5-turbo-image-to-video-pro",
|
|
480
|
-
"kling-v2.5-turbo-text-to-video-pro"
|
|
481
|
-
],
|
|
482
|
-
"fields_by_model": {
|
|
483
|
-
"kling-v2.5-turbo-image-to-video-pro": {
|
|
484
|
-
"mode": {
|
|
485
|
-
"enum": [
|
|
486
|
-
"std",
|
|
487
|
-
"pro"
|
|
488
|
-
]
|
|
489
|
-
},
|
|
490
|
-
"source_task_id": {
|
|
491
|
-
"required": true
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
|
-
"kling-v2.5-turbo-text-to-video-pro": {
|
|
495
|
-
"mode": {
|
|
496
|
-
"enum": [
|
|
497
|
-
"std",
|
|
498
|
-
"pro"
|
|
499
|
-
]
|
|
500
|
-
},
|
|
501
|
-
"source_task_id": {
|
|
502
|
-
"required": true
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
"image-to-video": {
|
|
508
|
-
"models": [
|
|
509
|
-
"kling-o1",
|
|
510
|
-
"kling-v2.1-master-image-to-video",
|
|
511
|
-
"kling-v2.1-pro",
|
|
512
|
-
"kling-v2.1-standard",
|
|
513
|
-
"kling-v2.5-turbo-image-to-video-pro",
|
|
514
|
-
"kling-v2.6",
|
|
515
|
-
"kling-v3-omni",
|
|
516
|
-
"kling-v3-turbo-image-to-video"
|
|
517
|
-
],
|
|
518
|
-
"fields_by_model": {
|
|
519
|
-
"kling-o1": {
|
|
520
|
-
"aspect_ratio": {
|
|
521
|
-
"enum": [
|
|
522
|
-
"16:9",
|
|
523
|
-
"9:16",
|
|
524
|
-
"1:1"
|
|
525
|
-
]
|
|
526
|
-
},
|
|
527
|
-
"duration_seconds": {
|
|
528
|
-
"enum": [
|
|
529
|
-
5
|
|
530
|
-
],
|
|
531
|
-
"type": "integer"
|
|
532
|
-
},
|
|
533
|
-
"first_frame_image_url": {
|
|
534
|
-
"required": true
|
|
535
|
-
},
|
|
536
|
-
"mode": {
|
|
537
|
-
"enum": [
|
|
538
|
-
"std",
|
|
539
|
-
"pro"
|
|
540
|
-
]
|
|
541
|
-
},
|
|
542
|
-
"model": {
|
|
543
|
-
"required": true
|
|
544
|
-
},
|
|
545
|
-
"prompt": {
|
|
546
|
-
"required": true,
|
|
547
|
-
"min": 1,
|
|
548
|
-
"max": 2500,
|
|
549
|
-
"length": true
|
|
550
|
-
},
|
|
551
|
-
"reference_image_urls": {
|
|
552
|
-
"min_items": 1,
|
|
553
|
-
"max_items": 7
|
|
554
|
-
},
|
|
555
|
-
"reference_video_type": {
|
|
556
|
-
"enum": [
|
|
557
|
-
"base",
|
|
558
|
-
"feature"
|
|
559
|
-
]
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
"kling-v2.1-master-image-to-video": {
|
|
563
|
-
"duration_seconds": {
|
|
564
|
-
"enum": [
|
|
565
|
-
5,
|
|
566
|
-
10
|
|
567
|
-
],
|
|
568
|
-
"type": "integer"
|
|
569
|
-
},
|
|
570
|
-
"first_frame_image_url": {
|
|
571
|
-
"required": true
|
|
572
|
-
},
|
|
573
|
-
"model": {
|
|
574
|
-
"required": true
|
|
575
|
-
},
|
|
576
|
-
"prompt": {
|
|
577
|
-
"required": true
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
"kling-v2.1-pro": {
|
|
581
|
-
"duration_seconds": {
|
|
582
|
-
"enum": [
|
|
583
|
-
5,
|
|
584
|
-
10
|
|
585
|
-
],
|
|
586
|
-
"type": "integer"
|
|
587
|
-
},
|
|
588
|
-
"first_frame_image_url": {
|
|
589
|
-
"required": true
|
|
590
|
-
},
|
|
591
|
-
"model": {
|
|
592
|
-
"required": true
|
|
593
|
-
},
|
|
594
|
-
"prompt": {
|
|
595
|
-
"required": true
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
"kling-v2.1-standard": {
|
|
599
|
-
"duration_seconds": {
|
|
600
|
-
"enum": [
|
|
601
|
-
5,
|
|
602
|
-
10
|
|
603
|
-
],
|
|
604
|
-
"type": "integer"
|
|
605
|
-
},
|
|
606
|
-
"first_frame_image_url": {
|
|
607
|
-
"required": true
|
|
608
|
-
},
|
|
609
|
-
"model": {
|
|
610
|
-
"required": true
|
|
611
|
-
},
|
|
612
|
-
"prompt": {
|
|
613
|
-
"required": true
|
|
614
|
-
}
|
|
615
|
-
},
|
|
616
|
-
"kling-v2.5-turbo-image-to-video-pro": {
|
|
617
|
-
"duration_seconds": {
|
|
618
|
-
"enum": [
|
|
619
|
-
5,
|
|
620
|
-
10
|
|
621
|
-
],
|
|
622
|
-
"type": "integer"
|
|
623
|
-
},
|
|
624
|
-
"first_frame_image_url": {
|
|
625
|
-
"required": true
|
|
626
|
-
},
|
|
627
|
-
"model": {
|
|
628
|
-
"required": true
|
|
629
|
-
},
|
|
630
|
-
"prompt": {
|
|
631
|
-
"required": true
|
|
632
|
-
}
|
|
633
|
-
},
|
|
634
|
-
"kling-v2.6": {
|
|
635
|
-
"aspect_ratio": {
|
|
636
|
-
"enum": [
|
|
637
|
-
"16:9",
|
|
638
|
-
"9:16",
|
|
639
|
-
"1:1"
|
|
640
|
-
]
|
|
641
|
-
},
|
|
642
|
-
"duration_seconds": {
|
|
643
|
-
"enum": [
|
|
644
|
-
5,
|
|
645
|
-
10
|
|
646
|
-
],
|
|
647
|
-
"type": "integer"
|
|
648
|
-
},
|
|
649
|
-
"first_frame_image_url": {
|
|
650
|
-
"required": true
|
|
651
|
-
},
|
|
652
|
-
"mode": {
|
|
653
|
-
"enum": [
|
|
654
|
-
"std",
|
|
655
|
-
"pro"
|
|
656
|
-
]
|
|
657
|
-
},
|
|
658
|
-
"model": {
|
|
659
|
-
"required": true
|
|
660
|
-
},
|
|
661
|
-
"prompt": {
|
|
662
|
-
"required": true,
|
|
663
|
-
"min": 1,
|
|
664
|
-
"max": 2500,
|
|
665
|
-
"length": true
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
"kling-v3-omni": {
|
|
669
|
-
"aspect_ratio": {
|
|
670
|
-
"enum": [
|
|
671
|
-
"16:9",
|
|
672
|
-
"9:16",
|
|
673
|
-
"1:1"
|
|
674
|
-
]
|
|
675
|
-
},
|
|
676
|
-
"duration_seconds": {
|
|
677
|
-
"enum": [
|
|
678
|
-
3,
|
|
679
|
-
4,
|
|
680
|
-
5,
|
|
681
|
-
6,
|
|
682
|
-
7,
|
|
683
|
-
8,
|
|
684
|
-
9,
|
|
685
|
-
10,
|
|
686
|
-
11,
|
|
687
|
-
12,
|
|
688
|
-
13,
|
|
689
|
-
14,
|
|
690
|
-
15
|
|
691
|
-
],
|
|
692
|
-
"type": "integer"
|
|
693
|
-
},
|
|
694
|
-
"first_frame_image_url": {
|
|
695
|
-
"required": true
|
|
696
|
-
},
|
|
697
|
-
"model": {
|
|
698
|
-
"required": true
|
|
699
|
-
},
|
|
700
|
-
"output_resolution": {
|
|
701
|
-
"enum": [
|
|
702
|
-
"720p",
|
|
703
|
-
"1080p",
|
|
704
|
-
"4k"
|
|
705
|
-
]
|
|
706
|
-
},
|
|
707
|
-
"prompt": {
|
|
708
|
-
"required": true,
|
|
709
|
-
"min": 1,
|
|
710
|
-
"max": 2500,
|
|
711
|
-
"length": true
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
"kling-v3-turbo-image-to-video": {
|
|
715
|
-
"duration_seconds": {
|
|
716
|
-
"enum": [
|
|
717
|
-
3,
|
|
718
|
-
4,
|
|
719
|
-
5,
|
|
720
|
-
6,
|
|
721
|
-
7,
|
|
722
|
-
8,
|
|
723
|
-
9,
|
|
724
|
-
10,
|
|
725
|
-
11,
|
|
726
|
-
12,
|
|
727
|
-
13,
|
|
728
|
-
14,
|
|
729
|
-
15
|
|
730
|
-
],
|
|
731
|
-
"type": "integer"
|
|
732
|
-
},
|
|
733
|
-
"first_frame_image_url": {
|
|
734
|
-
"required": true
|
|
735
|
-
},
|
|
736
|
-
"model": {
|
|
737
|
-
"required": true
|
|
738
|
-
},
|
|
739
|
-
"output_resolution": {
|
|
740
|
-
"enum": [
|
|
741
|
-
"720p",
|
|
742
|
-
"1080p"
|
|
743
|
-
]
|
|
744
|
-
},
|
|
745
|
-
"prompt": {
|
|
746
|
-
"required": true,
|
|
747
|
-
"min": 1,
|
|
748
|
-
"max": 2500,
|
|
749
|
-
"length": true
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
},
|
|
753
|
-
"rules": [
|
|
754
|
-
{
|
|
755
|
-
"when": {
|
|
756
|
-
"model": "kling-o1"
|
|
757
|
-
},
|
|
758
|
-
"forbidden": [
|
|
759
|
-
"output_resolution",
|
|
760
|
-
"negative_prompt",
|
|
761
|
-
"cfg_scale"
|
|
762
|
-
]
|
|
763
|
-
},
|
|
764
|
-
{
|
|
765
|
-
"when": {
|
|
766
|
-
"model": "kling-v2.1-master-image-to-video"
|
|
767
|
-
},
|
|
768
|
-
"forbidden": [
|
|
769
|
-
"output_resolution",
|
|
770
|
-
"enable_sound",
|
|
771
|
-
"reference_image_urls",
|
|
772
|
-
"reference_video_url",
|
|
773
|
-
"reference_video_type",
|
|
774
|
-
"preserve_reference_video_audio"
|
|
775
|
-
]
|
|
776
|
-
},
|
|
777
|
-
{
|
|
778
|
-
"when": {
|
|
779
|
-
"model": "kling-v2.1-pro"
|
|
780
|
-
},
|
|
781
|
-
"forbidden": [
|
|
782
|
-
"output_resolution",
|
|
783
|
-
"enable_sound",
|
|
784
|
-
"reference_image_urls",
|
|
785
|
-
"reference_video_url",
|
|
786
|
-
"reference_video_type",
|
|
787
|
-
"preserve_reference_video_audio"
|
|
788
|
-
]
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
"when": {
|
|
792
|
-
"model": "kling-v2.1-standard"
|
|
793
|
-
},
|
|
794
|
-
"forbidden": [
|
|
795
|
-
"output_resolution",
|
|
796
|
-
"enable_sound",
|
|
797
|
-
"reference_image_urls",
|
|
798
|
-
"reference_video_url",
|
|
799
|
-
"reference_video_type",
|
|
800
|
-
"preserve_reference_video_audio"
|
|
801
|
-
]
|
|
802
|
-
},
|
|
803
|
-
{
|
|
804
|
-
"when": {
|
|
805
|
-
"model": "kling-v2.5-turbo-image-to-video-pro"
|
|
806
|
-
},
|
|
807
|
-
"forbidden": [
|
|
808
|
-
"output_resolution",
|
|
809
|
-
"enable_sound",
|
|
810
|
-
"reference_image_urls",
|
|
811
|
-
"reference_video_url",
|
|
812
|
-
"reference_video_type",
|
|
813
|
-
"preserve_reference_video_audio"
|
|
814
|
-
]
|
|
815
|
-
},
|
|
816
|
-
{
|
|
817
|
-
"when": {
|
|
818
|
-
"model": "kling-v2.6"
|
|
819
|
-
},
|
|
820
|
-
"forbidden": [
|
|
821
|
-
"output_resolution",
|
|
822
|
-
"negative_prompt",
|
|
823
|
-
"cfg_scale",
|
|
824
|
-
"reference_image_urls",
|
|
825
|
-
"reference_video_url",
|
|
826
|
-
"reference_video_type",
|
|
827
|
-
"preserve_reference_video_audio"
|
|
828
|
-
]
|
|
829
|
-
},
|
|
830
|
-
{
|
|
831
|
-
"when": {
|
|
832
|
-
"model": "kling-v3-omni"
|
|
833
|
-
},
|
|
834
|
-
"forbidden": [
|
|
835
|
-
"negative_prompt",
|
|
836
|
-
"cfg_scale",
|
|
837
|
-
"reference_image_urls",
|
|
838
|
-
"reference_video_url",
|
|
839
|
-
"reference_video_type",
|
|
840
|
-
"preserve_reference_video_audio"
|
|
841
|
-
]
|
|
842
|
-
},
|
|
843
|
-
{
|
|
844
|
-
"when": {
|
|
845
|
-
"model": "kling-v3-turbo-image-to-video"
|
|
846
|
-
},
|
|
847
|
-
"forbidden": [
|
|
848
|
-
"enable_sound",
|
|
849
|
-
"aspect_ratio",
|
|
850
|
-
"negative_prompt",
|
|
851
|
-
"cfg_scale",
|
|
852
|
-
"last_frame_image_url",
|
|
853
|
-
"reference_image_urls",
|
|
854
|
-
"reference_video_url",
|
|
855
|
-
"reference_video_type",
|
|
856
|
-
"preserve_reference_video_audio"
|
|
857
|
-
]
|
|
858
|
-
}
|
|
859
|
-
]
|
|
860
|
-
},
|
|
861
|
-
"motion-control": {
|
|
862
|
-
"models": [
|
|
863
|
-
"kling-3.0",
|
|
864
|
-
"kling-v2.6"
|
|
865
|
-
],
|
|
866
|
-
"fields_by_model": {
|
|
867
|
-
"kling-3.0": {
|
|
868
|
-
"background_source": {
|
|
869
|
-
"enum": [
|
|
870
|
-
"video",
|
|
871
|
-
"image"
|
|
872
|
-
]
|
|
873
|
-
},
|
|
874
|
-
"character_orientation": {
|
|
875
|
-
"enum": [
|
|
876
|
-
"video",
|
|
877
|
-
"image"
|
|
878
|
-
]
|
|
879
|
-
},
|
|
880
|
-
"model": {
|
|
881
|
-
"required": true
|
|
882
|
-
},
|
|
883
|
-
"output_resolution": {
|
|
884
|
-
"enum": [
|
|
885
|
-
"720p",
|
|
886
|
-
"1080p"
|
|
887
|
-
]
|
|
888
|
-
},
|
|
889
|
-
"reference_video_url": {
|
|
890
|
-
"required": true
|
|
891
|
-
},
|
|
892
|
-
"source_image_url": {
|
|
893
|
-
"required": true
|
|
894
|
-
}
|
|
895
|
-
},
|
|
896
|
-
"kling-v2.6": {
|
|
897
|
-
"character_orientation": {
|
|
898
|
-
"enum": [
|
|
899
|
-
"video",
|
|
900
|
-
"image"
|
|
901
|
-
],
|
|
902
|
-
"required": true
|
|
903
|
-
},
|
|
904
|
-
"model": {
|
|
905
|
-
"required": true
|
|
906
|
-
},
|
|
907
|
-
"output_resolution": {
|
|
908
|
-
"enum": [
|
|
909
|
-
"720p",
|
|
910
|
-
"1080p"
|
|
911
|
-
],
|
|
912
|
-
"required": true
|
|
913
|
-
},
|
|
914
|
-
"prompt": {
|
|
915
|
-
"max": 2500,
|
|
916
|
-
"length": true
|
|
917
|
-
},
|
|
918
|
-
"reference_video_url": {
|
|
919
|
-
"required": true
|
|
920
|
-
},
|
|
921
|
-
"source_image_url": {
|
|
922
|
-
"required": true
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
},
|
|
926
|
-
"rules": [
|
|
927
|
-
{
|
|
928
|
-
"when": {
|
|
929
|
-
"model": "kling-v2.6"
|
|
930
|
-
},
|
|
931
|
-
"forbidden": [
|
|
932
|
-
"background_source"
|
|
933
|
-
]
|
|
934
|
-
}
|
|
935
|
-
]
|
|
936
|
-
},
|
|
937
|
-
"text-to-video": {
|
|
938
|
-
"models": [
|
|
939
|
-
"kling-3.0",
|
|
940
|
-
"kling-o1",
|
|
941
|
-
"kling-v2.1-master-text-to-video",
|
|
942
|
-
"kling-v2.5-turbo-text-to-video-pro",
|
|
943
|
-
"kling-v2.6",
|
|
944
|
-
"kling-v3-omni",
|
|
945
|
-
"kling-v3-omni-reference",
|
|
946
|
-
"kling-v3-turbo-text-to-video"
|
|
947
|
-
],
|
|
948
|
-
"fields_by_model": {
|
|
949
|
-
"kling-3.0": {
|
|
950
|
-
"aspect_ratio": {
|
|
951
|
-
"enum": [
|
|
952
|
-
"16:9",
|
|
953
|
-
"9:16",
|
|
954
|
-
"1:1"
|
|
955
|
-
]
|
|
956
|
-
},
|
|
957
|
-
"duration_seconds": {
|
|
958
|
-
"enum": [
|
|
959
|
-
3,
|
|
960
|
-
4,
|
|
961
|
-
5,
|
|
962
|
-
6,
|
|
963
|
-
7,
|
|
964
|
-
8,
|
|
965
|
-
9,
|
|
966
|
-
10,
|
|
967
|
-
11,
|
|
968
|
-
12,
|
|
969
|
-
13,
|
|
970
|
-
14,
|
|
971
|
-
15
|
|
972
|
-
],
|
|
973
|
-
"type": "integer"
|
|
974
|
-
},
|
|
975
|
-
"model": {
|
|
976
|
-
"required": true
|
|
977
|
-
},
|
|
978
|
-
"output_resolution": {
|
|
979
|
-
"enum": [
|
|
980
|
-
"720p",
|
|
981
|
-
"1080p",
|
|
982
|
-
"4k"
|
|
983
|
-
]
|
|
984
|
-
}
|
|
985
|
-
},
|
|
986
|
-
"kling-o1": {
|
|
987
|
-
"aspect_ratio": {
|
|
988
|
-
"enum": [
|
|
989
|
-
"16:9",
|
|
990
|
-
"9:16",
|
|
991
|
-
"1:1"
|
|
992
|
-
]
|
|
993
|
-
},
|
|
994
|
-
"duration_seconds": {
|
|
995
|
-
"enum": [
|
|
996
|
-
5
|
|
997
|
-
],
|
|
998
|
-
"type": "integer"
|
|
999
|
-
},
|
|
1000
|
-
"mode": {
|
|
1001
|
-
"enum": [
|
|
1002
|
-
"std",
|
|
1003
|
-
"pro"
|
|
1004
|
-
]
|
|
1005
|
-
},
|
|
1006
|
-
"model": {
|
|
1007
|
-
"required": true
|
|
1008
|
-
},
|
|
1009
|
-
"prompt": {
|
|
1010
|
-
"required": true,
|
|
1011
|
-
"min": 1,
|
|
1012
|
-
"max": 2500,
|
|
1013
|
-
"length": true
|
|
1014
|
-
},
|
|
1015
|
-
"reference_image_urls": {
|
|
1016
|
-
"min_items": 1,
|
|
1017
|
-
"max_items": 7
|
|
1018
|
-
},
|
|
1019
|
-
"reference_video_type": {
|
|
1020
|
-
"enum": [
|
|
1021
|
-
"base",
|
|
1022
|
-
"feature"
|
|
1023
|
-
]
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
"kling-v2.1-master-text-to-video": {
|
|
1027
|
-
"aspect_ratio": {
|
|
1028
|
-
"enum": [
|
|
1029
|
-
"16:9",
|
|
1030
|
-
"9:16",
|
|
1031
|
-
"1:1"
|
|
1032
|
-
]
|
|
1033
|
-
},
|
|
1034
|
-
"duration_seconds": {
|
|
1035
|
-
"enum": [
|
|
1036
|
-
5,
|
|
1037
|
-
10
|
|
1038
|
-
],
|
|
1039
|
-
"type": "integer"
|
|
1040
|
-
},
|
|
1041
|
-
"model": {
|
|
1042
|
-
"required": true
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
"kling-v2.5-turbo-text-to-video-pro": {
|
|
1046
|
-
"aspect_ratio": {
|
|
1047
|
-
"enum": [
|
|
1048
|
-
"16:9",
|
|
1049
|
-
"9:16",
|
|
1050
|
-
"1:1"
|
|
1051
|
-
]
|
|
1052
|
-
},
|
|
1053
|
-
"duration_seconds": {
|
|
1054
|
-
"enum": [
|
|
1055
|
-
5,
|
|
1056
|
-
10
|
|
1057
|
-
],
|
|
1058
|
-
"type": "integer"
|
|
1059
|
-
},
|
|
1060
|
-
"model": {
|
|
1061
|
-
"required": true
|
|
1062
|
-
}
|
|
1063
|
-
},
|
|
1064
|
-
"kling-v2.6": {
|
|
1065
|
-
"aspect_ratio": {
|
|
1066
|
-
"enum": [
|
|
1067
|
-
"16:9",
|
|
1068
|
-
"9:16",
|
|
1069
|
-
"1:1"
|
|
1070
|
-
]
|
|
1071
|
-
},
|
|
1072
|
-
"duration_seconds": {
|
|
1073
|
-
"enum": [
|
|
1074
|
-
5,
|
|
1075
|
-
10
|
|
1076
|
-
],
|
|
1077
|
-
"type": "integer"
|
|
1078
|
-
},
|
|
1079
|
-
"mode": {
|
|
1080
|
-
"enum": [
|
|
1081
|
-
"std",
|
|
1082
|
-
"pro"
|
|
1083
|
-
]
|
|
1084
|
-
},
|
|
1085
|
-
"model": {
|
|
1086
|
-
"required": true
|
|
1087
|
-
},
|
|
1088
|
-
"prompt": {
|
|
1089
|
-
"required": true,
|
|
1090
|
-
"min": 1,
|
|
1091
|
-
"max": 2500,
|
|
1092
|
-
"length": true
|
|
1093
|
-
}
|
|
1094
|
-
},
|
|
1095
|
-
"kling-v3-omni": {
|
|
1096
|
-
"aspect_ratio": {
|
|
1097
|
-
"enum": [
|
|
1098
|
-
"16:9",
|
|
1099
|
-
"9:16",
|
|
1100
|
-
"1:1"
|
|
1101
|
-
]
|
|
1102
|
-
},
|
|
1103
|
-
"duration_seconds": {
|
|
1104
|
-
"enum": [
|
|
1105
|
-
3,
|
|
1106
|
-
4,
|
|
1107
|
-
5,
|
|
1108
|
-
6,
|
|
1109
|
-
7,
|
|
1110
|
-
8,
|
|
1111
|
-
9,
|
|
1112
|
-
10,
|
|
1113
|
-
11,
|
|
1114
|
-
12,
|
|
1115
|
-
13,
|
|
1116
|
-
14,
|
|
1117
|
-
15
|
|
1118
|
-
],
|
|
1119
|
-
"type": "integer"
|
|
1120
|
-
},
|
|
1121
|
-
"model": {
|
|
1122
|
-
"required": true
|
|
1123
|
-
},
|
|
1124
|
-
"output_resolution": {
|
|
1125
|
-
"enum": [
|
|
1126
|
-
"720p",
|
|
1127
|
-
"1080p",
|
|
1128
|
-
"4k"
|
|
1129
|
-
]
|
|
1130
|
-
},
|
|
1131
|
-
"prompt": {
|
|
1132
|
-
"required": true,
|
|
1133
|
-
"min": 1,
|
|
1134
|
-
"max": 2500,
|
|
1135
|
-
"length": true
|
|
1136
|
-
}
|
|
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
|
-
},
|
|
1187
|
-
"kling-v3-turbo-text-to-video": {
|
|
1188
|
-
"aspect_ratio": {
|
|
1189
|
-
"enum": [
|
|
1190
|
-
"16:9",
|
|
1191
|
-
"9:16",
|
|
1192
|
-
"1:1"
|
|
1193
|
-
]
|
|
1194
|
-
},
|
|
1195
|
-
"duration_seconds": {
|
|
1196
|
-
"enum": [
|
|
1197
|
-
3,
|
|
1198
|
-
4,
|
|
1199
|
-
5,
|
|
1200
|
-
6,
|
|
1201
|
-
7,
|
|
1202
|
-
8,
|
|
1203
|
-
9,
|
|
1204
|
-
10,
|
|
1205
|
-
11,
|
|
1206
|
-
12,
|
|
1207
|
-
13,
|
|
1208
|
-
14,
|
|
1209
|
-
15
|
|
1210
|
-
],
|
|
1211
|
-
"type": "integer"
|
|
1212
|
-
},
|
|
1213
|
-
"model": {
|
|
1214
|
-
"required": true
|
|
1215
|
-
},
|
|
1216
|
-
"output_resolution": {
|
|
1217
|
-
"enum": [
|
|
1218
|
-
"720p",
|
|
1219
|
-
"1080p"
|
|
1220
|
-
]
|
|
1221
|
-
},
|
|
1222
|
-
"prompt": {
|
|
1223
|
-
"required": true,
|
|
1224
|
-
"min": 1,
|
|
1225
|
-
"max": 2500,
|
|
1226
|
-
"length": true
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
},
|
|
1230
|
-
"rules": [
|
|
1231
|
-
{
|
|
1232
|
-
"when": {
|
|
1233
|
-
"model": "kling-3.0"
|
|
1234
|
-
},
|
|
1235
|
-
"forbidden": [
|
|
1236
|
-
"reference_image_urls",
|
|
1237
|
-
"reference_video_url",
|
|
1238
|
-
"reference_video_type",
|
|
1239
|
-
"preserve_reference_video_audio"
|
|
1240
|
-
]
|
|
1241
|
-
},
|
|
1242
|
-
{
|
|
1243
|
-
"when": {
|
|
1244
|
-
"model": "kling-o1"
|
|
1245
|
-
},
|
|
1246
|
-
"forbidden": [
|
|
1247
|
-
"output_resolution",
|
|
1248
|
-
"negative_prompt",
|
|
1249
|
-
"cfg_scale",
|
|
1250
|
-
"multi_shots",
|
|
1251
|
-
"multi_prompt",
|
|
1252
|
-
"first_frame_image_url",
|
|
1253
|
-
"last_frame_image_url",
|
|
1254
|
-
"kling_elements"
|
|
1255
|
-
]
|
|
1256
|
-
},
|
|
1257
|
-
{
|
|
1258
|
-
"when": {
|
|
1259
|
-
"model": "kling-v2.1-master-text-to-video"
|
|
1260
|
-
},
|
|
1261
|
-
"forbidden": [
|
|
1262
|
-
"mode",
|
|
1263
|
-
"reference_image_urls",
|
|
1264
|
-
"reference_video_url",
|
|
1265
|
-
"reference_video_type",
|
|
1266
|
-
"preserve_reference_video_audio"
|
|
1267
|
-
]
|
|
1268
|
-
},
|
|
1269
|
-
{
|
|
1270
|
-
"when": {
|
|
1271
|
-
"model": "kling-v2.5-turbo-text-to-video-pro"
|
|
1272
|
-
},
|
|
1273
|
-
"forbidden": [
|
|
1274
|
-
"mode",
|
|
1275
|
-
"reference_image_urls",
|
|
1276
|
-
"reference_video_url",
|
|
1277
|
-
"reference_video_type",
|
|
1278
|
-
"preserve_reference_video_audio"
|
|
1279
|
-
]
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
"when": {
|
|
1283
|
-
"model": "kling-v2.6"
|
|
1284
|
-
},
|
|
1285
|
-
"forbidden": [
|
|
1286
|
-
"output_resolution",
|
|
1287
|
-
"negative_prompt",
|
|
1288
|
-
"cfg_scale",
|
|
1289
|
-
"multi_shots",
|
|
1290
|
-
"multi_prompt",
|
|
1291
|
-
"first_frame_image_url",
|
|
1292
|
-
"last_frame_image_url",
|
|
1293
|
-
"kling_elements",
|
|
1294
|
-
"reference_image_urls",
|
|
1295
|
-
"reference_video_url",
|
|
1296
|
-
"reference_video_type",
|
|
1297
|
-
"preserve_reference_video_audio"
|
|
1298
|
-
]
|
|
1299
|
-
},
|
|
1300
|
-
{
|
|
1301
|
-
"when": {
|
|
1302
|
-
"model": "kling-v3-omni"
|
|
1303
|
-
},
|
|
1304
|
-
"forbidden": [
|
|
1305
|
-
"negative_prompt",
|
|
1306
|
-
"cfg_scale",
|
|
1307
|
-
"multi_shots",
|
|
1308
|
-
"multi_prompt",
|
|
1309
|
-
"first_frame_image_url",
|
|
1310
|
-
"last_frame_image_url",
|
|
1311
|
-
"kling_elements",
|
|
1312
|
-
"reference_image_urls",
|
|
1313
|
-
"reference_video_url",
|
|
1314
|
-
"reference_video_type",
|
|
1315
|
-
"preserve_reference_video_audio"
|
|
1316
|
-
]
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
"when": {
|
|
1320
|
-
"model": "kling-v3-turbo-text-to-video"
|
|
1321
|
-
},
|
|
1322
|
-
"forbidden": [
|
|
1323
|
-
"enable_sound",
|
|
1324
|
-
"negative_prompt",
|
|
1325
|
-
"cfg_scale",
|
|
1326
|
-
"multi_shots",
|
|
1327
|
-
"multi_prompt",
|
|
1328
|
-
"first_frame_image_url",
|
|
1329
|
-
"last_frame_image_url",
|
|
1330
|
-
"kling_elements",
|
|
1331
|
-
"reference_image_urls",
|
|
1332
|
-
"reference_video_url",
|
|
1333
|
-
"reference_video_type",
|
|
1334
|
-
"preserve_reference_video_audio"
|
|
1335
|
-
]
|
|
1336
|
-
}
|
|
1337
|
-
]
|
|
1338
|
-
}
|
|
1339
|
-
};
|
|
1340
|
-
|
|
1341
|
-
// src/resources/o1-reference-validation.ts
|
|
1342
42
|
var import_core = require("@runapi.ai/core");
|
|
1343
|
-
var
|
|
1344
|
-
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png"]);
|
|
1345
|
-
var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov"]);
|
|
1346
|
-
var BLOCKED_IP_CIDRS = [
|
|
1347
|
-
"0.0.0.0/8",
|
|
1348
|
-
"10.0.0.0/8",
|
|
1349
|
-
"100.64.0.0/10",
|
|
1350
|
-
"127.0.0.0/8",
|
|
1351
|
-
"169.254.0.0/16",
|
|
1352
|
-
"172.16.0.0/12",
|
|
1353
|
-
"192.0.0.0/24",
|
|
1354
|
-
"192.0.2.0/24",
|
|
1355
|
-
"192.88.99.0/24",
|
|
1356
|
-
"192.168.0.0/16",
|
|
1357
|
-
"198.18.0.0/15",
|
|
1358
|
-
"198.51.100.0/24",
|
|
1359
|
-
"203.0.113.0/24",
|
|
1360
|
-
"224.0.0.0/4",
|
|
1361
|
-
"240.0.0.0/4",
|
|
1362
|
-
"255.255.255.255/32",
|
|
1363
|
-
"::/128",
|
|
1364
|
-
"::1/128",
|
|
1365
|
-
"64:ff9b::/96",
|
|
1366
|
-
"64:ff9b:1::/48",
|
|
1367
|
-
"100::/64",
|
|
1368
|
-
"2001::/32",
|
|
1369
|
-
"2001:2::/48",
|
|
1370
|
-
"2001:db8::/32",
|
|
1371
|
-
"2002::/16",
|
|
1372
|
-
"3fff::/20",
|
|
1373
|
-
"fc00::/7",
|
|
1374
|
-
"fe80::/10",
|
|
1375
|
-
"ff00::/8"
|
|
1376
|
-
];
|
|
1377
|
-
var BLOCKED_IP_NETWORKS = BLOCKED_IP_CIDRS.map((cidr) => {
|
|
1378
|
-
const [address, prefixText] = cidr.split("/");
|
|
1379
|
-
const parsed = parseIpLiteral(address);
|
|
1380
|
-
if (!parsed) throw new Error("Invalid blocked IP range: " + cidr);
|
|
1381
|
-
return { ...parsed, prefix: Number(prefixText) };
|
|
1382
|
-
});
|
|
1383
|
-
function validateKlingO1References(body) {
|
|
1384
|
-
if (body.model !== O1_MODEL) return;
|
|
1385
|
-
if (body.enable_sound === true) {
|
|
1386
|
-
throw new import_core.ValidationError(`enable_sound is not supported by ${O1_MODEL}`);
|
|
1387
|
-
}
|
|
1388
|
-
validateFrameUrls(body);
|
|
1389
|
-
if (typeof body.prompt !== "string") {
|
|
1390
|
-
throw new import_core.ValidationError("prompt must be a string");
|
|
1391
|
-
}
|
|
1392
|
-
const prompt = body.prompt;
|
|
1393
|
-
const referenceImages = Array.isArray(body.reference_image_urls) ? body.reference_image_urls : [];
|
|
1394
|
-
if ("reference_video_url" in body && typeof body.reference_video_url !== "string") {
|
|
1395
|
-
throw new import_core.ValidationError("reference_video_url must be a string");
|
|
1396
|
-
}
|
|
1397
|
-
const referenceVideoUrl = body.reference_video_url;
|
|
1398
|
-
if (present(body.last_frame_image_url) && (referenceImages.length > 0 || present(referenceVideoUrl))) {
|
|
1399
|
-
throw new import_core.ValidationError(
|
|
1400
|
-
"last_frame_image_url cannot be combined with reference_image_urls or reference_video_url"
|
|
1401
|
-
);
|
|
1402
|
-
}
|
|
1403
|
-
if (referenceVideoUrl && referenceImages.length > 4) {
|
|
1404
|
-
throw new import_core.ValidationError(
|
|
1405
|
-
"reference_image_urls must contain at most 4 items when reference_video_url is present"
|
|
1406
|
-
);
|
|
1407
|
-
}
|
|
1408
|
-
validateReferenceImages(prompt, referenceImages);
|
|
1409
|
-
validateReferenceVideo(body, prompt, referenceVideoUrl);
|
|
1410
|
-
}
|
|
1411
|
-
function validateFrameUrls(body) {
|
|
1412
|
-
for (const field of ["first_frame_image_url", "last_frame_image_url"]) {
|
|
1413
|
-
const value = body[field];
|
|
1414
|
-
if (typeof value !== "string" || value.length === 0) continue;
|
|
1415
|
-
if (!isPublicHttpUrl(value)) {
|
|
1416
|
-
throw new import_core.ValidationError(`${field} must be a public HTTP or HTTPS URL`);
|
|
1417
|
-
}
|
|
1418
|
-
if (!IMAGE_EXTENSIONS.has(urlExtension(value))) {
|
|
1419
|
-
throw new import_core.ValidationError(`${field} must use a JPG, JPEG, or PNG URL`);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
function validateReferenceImages(prompt, urls) {
|
|
1424
|
-
urls.forEach((url, index) => {
|
|
1425
|
-
if (typeof url !== "string") {
|
|
1426
|
-
throw new import_core.ValidationError(`reference_image_urls[${index}] must be a string`);
|
|
1427
|
-
}
|
|
1428
|
-
if (!isPublicHttpUrl(url)) {
|
|
1429
|
-
throw new import_core.ValidationError(
|
|
1430
|
-
`reference_image_urls[${index}] must be a public HTTP or HTTPS URL`
|
|
1431
|
-
);
|
|
1432
|
-
}
|
|
1433
|
-
if (!IMAGE_EXTENSIONS.has(urlExtension(url))) {
|
|
1434
|
-
throw new import_core.ValidationError(
|
|
1435
|
-
`reference_image_urls[${index}] must use a JPG, JPEG, or PNG URL`
|
|
1436
|
-
);
|
|
1437
|
-
}
|
|
1438
|
-
const marker = `<<<image_${index + 1}>>>`;
|
|
1439
|
-
if (!prompt.includes(marker)) {
|
|
1440
|
-
throw new import_core.ValidationError(
|
|
1441
|
-
`prompt must reference reference_image_urls[${index}] as ${marker}`
|
|
1442
|
-
);
|
|
1443
|
-
}
|
|
1444
|
-
});
|
|
1445
|
-
for (const match of prompt.matchAll(/<<<image_(\d+)>>>/g)) {
|
|
1446
|
-
const index = Number(match[1]);
|
|
1447
|
-
if (index < 1 || index > urls.length) {
|
|
1448
|
-
throw new import_core.ValidationError(`prompt references missing image_${index}`);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
function validateReferenceVideo(body, prompt, referenceVideoUrl) {
|
|
1453
|
-
if (!referenceVideoUrl) {
|
|
1454
|
-
if ("reference_video_type" in body) {
|
|
1455
|
-
throw new import_core.ValidationError("reference_video_type requires reference_video_url");
|
|
1456
|
-
}
|
|
1457
|
-
if ("preserve_reference_video_audio" in body) {
|
|
1458
|
-
throw new import_core.ValidationError("preserve_reference_video_audio requires reference_video_url");
|
|
1459
|
-
}
|
|
1460
|
-
const missingMarker = prompt.match(/<<<video_([^>]+)>>>/);
|
|
1461
|
-
if (missingMarker) {
|
|
1462
|
-
throw new import_core.ValidationError(`prompt references missing video_${missingMarker[1]}`);
|
|
1463
|
-
}
|
|
1464
|
-
return;
|
|
1465
|
-
}
|
|
1466
|
-
if (!isPublicHttpUrl(referenceVideoUrl)) {
|
|
1467
|
-
throw new import_core.ValidationError("reference_video_url must be a public HTTP or HTTPS URL");
|
|
1468
|
-
}
|
|
1469
|
-
if (!VIDEO_EXTENSIONS.has(urlExtension(referenceVideoUrl))) {
|
|
1470
|
-
throw new import_core.ValidationError("reference_video_url must use an MP4 or MOV URL");
|
|
1471
|
-
}
|
|
1472
|
-
if (!prompt.includes("<<<video_1>>>")) {
|
|
1473
|
-
throw new import_core.ValidationError("prompt must reference reference_video_url as <<<video_1>>>");
|
|
1474
|
-
}
|
|
1475
|
-
for (const match of prompt.matchAll(/<<<video_([^>]+)>>>/g)) {
|
|
1476
|
-
if (match[1] !== "1") {
|
|
1477
|
-
throw new import_core.ValidationError("prompt may only reference video_1");
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
const referenceVideoType = body.reference_video_type ?? "base";
|
|
1481
|
-
if (referenceVideoType === "base" && (present(body.first_frame_image_url) || present(body.last_frame_image_url))) {
|
|
1482
|
-
throw new import_core.ValidationError(
|
|
1483
|
-
"reference_video_type base cannot be combined with first_frame_image_url or last_frame_image_url"
|
|
1484
|
-
);
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
function present(value) {
|
|
1488
|
-
return typeof value === "string" ? value.trim().length > 0 : value !== void 0 && value !== null;
|
|
1489
|
-
}
|
|
1490
|
-
function urlExtension(value) {
|
|
1491
|
-
try {
|
|
1492
|
-
const path = new URL(value).pathname;
|
|
1493
|
-
const dot = path.lastIndexOf(".");
|
|
1494
|
-
return dot >= 0 ? path.slice(dot).toLowerCase() : "";
|
|
1495
|
-
} catch {
|
|
1496
|
-
return "";
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
function isPublicHttpUrl(value) {
|
|
1500
|
-
try {
|
|
1501
|
-
const url = new URL(value);
|
|
1502
|
-
return (url.protocol === "http:" || url.protocol === "https:") && url.hostname.length > 0 && url.username.length === 0 && url.password.length === 0 && !isBlockedHost(url.hostname);
|
|
1503
|
-
} catch {
|
|
1504
|
-
return false;
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
function isBlockedHost(hostname) {
|
|
1508
|
-
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
1509
|
-
if (host === "localhost" || host.endsWith(".localhost")) return true;
|
|
1510
|
-
const parsed = parseIpLiteral(host);
|
|
1511
|
-
if (!parsed) return false;
|
|
1512
|
-
return BLOCKED_IP_NETWORKS.some((network) => {
|
|
1513
|
-
if (network.bits !== parsed.bits) return false;
|
|
1514
|
-
const shift = BigInt(parsed.bits - network.prefix);
|
|
1515
|
-
return parsed.value >> shift === network.value >> shift;
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
function parseIpLiteral(value) {
|
|
1519
|
-
const ipv4 = parseIpv4(value);
|
|
1520
|
-
if (ipv4 !== void 0) return { bits: 32, value: ipv4 };
|
|
1521
|
-
if (!value.includes(":")) return void 0;
|
|
1522
|
-
const halves = value.toLowerCase().split("::");
|
|
1523
|
-
if (halves.length > 2) return void 0;
|
|
1524
|
-
const head = parseIpv6Half(halves[0]);
|
|
1525
|
-
const tail = parseIpv6Half(halves[1] ?? "");
|
|
1526
|
-
if (!head || !tail) return void 0;
|
|
1527
|
-
const compressed = halves.length === 2;
|
|
1528
|
-
const missing = 8 - head.length - tail.length;
|
|
1529
|
-
if (!compressed && missing !== 0 || compressed && missing < 1) return void 0;
|
|
1530
|
-
const segments = [...head, ...Array(missing).fill(0), ...tail];
|
|
1531
|
-
const address = segments.reduce((result, segment) => result << 16n | BigInt(segment), 0n);
|
|
1532
|
-
if (address >> 32n === 0xffffn) {
|
|
1533
|
-
return { bits: 32, value: address & 0xffffffffn };
|
|
1534
|
-
}
|
|
1535
|
-
return { bits: 128, value: address };
|
|
1536
|
-
}
|
|
1537
|
-
function parseIpv4(value) {
|
|
1538
|
-
const parts = value.split(".");
|
|
1539
|
-
if (parts.length !== 4 || parts.some((part) => !/^\d+$/.test(part))) return void 0;
|
|
1540
|
-
const octets = parts.map(Number);
|
|
1541
|
-
if (octets.some((octet) => octet < 0 || octet > 255)) return void 0;
|
|
1542
|
-
return octets.reduce((result, octet) => result << 8n | BigInt(octet), 0n);
|
|
1543
|
-
}
|
|
1544
|
-
function parseIpv6Half(value) {
|
|
1545
|
-
if (value === "") return [];
|
|
1546
|
-
const parts = value.split(":");
|
|
1547
|
-
if (parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) return void 0;
|
|
1548
|
-
return parts.map((part) => Number.parseInt(part, 16));
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
// src/resources/text-to-video.ts
|
|
43
|
+
var import_internal = require("@runapi.ai/core/internal");
|
|
1552
44
|
var ENDPOINT = "/api/v1/kling/text_to_video";
|
|
1553
|
-
var V26_MODEL = "kling-v2.6";
|
|
1554
|
-
var V3_TURBO_MODEL = "kling-v3-turbo-text-to-video";
|
|
1555
|
-
var V3_TURBO_UNSUPPORTED_FIELDS = [
|
|
1556
|
-
"enable_sound",
|
|
1557
|
-
"negative_prompt",
|
|
1558
|
-
"cfg_scale",
|
|
1559
|
-
"multi_shots",
|
|
1560
|
-
"multi_prompt",
|
|
1561
|
-
"first_frame_image_url",
|
|
1562
|
-
"last_frame_image_url",
|
|
1563
|
-
"kling_elements"
|
|
1564
|
-
];
|
|
1565
45
|
var TextToVideo = class {
|
|
1566
46
|
constructor(http) {
|
|
1567
47
|
this.http = http;
|
|
@@ -1588,11 +68,7 @@ var TextToVideo = class {
|
|
|
1588
68
|
* @returns The task creation result with id.
|
|
1589
69
|
*/
|
|
1590
70
|
async create(params, options) {
|
|
1591
|
-
const body = (0,
|
|
1592
|
-
rejectUnsupportedV3TurboFields(body);
|
|
1593
|
-
(0, import_core2.validateParams)(contract["text-to-video"], body);
|
|
1594
|
-
validateV26Params(body);
|
|
1595
|
-
validateKlingO1References(body);
|
|
71
|
+
const body = (0, import_core.compactParams)(params);
|
|
1596
72
|
return this.http.request("POST", ENDPOINT, {
|
|
1597
73
|
body,
|
|
1598
74
|
...options
|
|
@@ -1610,48 +86,11 @@ var TextToVideo = class {
|
|
|
1610
86
|
});
|
|
1611
87
|
}
|
|
1612
88
|
};
|
|
1613
|
-
function validateV26Params(body) {
|
|
1614
|
-
if (body.model !== V26_MODEL) return;
|
|
1615
|
-
if (body.enable_sound === true && body.mode !== "pro") {
|
|
1616
|
-
throw new import_core2.ValidationError(`enable_sound requires mode pro for ${V26_MODEL}`);
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
function rejectUnsupportedV3TurboFields(body) {
|
|
1620
|
-
if (body.model !== V3_TURBO_MODEL) return;
|
|
1621
|
-
const field = V3_TURBO_UNSUPPORTED_FIELDS.find((candidate) => fieldPresent(body, candidate));
|
|
1622
|
-
if (field) {
|
|
1623
|
-
throw new import_core2.ValidationError(`${field} is not supported by ${V3_TURBO_MODEL}`);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
function fieldPresent(params, field) {
|
|
1627
|
-
if (!(field in params)) return false;
|
|
1628
|
-
const value = params[field];
|
|
1629
|
-
if (value === false) return true;
|
|
1630
|
-
if (Array.isArray(value)) return value.some((item) => presentValue(item));
|
|
1631
|
-
return presentValue(value);
|
|
1632
|
-
}
|
|
1633
|
-
function presentValue(value) {
|
|
1634
|
-
if (value === null || value === void 0 || value === false) return false;
|
|
1635
|
-
if (value === true) return true;
|
|
1636
|
-
if (typeof value === "string") return value.trim() !== "";
|
|
1637
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
1638
|
-
if (typeof value === "object") return Object.keys(value).length > 0;
|
|
1639
|
-
return true;
|
|
1640
|
-
}
|
|
1641
89
|
|
|
1642
90
|
// src/resources/image-to-video.ts
|
|
1643
|
-
var
|
|
91
|
+
var import_core2 = require("@runapi.ai/core");
|
|
1644
92
|
var import_internal2 = require("@runapi.ai/core/internal");
|
|
1645
93
|
var ENDPOINT2 = "/api/v1/kling/image_to_video";
|
|
1646
|
-
var V26_MODEL2 = "kling-v2.6";
|
|
1647
|
-
var V3_OMNI_MODEL = "kling-v3-omni";
|
|
1648
|
-
var V3_TURBO_MODEL2 = "kling-v3-turbo-image-to-video";
|
|
1649
|
-
var V3_TURBO_UNSUPPORTED_FIELDS2 = [
|
|
1650
|
-
"aspect_ratio",
|
|
1651
|
-
"negative_prompt",
|
|
1652
|
-
"cfg_scale",
|
|
1653
|
-
"last_frame_image_url"
|
|
1654
|
-
];
|
|
1655
94
|
var ImageToVideo = class {
|
|
1656
95
|
constructor(http) {
|
|
1657
96
|
this.http = http;
|
|
@@ -1678,12 +117,7 @@ var ImageToVideo = class {
|
|
|
1678
117
|
* @returns The task creation result with id.
|
|
1679
118
|
*/
|
|
1680
119
|
async create(params, options) {
|
|
1681
|
-
const body = (0,
|
|
1682
|
-
rejectUnsupportedV3TurboFields2(body);
|
|
1683
|
-
(0, import_core3.validateParams)(contract["image-to-video"], body);
|
|
1684
|
-
validateV26Params2(body);
|
|
1685
|
-
validateV3OmniFields(body);
|
|
1686
|
-
validateKlingO1References(body);
|
|
120
|
+
const body = (0, import_core2.compactParams)(params);
|
|
1687
121
|
return this.http.request("POST", ENDPOINT2, {
|
|
1688
122
|
body,
|
|
1689
123
|
...options
|
|
@@ -1701,50 +135,9 @@ var ImageToVideo = class {
|
|
|
1701
135
|
});
|
|
1702
136
|
}
|
|
1703
137
|
};
|
|
1704
|
-
function validateV26Params2(body) {
|
|
1705
|
-
if (body.model !== V26_MODEL2) return;
|
|
1706
|
-
if (body.enable_sound === true && body.mode !== "pro") {
|
|
1707
|
-
throw new import_core3.ValidationError(`enable_sound requires mode pro for ${V26_MODEL2}`);
|
|
1708
|
-
}
|
|
1709
|
-
if (!fieldPresent2(body, "last_frame_image_url")) return;
|
|
1710
|
-
if (body.mode !== "pro") {
|
|
1711
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires mode pro for ${V26_MODEL2}`);
|
|
1712
|
-
}
|
|
1713
|
-
if (body.duration_seconds !== void 0 && body.duration_seconds !== 5) {
|
|
1714
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL2}`);
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
function validateV3OmniFields(body) {
|
|
1718
|
-
if (body.model !== V3_OMNI_MODEL || !fieldPresent2(body, "last_frame_image_url")) return;
|
|
1719
|
-
if ((body.duration_seconds ?? 5) !== 5) {
|
|
1720
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires duration_seconds 5 for ${V3_OMNI_MODEL}`);
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
function rejectUnsupportedV3TurboFields2(body) {
|
|
1724
|
-
if (body.model !== V3_TURBO_MODEL2) return;
|
|
1725
|
-
const field = V3_TURBO_UNSUPPORTED_FIELDS2.find((candidate) => fieldPresent2(body, candidate));
|
|
1726
|
-
if (field) {
|
|
1727
|
-
throw new import_core3.ValidationError(`${field} is not supported by ${V3_TURBO_MODEL2}`);
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
function fieldPresent2(params, field) {
|
|
1731
|
-
if (!(field in params)) return false;
|
|
1732
|
-
const value = params[field];
|
|
1733
|
-
if (value === false) return true;
|
|
1734
|
-
if (Array.isArray(value)) return value.some((item) => presentValue2(item));
|
|
1735
|
-
return presentValue2(value);
|
|
1736
|
-
}
|
|
1737
|
-
function presentValue2(value) {
|
|
1738
|
-
if (value === null || value === void 0 || value === false) return false;
|
|
1739
|
-
if (value === true) return true;
|
|
1740
|
-
if (typeof value === "string") return value.trim() !== "";
|
|
1741
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
1742
|
-
if (typeof value === "object") return Object.keys(value).length > 0;
|
|
1743
|
-
return true;
|
|
1744
|
-
}
|
|
1745
138
|
|
|
1746
139
|
// src/resources/ai-avatar.ts
|
|
1747
|
-
var
|
|
140
|
+
var import_core3 = require("@runapi.ai/core");
|
|
1748
141
|
var import_internal3 = require("@runapi.ai/core/internal");
|
|
1749
142
|
var ENDPOINT3 = "/api/v1/kling/ai_avatar";
|
|
1750
143
|
var AiAvatar = class {
|
|
@@ -1773,8 +166,7 @@ var AiAvatar = class {
|
|
|
1773
166
|
* @returns The task creation result with id.
|
|
1774
167
|
*/
|
|
1775
168
|
async create(params, options) {
|
|
1776
|
-
const body = (0,
|
|
1777
|
-
(0, import_core4.validateParams)(contract["avatar"], body);
|
|
169
|
+
const body = (0, import_core3.compactParams)(params);
|
|
1778
170
|
return this.http.request("POST", ENDPOINT3, {
|
|
1779
171
|
body,
|
|
1780
172
|
...options
|
|
@@ -1794,7 +186,7 @@ var AiAvatar = class {
|
|
|
1794
186
|
};
|
|
1795
187
|
|
|
1796
188
|
// src/resources/motion-control.ts
|
|
1797
|
-
var
|
|
189
|
+
var import_core4 = require("@runapi.ai/core");
|
|
1798
190
|
var import_internal4 = require("@runapi.ai/core/internal");
|
|
1799
191
|
var ENDPOINT4 = "/api/v1/kling/motion_control";
|
|
1800
192
|
var MotionControl = class {
|
|
@@ -1823,8 +215,7 @@ var MotionControl = class {
|
|
|
1823
215
|
* @returns The task creation result with id.
|
|
1824
216
|
*/
|
|
1825
217
|
async create(params, options) {
|
|
1826
|
-
const body = (0,
|
|
1827
|
-
(0, import_core5.validateParams)(contract["motion-control"], body);
|
|
218
|
+
const body = (0, import_core4.compactParams)(params);
|
|
1828
219
|
return this.http.request("POST", ENDPOINT4, {
|
|
1829
220
|
body,
|
|
1830
221
|
...options
|
|
@@ -1844,7 +235,7 @@ var MotionControl = class {
|
|
|
1844
235
|
};
|
|
1845
236
|
|
|
1846
237
|
// src/resources/extend-video.ts
|
|
1847
|
-
var
|
|
238
|
+
var import_core5 = require("@runapi.ai/core");
|
|
1848
239
|
var import_internal5 = require("@runapi.ai/core/internal");
|
|
1849
240
|
var ENDPOINT5 = "/api/v1/kling/extend_video";
|
|
1850
241
|
var ExtendVideo = class {
|
|
@@ -1860,8 +251,7 @@ var ExtendVideo = class {
|
|
|
1860
251
|
});
|
|
1861
252
|
}
|
|
1862
253
|
async create(params, options) {
|
|
1863
|
-
const body = (0,
|
|
1864
|
-
(0, import_core6.validateParams)(contract["extend-video"], body);
|
|
254
|
+
const body = (0, import_core5.compactParams)(params);
|
|
1865
255
|
return this.http.request("POST", ENDPOINT5, { body, ...options });
|
|
1866
256
|
}
|
|
1867
257
|
async get(id, options) {
|
|
@@ -1870,7 +260,7 @@ var ExtendVideo = class {
|
|
|
1870
260
|
};
|
|
1871
261
|
|
|
1872
262
|
// src/resources/edit-video.ts
|
|
1873
|
-
var
|
|
263
|
+
var import_core6 = require("@runapi.ai/core");
|
|
1874
264
|
var import_internal6 = require("@runapi.ai/core/internal");
|
|
1875
265
|
var ENDPOINT6 = "/api/v1/kling/edit_video";
|
|
1876
266
|
var EditVideo = class {
|
|
@@ -1886,8 +276,7 @@ var EditVideo = class {
|
|
|
1886
276
|
});
|
|
1887
277
|
}
|
|
1888
278
|
async create(params, options) {
|
|
1889
|
-
const body = (0,
|
|
1890
|
-
(0, import_core7.validateParams)(contract["edit-video"], body);
|
|
279
|
+
const body = (0, import_core6.compactParams)(params);
|
|
1891
280
|
return this.http.request("POST", ENDPOINT6, { body, ...options });
|
|
1892
281
|
}
|
|
1893
282
|
async get(id, options) {
|
|
@@ -1896,7 +285,7 @@ var EditVideo = class {
|
|
|
1896
285
|
};
|
|
1897
286
|
|
|
1898
287
|
// src/client.ts
|
|
1899
|
-
var KlingClient = class extends
|
|
288
|
+
var KlingClient = class extends import_core7.BaseClient {
|
|
1900
289
|
/** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
|
|
1901
290
|
textToVideo;
|
|
1902
291
|
/** Image-to-video animation from a first-frame image guided by a text prompt. */
|
|
@@ -1920,7 +309,7 @@ var KlingClient = class extends import_core8.BaseClient {
|
|
|
1920
309
|
};
|
|
1921
310
|
|
|
1922
311
|
// src/index.ts
|
|
1923
|
-
var
|
|
312
|
+
var import_core8 = require("@runapi.ai/core");
|
|
1924
313
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1925
314
|
0 && (module.exports = {
|
|
1926
315
|
AuthenticationError,
|