@runapi.ai/kling 0.4.0 → 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.js +26 -1675
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1657
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -20,1596 +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_video_url": {
|
|
221
|
-
"present": true
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"forbidden": [
|
|
225
|
-
"source_task_id"
|
|
226
|
-
]
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
"when": {
|
|
230
|
-
"model": "kling-v3-omni-edit",
|
|
231
|
-
"source_task_id": {
|
|
232
|
-
"present": true
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
"forbidden": [
|
|
236
|
-
"source_video_url"
|
|
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_video_url": {
|
|
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
|
-
"auto"
|
|
265
|
-
],
|
|
266
|
-
"duration_seconds": [
|
|
267
|
-
5
|
|
268
|
-
]
|
|
269
|
-
},
|
|
270
|
-
"when": {
|
|
271
|
-
"model": "kling-v3-omni-edit",
|
|
272
|
-
"source_task_id": {
|
|
273
|
-
"present": true
|
|
274
|
-
},
|
|
275
|
-
"reference_image_urls": {
|
|
276
|
-
"present": false
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
"required": [
|
|
280
|
-
"aspect_ratio"
|
|
281
|
-
]
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"enum": {
|
|
285
|
-
"aspect_ratio": [
|
|
286
|
-
"16:9",
|
|
287
|
-
"9:16",
|
|
288
|
-
"1:1"
|
|
289
|
-
]
|
|
290
|
-
},
|
|
291
|
-
"when": {
|
|
292
|
-
"model": "kling-v3-omni-edit",
|
|
293
|
-
"source_video_url": {
|
|
294
|
-
"present": true
|
|
295
|
-
},
|
|
296
|
-
"reference_image_urls": {
|
|
297
|
-
"present": true
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
"required": [
|
|
301
|
-
"aspect_ratio"
|
|
302
|
-
]
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"enum": {
|
|
306
|
-
"aspect_ratio": [
|
|
307
|
-
"16:9",
|
|
308
|
-
"9:16",
|
|
309
|
-
"1:1"
|
|
310
|
-
]
|
|
311
|
-
},
|
|
312
|
-
"when": {
|
|
313
|
-
"model": "kling-v3-omni-edit",
|
|
314
|
-
"source_task_id": {
|
|
315
|
-
"present": true
|
|
316
|
-
},
|
|
317
|
-
"reference_image_urls": {
|
|
318
|
-
"present": true
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
"required": [
|
|
322
|
-
"aspect_ratio"
|
|
323
|
-
]
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"when": {
|
|
327
|
-
"model": "kling-v3-omni-edit",
|
|
328
|
-
"source_task_id": {
|
|
329
|
-
"present": false
|
|
330
|
-
},
|
|
331
|
-
"source_video_url": {
|
|
332
|
-
"present": false
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
"required_any": [
|
|
336
|
-
"source_video_url",
|
|
337
|
-
"source_task_id"
|
|
338
|
-
]
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
"enum": {
|
|
342
|
-
"aspect_ratio": [
|
|
343
|
-
"16:9",
|
|
344
|
-
"9:16",
|
|
345
|
-
"1:1"
|
|
346
|
-
],
|
|
347
|
-
"enable_sound": [
|
|
348
|
-
false
|
|
349
|
-
]
|
|
350
|
-
},
|
|
351
|
-
"when": {
|
|
352
|
-
"model": "kling-v3-omni-reference",
|
|
353
|
-
"source_task_id": {
|
|
354
|
-
"present": true
|
|
355
|
-
},
|
|
356
|
-
"reference_image_urls": {
|
|
357
|
-
"present": true
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
"required": [
|
|
361
|
-
"aspect_ratio"
|
|
362
|
-
]
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
"when": {
|
|
366
|
-
"model": "kling-v3-omni-reference",
|
|
367
|
-
"source_task_id": {
|
|
368
|
-
"present": false
|
|
369
|
-
},
|
|
370
|
-
"source_video_url": {
|
|
371
|
-
"present": false
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
"required_any": [
|
|
375
|
-
"source_video_url",
|
|
376
|
-
"source_task_id"
|
|
377
|
-
]
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
"when": {
|
|
381
|
-
"model": "kling-v3-omni-reference",
|
|
382
|
-
"source_video_url": {
|
|
383
|
-
"present": true
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
"forbidden": [
|
|
387
|
-
"source_task_id"
|
|
388
|
-
]
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
"when": {
|
|
392
|
-
"model": "kling-v3-omni-reference",
|
|
393
|
-
"source_task_id": {
|
|
394
|
-
"present": true
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
"forbidden": [
|
|
398
|
-
"source_video_url"
|
|
399
|
-
]
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"enum": {
|
|
403
|
-
"aspect_ratio": [
|
|
404
|
-
"auto"
|
|
405
|
-
],
|
|
406
|
-
"enable_sound": [
|
|
407
|
-
false
|
|
408
|
-
],
|
|
409
|
-
"duration_seconds": [
|
|
410
|
-
5
|
|
411
|
-
]
|
|
412
|
-
},
|
|
413
|
-
"when": {
|
|
414
|
-
"model": "kling-v3-omni-reference",
|
|
415
|
-
"source_video_url": {
|
|
416
|
-
"present": true
|
|
417
|
-
},
|
|
418
|
-
"reference_image_urls": {
|
|
419
|
-
"present": false
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
"required": [
|
|
423
|
-
"aspect_ratio"
|
|
424
|
-
]
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"enum": {
|
|
428
|
-
"aspect_ratio": [
|
|
429
|
-
"auto"
|
|
430
|
-
],
|
|
431
|
-
"enable_sound": [
|
|
432
|
-
false
|
|
433
|
-
],
|
|
434
|
-
"duration_seconds": [
|
|
435
|
-
5
|
|
436
|
-
]
|
|
437
|
-
},
|
|
438
|
-
"when": {
|
|
439
|
-
"model": "kling-v3-omni-reference",
|
|
440
|
-
"source_task_id": {
|
|
441
|
-
"present": true
|
|
442
|
-
},
|
|
443
|
-
"reference_image_urls": {
|
|
444
|
-
"present": false
|
|
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_video_url": {
|
|
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
|
-
"enum": {
|
|
818
|
-
"enable_sound": [
|
|
819
|
-
false
|
|
820
|
-
]
|
|
821
|
-
},
|
|
822
|
-
"when": {
|
|
823
|
-
"mode": "std",
|
|
824
|
-
"model": "kling-v2.6"
|
|
825
|
-
}
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
"when": {
|
|
829
|
-
"model": "kling-v2.6"
|
|
830
|
-
},
|
|
831
|
-
"forbidden": [
|
|
832
|
-
"output_resolution",
|
|
833
|
-
"negative_prompt",
|
|
834
|
-
"cfg_scale",
|
|
835
|
-
"reference_image_urls",
|
|
836
|
-
"reference_video_url",
|
|
837
|
-
"reference_video_type",
|
|
838
|
-
"preserve_reference_video_audio"
|
|
839
|
-
]
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
"enum": {
|
|
843
|
-
"enable_sound": [
|
|
844
|
-
false
|
|
845
|
-
]
|
|
846
|
-
},
|
|
847
|
-
"when": {
|
|
848
|
-
"mode": {
|
|
849
|
-
"present": false
|
|
850
|
-
},
|
|
851
|
-
"model": "kling-v2.6"
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
"when": {
|
|
856
|
-
"model": "kling-v3-omni"
|
|
857
|
-
},
|
|
858
|
-
"forbidden": [
|
|
859
|
-
"negative_prompt",
|
|
860
|
-
"cfg_scale",
|
|
861
|
-
"reference_image_urls",
|
|
862
|
-
"reference_video_url",
|
|
863
|
-
"reference_video_type",
|
|
864
|
-
"preserve_reference_video_audio"
|
|
865
|
-
]
|
|
866
|
-
},
|
|
867
|
-
{
|
|
868
|
-
"when": {
|
|
869
|
-
"model": "kling-v3-turbo-image-to-video"
|
|
870
|
-
},
|
|
871
|
-
"forbidden": [
|
|
872
|
-
"enable_sound",
|
|
873
|
-
"aspect_ratio",
|
|
874
|
-
"negative_prompt",
|
|
875
|
-
"cfg_scale",
|
|
876
|
-
"last_frame_image_url",
|
|
877
|
-
"reference_image_urls",
|
|
878
|
-
"reference_video_url",
|
|
879
|
-
"reference_video_type",
|
|
880
|
-
"preserve_reference_video_audio"
|
|
881
|
-
]
|
|
882
|
-
}
|
|
883
|
-
]
|
|
884
|
-
},
|
|
885
|
-
"motion-control": {
|
|
886
|
-
"models": [
|
|
887
|
-
"kling-3.0",
|
|
888
|
-
"kling-v2.6"
|
|
889
|
-
],
|
|
890
|
-
"fields_by_model": {
|
|
891
|
-
"kling-3.0": {
|
|
892
|
-
"background_source": {
|
|
893
|
-
"enum": [
|
|
894
|
-
"video",
|
|
895
|
-
"image"
|
|
896
|
-
]
|
|
897
|
-
},
|
|
898
|
-
"character_orientation": {
|
|
899
|
-
"enum": [
|
|
900
|
-
"video",
|
|
901
|
-
"image"
|
|
902
|
-
]
|
|
903
|
-
},
|
|
904
|
-
"model": {
|
|
905
|
-
"required": true
|
|
906
|
-
},
|
|
907
|
-
"output_resolution": {
|
|
908
|
-
"enum": [
|
|
909
|
-
"720p",
|
|
910
|
-
"1080p"
|
|
911
|
-
],
|
|
912
|
-
"required": true
|
|
913
|
-
},
|
|
914
|
-
"reference_video_url": {
|
|
915
|
-
"required": true
|
|
916
|
-
},
|
|
917
|
-
"source_image_url": {
|
|
918
|
-
"required": true
|
|
919
|
-
}
|
|
920
|
-
},
|
|
921
|
-
"kling-v2.6": {
|
|
922
|
-
"character_orientation": {
|
|
923
|
-
"enum": [
|
|
924
|
-
"video",
|
|
925
|
-
"image"
|
|
926
|
-
],
|
|
927
|
-
"required": true
|
|
928
|
-
},
|
|
929
|
-
"model": {
|
|
930
|
-
"required": true
|
|
931
|
-
},
|
|
932
|
-
"output_resolution": {
|
|
933
|
-
"enum": [
|
|
934
|
-
"720p",
|
|
935
|
-
"1080p"
|
|
936
|
-
],
|
|
937
|
-
"required": true
|
|
938
|
-
},
|
|
939
|
-
"prompt": {
|
|
940
|
-
"max": 2500,
|
|
941
|
-
"length": true
|
|
942
|
-
},
|
|
943
|
-
"reference_video_url": {
|
|
944
|
-
"required": true
|
|
945
|
-
},
|
|
946
|
-
"source_image_url": {
|
|
947
|
-
"required": true
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
},
|
|
951
|
-
"rules": [
|
|
952
|
-
{
|
|
953
|
-
"when": {
|
|
954
|
-
"model": "kling-v2.6"
|
|
955
|
-
},
|
|
956
|
-
"forbidden": [
|
|
957
|
-
"background_source"
|
|
958
|
-
]
|
|
959
|
-
}
|
|
960
|
-
]
|
|
961
|
-
},
|
|
962
|
-
"text-to-video": {
|
|
963
|
-
"models": [
|
|
964
|
-
"kling-3.0",
|
|
965
|
-
"kling-o1",
|
|
966
|
-
"kling-v2.1-master-text-to-video",
|
|
967
|
-
"kling-v2.5-turbo-text-to-video-pro",
|
|
968
|
-
"kling-v2.6",
|
|
969
|
-
"kling-v3-omni",
|
|
970
|
-
"kling-v3-omni-reference",
|
|
971
|
-
"kling-v3-turbo-text-to-video"
|
|
972
|
-
],
|
|
973
|
-
"fields_by_model": {
|
|
974
|
-
"kling-3.0": {
|
|
975
|
-
"aspect_ratio": {
|
|
976
|
-
"enum": [
|
|
977
|
-
"16:9",
|
|
978
|
-
"9:16",
|
|
979
|
-
"1:1"
|
|
980
|
-
]
|
|
981
|
-
},
|
|
982
|
-
"duration_seconds": {
|
|
983
|
-
"enum": [
|
|
984
|
-
3,
|
|
985
|
-
4,
|
|
986
|
-
5,
|
|
987
|
-
6,
|
|
988
|
-
7,
|
|
989
|
-
8,
|
|
990
|
-
9,
|
|
991
|
-
10,
|
|
992
|
-
11,
|
|
993
|
-
12,
|
|
994
|
-
13,
|
|
995
|
-
14,
|
|
996
|
-
15
|
|
997
|
-
],
|
|
998
|
-
"type": "integer"
|
|
999
|
-
},
|
|
1000
|
-
"model": {
|
|
1001
|
-
"required": true
|
|
1002
|
-
},
|
|
1003
|
-
"output_resolution": {
|
|
1004
|
-
"enum": [
|
|
1005
|
-
"720p",
|
|
1006
|
-
"1080p",
|
|
1007
|
-
"4k"
|
|
1008
|
-
]
|
|
1009
|
-
}
|
|
1010
|
-
},
|
|
1011
|
-
"kling-o1": {
|
|
1012
|
-
"aspect_ratio": {
|
|
1013
|
-
"enum": [
|
|
1014
|
-
"16:9",
|
|
1015
|
-
"9:16",
|
|
1016
|
-
"1:1"
|
|
1017
|
-
]
|
|
1018
|
-
},
|
|
1019
|
-
"duration_seconds": {
|
|
1020
|
-
"enum": [
|
|
1021
|
-
5
|
|
1022
|
-
],
|
|
1023
|
-
"type": "integer"
|
|
1024
|
-
},
|
|
1025
|
-
"mode": {
|
|
1026
|
-
"enum": [
|
|
1027
|
-
"std",
|
|
1028
|
-
"pro"
|
|
1029
|
-
]
|
|
1030
|
-
},
|
|
1031
|
-
"model": {
|
|
1032
|
-
"required": true
|
|
1033
|
-
},
|
|
1034
|
-
"prompt": {
|
|
1035
|
-
"required": true,
|
|
1036
|
-
"min": 1,
|
|
1037
|
-
"max": 2500,
|
|
1038
|
-
"length": true
|
|
1039
|
-
},
|
|
1040
|
-
"reference_image_urls": {
|
|
1041
|
-
"min_items": 1,
|
|
1042
|
-
"max_items": 7
|
|
1043
|
-
},
|
|
1044
|
-
"reference_video_type": {
|
|
1045
|
-
"enum": [
|
|
1046
|
-
"base",
|
|
1047
|
-
"feature"
|
|
1048
|
-
]
|
|
1049
|
-
}
|
|
1050
|
-
},
|
|
1051
|
-
"kling-v2.1-master-text-to-video": {
|
|
1052
|
-
"aspect_ratio": {
|
|
1053
|
-
"enum": [
|
|
1054
|
-
"16:9",
|
|
1055
|
-
"9:16",
|
|
1056
|
-
"1:1"
|
|
1057
|
-
]
|
|
1058
|
-
},
|
|
1059
|
-
"duration_seconds": {
|
|
1060
|
-
"enum": [
|
|
1061
|
-
5,
|
|
1062
|
-
10
|
|
1063
|
-
],
|
|
1064
|
-
"type": "integer"
|
|
1065
|
-
},
|
|
1066
|
-
"model": {
|
|
1067
|
-
"required": true
|
|
1068
|
-
}
|
|
1069
|
-
},
|
|
1070
|
-
"kling-v2.5-turbo-text-to-video-pro": {
|
|
1071
|
-
"aspect_ratio": {
|
|
1072
|
-
"enum": [
|
|
1073
|
-
"16:9",
|
|
1074
|
-
"9:16",
|
|
1075
|
-
"1:1"
|
|
1076
|
-
]
|
|
1077
|
-
},
|
|
1078
|
-
"duration_seconds": {
|
|
1079
|
-
"enum": [
|
|
1080
|
-
5,
|
|
1081
|
-
10
|
|
1082
|
-
],
|
|
1083
|
-
"type": "integer"
|
|
1084
|
-
},
|
|
1085
|
-
"model": {
|
|
1086
|
-
"required": true
|
|
1087
|
-
}
|
|
1088
|
-
},
|
|
1089
|
-
"kling-v2.6": {
|
|
1090
|
-
"aspect_ratio": {
|
|
1091
|
-
"enum": [
|
|
1092
|
-
"16:9",
|
|
1093
|
-
"9:16",
|
|
1094
|
-
"1:1"
|
|
1095
|
-
]
|
|
1096
|
-
},
|
|
1097
|
-
"duration_seconds": {
|
|
1098
|
-
"enum": [
|
|
1099
|
-
5,
|
|
1100
|
-
10
|
|
1101
|
-
],
|
|
1102
|
-
"type": "integer"
|
|
1103
|
-
},
|
|
1104
|
-
"mode": {
|
|
1105
|
-
"enum": [
|
|
1106
|
-
"std",
|
|
1107
|
-
"pro"
|
|
1108
|
-
]
|
|
1109
|
-
},
|
|
1110
|
-
"model": {
|
|
1111
|
-
"required": true
|
|
1112
|
-
},
|
|
1113
|
-
"prompt": {
|
|
1114
|
-
"required": true,
|
|
1115
|
-
"min": 1,
|
|
1116
|
-
"max": 2500,
|
|
1117
|
-
"length": true
|
|
1118
|
-
}
|
|
1119
|
-
},
|
|
1120
|
-
"kling-v3-omni": {
|
|
1121
|
-
"aspect_ratio": {
|
|
1122
|
-
"enum": [
|
|
1123
|
-
"16:9",
|
|
1124
|
-
"9:16",
|
|
1125
|
-
"1:1"
|
|
1126
|
-
]
|
|
1127
|
-
},
|
|
1128
|
-
"duration_seconds": {
|
|
1129
|
-
"enum": [
|
|
1130
|
-
3,
|
|
1131
|
-
4,
|
|
1132
|
-
5,
|
|
1133
|
-
6,
|
|
1134
|
-
7,
|
|
1135
|
-
8,
|
|
1136
|
-
9,
|
|
1137
|
-
10,
|
|
1138
|
-
11,
|
|
1139
|
-
12,
|
|
1140
|
-
13,
|
|
1141
|
-
14,
|
|
1142
|
-
15
|
|
1143
|
-
],
|
|
1144
|
-
"type": "integer"
|
|
1145
|
-
},
|
|
1146
|
-
"model": {
|
|
1147
|
-
"required": true
|
|
1148
|
-
},
|
|
1149
|
-
"output_resolution": {
|
|
1150
|
-
"enum": [
|
|
1151
|
-
"720p",
|
|
1152
|
-
"1080p",
|
|
1153
|
-
"4k"
|
|
1154
|
-
]
|
|
1155
|
-
},
|
|
1156
|
-
"prompt": {
|
|
1157
|
-
"required": true,
|
|
1158
|
-
"min": 1,
|
|
1159
|
-
"max": 2500,
|
|
1160
|
-
"length": true
|
|
1161
|
-
}
|
|
1162
|
-
},
|
|
1163
|
-
"kling-v3-omni-reference": {
|
|
1164
|
-
"aspect_ratio": {
|
|
1165
|
-
"enum": [
|
|
1166
|
-
"16:9",
|
|
1167
|
-
"9:16",
|
|
1168
|
-
"1:1"
|
|
1169
|
-
],
|
|
1170
|
-
"required": true
|
|
1171
|
-
},
|
|
1172
|
-
"duration_seconds": {
|
|
1173
|
-
"enum": [
|
|
1174
|
-
3,
|
|
1175
|
-
4,
|
|
1176
|
-
5,
|
|
1177
|
-
6,
|
|
1178
|
-
7,
|
|
1179
|
-
8,
|
|
1180
|
-
9,
|
|
1181
|
-
10,
|
|
1182
|
-
11,
|
|
1183
|
-
12,
|
|
1184
|
-
13,
|
|
1185
|
-
14,
|
|
1186
|
-
15
|
|
1187
|
-
],
|
|
1188
|
-
"type": "integer"
|
|
1189
|
-
},
|
|
1190
|
-
"model": {
|
|
1191
|
-
"required": true
|
|
1192
|
-
},
|
|
1193
|
-
"output_resolution": {
|
|
1194
|
-
"enum": [
|
|
1195
|
-
"720p",
|
|
1196
|
-
"1080p",
|
|
1197
|
-
"4k"
|
|
1198
|
-
]
|
|
1199
|
-
},
|
|
1200
|
-
"prompt": {
|
|
1201
|
-
"required": true,
|
|
1202
|
-
"min": 1,
|
|
1203
|
-
"max": 2500,
|
|
1204
|
-
"length": true
|
|
1205
|
-
},
|
|
1206
|
-
"reference_image_urls": {
|
|
1207
|
-
"required": true,
|
|
1208
|
-
"min_items": 1,
|
|
1209
|
-
"max_items": 7
|
|
1210
|
-
}
|
|
1211
|
-
},
|
|
1212
|
-
"kling-v3-turbo-text-to-video": {
|
|
1213
|
-
"aspect_ratio": {
|
|
1214
|
-
"enum": [
|
|
1215
|
-
"16:9",
|
|
1216
|
-
"9:16",
|
|
1217
|
-
"1:1"
|
|
1218
|
-
]
|
|
1219
|
-
},
|
|
1220
|
-
"duration_seconds": {
|
|
1221
|
-
"enum": [
|
|
1222
|
-
3,
|
|
1223
|
-
4,
|
|
1224
|
-
5,
|
|
1225
|
-
6,
|
|
1226
|
-
7,
|
|
1227
|
-
8,
|
|
1228
|
-
9,
|
|
1229
|
-
10,
|
|
1230
|
-
11,
|
|
1231
|
-
12,
|
|
1232
|
-
13,
|
|
1233
|
-
14,
|
|
1234
|
-
15
|
|
1235
|
-
],
|
|
1236
|
-
"type": "integer"
|
|
1237
|
-
},
|
|
1238
|
-
"model": {
|
|
1239
|
-
"required": true
|
|
1240
|
-
},
|
|
1241
|
-
"output_resolution": {
|
|
1242
|
-
"enum": [
|
|
1243
|
-
"720p",
|
|
1244
|
-
"1080p"
|
|
1245
|
-
]
|
|
1246
|
-
},
|
|
1247
|
-
"prompt": {
|
|
1248
|
-
"required": true,
|
|
1249
|
-
"min": 1,
|
|
1250
|
-
"max": 2500,
|
|
1251
|
-
"length": true
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
},
|
|
1255
|
-
"rules": [
|
|
1256
|
-
{
|
|
1257
|
-
"when": {
|
|
1258
|
-
"model": "kling-3.0"
|
|
1259
|
-
},
|
|
1260
|
-
"forbidden": [
|
|
1261
|
-
"reference_image_urls",
|
|
1262
|
-
"reference_video_url",
|
|
1263
|
-
"reference_video_type",
|
|
1264
|
-
"preserve_reference_video_audio"
|
|
1265
|
-
]
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1268
|
-
"when": {
|
|
1269
|
-
"model": "kling-o1"
|
|
1270
|
-
},
|
|
1271
|
-
"forbidden": [
|
|
1272
|
-
"output_resolution",
|
|
1273
|
-
"negative_prompt",
|
|
1274
|
-
"cfg_scale",
|
|
1275
|
-
"multi_shots",
|
|
1276
|
-
"multi_prompt",
|
|
1277
|
-
"first_frame_image_url",
|
|
1278
|
-
"last_frame_image_url",
|
|
1279
|
-
"kling_elements"
|
|
1280
|
-
]
|
|
1281
|
-
},
|
|
1282
|
-
{
|
|
1283
|
-
"when": {
|
|
1284
|
-
"model": "kling-v2.1-master-text-to-video"
|
|
1285
|
-
},
|
|
1286
|
-
"forbidden": [
|
|
1287
|
-
"mode",
|
|
1288
|
-
"reference_image_urls",
|
|
1289
|
-
"reference_video_url",
|
|
1290
|
-
"reference_video_type",
|
|
1291
|
-
"preserve_reference_video_audio"
|
|
1292
|
-
]
|
|
1293
|
-
},
|
|
1294
|
-
{
|
|
1295
|
-
"when": {
|
|
1296
|
-
"model": "kling-v2.5-turbo-text-to-video-pro"
|
|
1297
|
-
},
|
|
1298
|
-
"forbidden": [
|
|
1299
|
-
"mode",
|
|
1300
|
-
"reference_image_urls",
|
|
1301
|
-
"reference_video_url",
|
|
1302
|
-
"reference_video_type",
|
|
1303
|
-
"preserve_reference_video_audio"
|
|
1304
|
-
]
|
|
1305
|
-
},
|
|
1306
|
-
{
|
|
1307
|
-
"when": {
|
|
1308
|
-
"model": "kling-v2.6"
|
|
1309
|
-
},
|
|
1310
|
-
"forbidden": [
|
|
1311
|
-
"output_resolution",
|
|
1312
|
-
"negative_prompt",
|
|
1313
|
-
"cfg_scale",
|
|
1314
|
-
"multi_shots",
|
|
1315
|
-
"multi_prompt",
|
|
1316
|
-
"first_frame_image_url",
|
|
1317
|
-
"last_frame_image_url",
|
|
1318
|
-
"kling_elements",
|
|
1319
|
-
"reference_image_urls",
|
|
1320
|
-
"reference_video_url",
|
|
1321
|
-
"reference_video_type",
|
|
1322
|
-
"preserve_reference_video_audio"
|
|
1323
|
-
]
|
|
1324
|
-
},
|
|
1325
|
-
{
|
|
1326
|
-
"enum": {
|
|
1327
|
-
"enable_sound": [
|
|
1328
|
-
false
|
|
1329
|
-
]
|
|
1330
|
-
},
|
|
1331
|
-
"when": {
|
|
1332
|
-
"mode": "std",
|
|
1333
|
-
"model": "kling-v2.6"
|
|
1334
|
-
}
|
|
1335
|
-
},
|
|
1336
|
-
{
|
|
1337
|
-
"enum": {
|
|
1338
|
-
"enable_sound": [
|
|
1339
|
-
false
|
|
1340
|
-
]
|
|
1341
|
-
},
|
|
1342
|
-
"when": {
|
|
1343
|
-
"mode": {
|
|
1344
|
-
"present": false
|
|
1345
|
-
},
|
|
1346
|
-
"model": "kling-v2.6"
|
|
1347
|
-
}
|
|
1348
|
-
},
|
|
1349
|
-
{
|
|
1350
|
-
"when": {
|
|
1351
|
-
"model": "kling-v3-omni"
|
|
1352
|
-
},
|
|
1353
|
-
"forbidden": [
|
|
1354
|
-
"negative_prompt",
|
|
1355
|
-
"cfg_scale",
|
|
1356
|
-
"multi_shots",
|
|
1357
|
-
"multi_prompt",
|
|
1358
|
-
"first_frame_image_url",
|
|
1359
|
-
"last_frame_image_url",
|
|
1360
|
-
"kling_elements",
|
|
1361
|
-
"reference_image_urls",
|
|
1362
|
-
"reference_video_url",
|
|
1363
|
-
"reference_video_type",
|
|
1364
|
-
"preserve_reference_video_audio"
|
|
1365
|
-
]
|
|
1366
|
-
},
|
|
1367
|
-
{
|
|
1368
|
-
"when": {
|
|
1369
|
-
"model": "kling-v3-turbo-text-to-video"
|
|
1370
|
-
},
|
|
1371
|
-
"forbidden": [
|
|
1372
|
-
"enable_sound",
|
|
1373
|
-
"negative_prompt",
|
|
1374
|
-
"cfg_scale",
|
|
1375
|
-
"multi_shots",
|
|
1376
|
-
"multi_prompt",
|
|
1377
|
-
"first_frame_image_url",
|
|
1378
|
-
"last_frame_image_url",
|
|
1379
|
-
"kling_elements",
|
|
1380
|
-
"reference_image_urls",
|
|
1381
|
-
"reference_video_url",
|
|
1382
|
-
"reference_video_type",
|
|
1383
|
-
"preserve_reference_video_audio"
|
|
1384
|
-
]
|
|
1385
|
-
}
|
|
1386
|
-
]
|
|
1387
|
-
}
|
|
1388
|
-
};
|
|
1389
|
-
|
|
1390
|
-
// src/resources/o1-reference-validation.ts
|
|
1391
42
|
var import_core = require("@runapi.ai/core");
|
|
1392
|
-
var
|
|
1393
|
-
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png"]);
|
|
1394
|
-
var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov"]);
|
|
1395
|
-
var BLOCKED_IP_CIDRS = [
|
|
1396
|
-
"0.0.0.0/8",
|
|
1397
|
-
"10.0.0.0/8",
|
|
1398
|
-
"100.64.0.0/10",
|
|
1399
|
-
"127.0.0.0/8",
|
|
1400
|
-
"169.254.0.0/16",
|
|
1401
|
-
"172.16.0.0/12",
|
|
1402
|
-
"192.0.0.0/24",
|
|
1403
|
-
"192.0.2.0/24",
|
|
1404
|
-
"192.88.99.0/24",
|
|
1405
|
-
"192.168.0.0/16",
|
|
1406
|
-
"198.18.0.0/15",
|
|
1407
|
-
"198.51.100.0/24",
|
|
1408
|
-
"203.0.113.0/24",
|
|
1409
|
-
"224.0.0.0/4",
|
|
1410
|
-
"240.0.0.0/4",
|
|
1411
|
-
"255.255.255.255/32",
|
|
1412
|
-
"::/128",
|
|
1413
|
-
"::1/128",
|
|
1414
|
-
"64:ff9b::/96",
|
|
1415
|
-
"64:ff9b:1::/48",
|
|
1416
|
-
"100::/64",
|
|
1417
|
-
"2001::/32",
|
|
1418
|
-
"2001:2::/48",
|
|
1419
|
-
"2001:db8::/32",
|
|
1420
|
-
"2002::/16",
|
|
1421
|
-
"3fff::/20",
|
|
1422
|
-
"fc00::/7",
|
|
1423
|
-
"fe80::/10",
|
|
1424
|
-
"ff00::/8"
|
|
1425
|
-
];
|
|
1426
|
-
var BLOCKED_IP_NETWORKS = BLOCKED_IP_CIDRS.map((cidr) => {
|
|
1427
|
-
const [address, prefixText] = cidr.split("/");
|
|
1428
|
-
const parsed = parseIpLiteral(address);
|
|
1429
|
-
if (!parsed) throw new Error("Invalid blocked IP range: " + cidr);
|
|
1430
|
-
return { ...parsed, prefix: Number(prefixText) };
|
|
1431
|
-
});
|
|
1432
|
-
function validateKlingO1References(body) {
|
|
1433
|
-
if (body.model !== O1_MODEL) return;
|
|
1434
|
-
if (body.enable_sound === true) {
|
|
1435
|
-
throw new import_core.ValidationError(`enable_sound is not supported by ${O1_MODEL}`);
|
|
1436
|
-
}
|
|
1437
|
-
validateFrameUrls(body);
|
|
1438
|
-
if (typeof body.prompt !== "string") {
|
|
1439
|
-
throw new import_core.ValidationError("prompt must be a string");
|
|
1440
|
-
}
|
|
1441
|
-
const prompt = body.prompt;
|
|
1442
|
-
const referenceImages = Array.isArray(body.reference_image_urls) ? body.reference_image_urls : [];
|
|
1443
|
-
if ("reference_video_url" in body && typeof body.reference_video_url !== "string") {
|
|
1444
|
-
throw new import_core.ValidationError("reference_video_url must be a string");
|
|
1445
|
-
}
|
|
1446
|
-
const referenceVideoUrl = body.reference_video_url;
|
|
1447
|
-
if (present(body.last_frame_image_url) && (referenceImages.length > 0 || present(referenceVideoUrl))) {
|
|
1448
|
-
throw new import_core.ValidationError(
|
|
1449
|
-
"last_frame_image_url cannot be combined with reference_image_urls or reference_video_url"
|
|
1450
|
-
);
|
|
1451
|
-
}
|
|
1452
|
-
if (referenceVideoUrl && referenceImages.length > 4) {
|
|
1453
|
-
throw new import_core.ValidationError(
|
|
1454
|
-
"reference_image_urls must contain at most 4 items when reference_video_url is present"
|
|
1455
|
-
);
|
|
1456
|
-
}
|
|
1457
|
-
validateReferenceImages(prompt, referenceImages);
|
|
1458
|
-
validateReferenceVideo(body, prompt, referenceVideoUrl);
|
|
1459
|
-
}
|
|
1460
|
-
function validateFrameUrls(body) {
|
|
1461
|
-
for (const field of ["first_frame_image_url", "last_frame_image_url"]) {
|
|
1462
|
-
const value = body[field];
|
|
1463
|
-
if (typeof value !== "string" || value.length === 0) continue;
|
|
1464
|
-
if (!isPublicHttpUrl(value)) {
|
|
1465
|
-
throw new import_core.ValidationError(`${field} must be a public HTTP or HTTPS URL`);
|
|
1466
|
-
}
|
|
1467
|
-
if (!IMAGE_EXTENSIONS.has(urlExtension(value))) {
|
|
1468
|
-
throw new import_core.ValidationError(`${field} must use a JPG, JPEG, or PNG URL`);
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
function validateReferenceImages(prompt, urls) {
|
|
1473
|
-
urls.forEach((url, index) => {
|
|
1474
|
-
if (typeof url !== "string") {
|
|
1475
|
-
throw new import_core.ValidationError(`reference_image_urls[${index}] must be a string`);
|
|
1476
|
-
}
|
|
1477
|
-
if (!isPublicHttpUrl(url)) {
|
|
1478
|
-
throw new import_core.ValidationError(
|
|
1479
|
-
`reference_image_urls[${index}] must be a public HTTP or HTTPS URL`
|
|
1480
|
-
);
|
|
1481
|
-
}
|
|
1482
|
-
if (!IMAGE_EXTENSIONS.has(urlExtension(url))) {
|
|
1483
|
-
throw new import_core.ValidationError(
|
|
1484
|
-
`reference_image_urls[${index}] must use a JPG, JPEG, or PNG URL`
|
|
1485
|
-
);
|
|
1486
|
-
}
|
|
1487
|
-
const marker = `<<<image_${index + 1}>>>`;
|
|
1488
|
-
if (!prompt.includes(marker)) {
|
|
1489
|
-
throw new import_core.ValidationError(
|
|
1490
|
-
`prompt must reference reference_image_urls[${index}] as ${marker}`
|
|
1491
|
-
);
|
|
1492
|
-
}
|
|
1493
|
-
});
|
|
1494
|
-
for (const match of prompt.matchAll(/<<<image_(\d+)>>>/g)) {
|
|
1495
|
-
const index = Number(match[1]);
|
|
1496
|
-
if (index < 1 || index > urls.length) {
|
|
1497
|
-
throw new import_core.ValidationError(`prompt references missing image_${index}`);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
function validateReferenceVideo(body, prompt, referenceVideoUrl) {
|
|
1502
|
-
if (!referenceVideoUrl) {
|
|
1503
|
-
if ("reference_video_type" in body) {
|
|
1504
|
-
throw new import_core.ValidationError("reference_video_type requires reference_video_url");
|
|
1505
|
-
}
|
|
1506
|
-
if ("preserve_reference_video_audio" in body) {
|
|
1507
|
-
throw new import_core.ValidationError("preserve_reference_video_audio requires reference_video_url");
|
|
1508
|
-
}
|
|
1509
|
-
const missingMarker = prompt.match(/<<<video_([^>]+)>>>/);
|
|
1510
|
-
if (missingMarker) {
|
|
1511
|
-
throw new import_core.ValidationError(`prompt references missing video_${missingMarker[1]}`);
|
|
1512
|
-
}
|
|
1513
|
-
return;
|
|
1514
|
-
}
|
|
1515
|
-
if (!isPublicHttpUrl(referenceVideoUrl)) {
|
|
1516
|
-
throw new import_core.ValidationError("reference_video_url must be a public HTTP or HTTPS URL");
|
|
1517
|
-
}
|
|
1518
|
-
if (!VIDEO_EXTENSIONS.has(urlExtension(referenceVideoUrl))) {
|
|
1519
|
-
throw new import_core.ValidationError("reference_video_url must use an MP4 or MOV URL");
|
|
1520
|
-
}
|
|
1521
|
-
if (!prompt.includes("<<<video_1>>>")) {
|
|
1522
|
-
throw new import_core.ValidationError("prompt must reference reference_video_url as <<<video_1>>>");
|
|
1523
|
-
}
|
|
1524
|
-
for (const match of prompt.matchAll(/<<<video_([^>]+)>>>/g)) {
|
|
1525
|
-
if (match[1] !== "1") {
|
|
1526
|
-
throw new import_core.ValidationError("prompt may only reference video_1");
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
const referenceVideoType = body.reference_video_type ?? "base";
|
|
1530
|
-
if (referenceVideoType === "base" && (present(body.first_frame_image_url) || present(body.last_frame_image_url))) {
|
|
1531
|
-
throw new import_core.ValidationError(
|
|
1532
|
-
"reference_video_type base cannot be combined with first_frame_image_url or last_frame_image_url"
|
|
1533
|
-
);
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
function present(value) {
|
|
1537
|
-
return typeof value === "string" ? value.trim().length > 0 : value !== void 0 && value !== null;
|
|
1538
|
-
}
|
|
1539
|
-
function urlExtension(value) {
|
|
1540
|
-
try {
|
|
1541
|
-
const path = new URL(value).pathname;
|
|
1542
|
-
const dot = path.lastIndexOf(".");
|
|
1543
|
-
return dot >= 0 ? path.slice(dot).toLowerCase() : "";
|
|
1544
|
-
} catch {
|
|
1545
|
-
return "";
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
function isPublicHttpUrl(value) {
|
|
1549
|
-
try {
|
|
1550
|
-
const url = new URL(value);
|
|
1551
|
-
return (url.protocol === "http:" || url.protocol === "https:") && url.hostname.length > 0 && url.username.length === 0 && url.password.length === 0 && !isBlockedHost(url.hostname);
|
|
1552
|
-
} catch {
|
|
1553
|
-
return false;
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
function isBlockedHost(hostname) {
|
|
1557
|
-
const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
1558
|
-
if (host === "localhost" || host.endsWith(".localhost")) return true;
|
|
1559
|
-
const parsed = parseIpLiteral(host);
|
|
1560
|
-
if (!parsed) return false;
|
|
1561
|
-
return BLOCKED_IP_NETWORKS.some((network) => {
|
|
1562
|
-
if (network.bits !== parsed.bits) return false;
|
|
1563
|
-
const shift = BigInt(parsed.bits - network.prefix);
|
|
1564
|
-
return parsed.value >> shift === network.value >> shift;
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
function parseIpLiteral(value) {
|
|
1568
|
-
const ipv4 = parseIpv4(value);
|
|
1569
|
-
if (ipv4 !== void 0) return { bits: 32, value: ipv4 };
|
|
1570
|
-
if (!value.includes(":")) return void 0;
|
|
1571
|
-
const halves = value.toLowerCase().split("::");
|
|
1572
|
-
if (halves.length > 2) return void 0;
|
|
1573
|
-
const head = parseIpv6Half(halves[0]);
|
|
1574
|
-
const tail = parseIpv6Half(halves[1] ?? "");
|
|
1575
|
-
if (!head || !tail) return void 0;
|
|
1576
|
-
const compressed = halves.length === 2;
|
|
1577
|
-
const missing = 8 - head.length - tail.length;
|
|
1578
|
-
if (!compressed && missing !== 0 || compressed && missing < 1) return void 0;
|
|
1579
|
-
const segments = [...head, ...Array(missing).fill(0), ...tail];
|
|
1580
|
-
const address = segments.reduce((result, segment) => result << 16n | BigInt(segment), 0n);
|
|
1581
|
-
if (address >> 32n === 0xffffn) {
|
|
1582
|
-
return { bits: 32, value: address & 0xffffffffn };
|
|
1583
|
-
}
|
|
1584
|
-
return { bits: 128, value: address };
|
|
1585
|
-
}
|
|
1586
|
-
function parseIpv4(value) {
|
|
1587
|
-
const parts = value.split(".");
|
|
1588
|
-
if (parts.length !== 4 || parts.some((part) => !/^\d+$/.test(part))) return void 0;
|
|
1589
|
-
const octets = parts.map(Number);
|
|
1590
|
-
if (octets.some((octet) => octet < 0 || octet > 255)) return void 0;
|
|
1591
|
-
return octets.reduce((result, octet) => result << 8n | BigInt(octet), 0n);
|
|
1592
|
-
}
|
|
1593
|
-
function parseIpv6Half(value) {
|
|
1594
|
-
if (value === "") return [];
|
|
1595
|
-
const parts = value.split(":");
|
|
1596
|
-
if (parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) return void 0;
|
|
1597
|
-
return parts.map((part) => Number.parseInt(part, 16));
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
// src/resources/text-to-video.ts
|
|
43
|
+
var import_internal = require("@runapi.ai/core/internal");
|
|
1601
44
|
var ENDPOINT = "/api/v1/kling/text_to_video";
|
|
1602
|
-
var V3_TURBO_MODEL = "kling-v3-turbo-text-to-video";
|
|
1603
|
-
var V3_TURBO_UNSUPPORTED_FIELDS = [
|
|
1604
|
-
"enable_sound",
|
|
1605
|
-
"negative_prompt",
|
|
1606
|
-
"cfg_scale",
|
|
1607
|
-
"multi_shots",
|
|
1608
|
-
"multi_prompt",
|
|
1609
|
-
"first_frame_image_url",
|
|
1610
|
-
"last_frame_image_url",
|
|
1611
|
-
"kling_elements"
|
|
1612
|
-
];
|
|
1613
45
|
var TextToVideo = class {
|
|
1614
46
|
constructor(http) {
|
|
1615
47
|
this.http = http;
|
|
@@ -1636,10 +68,7 @@ var TextToVideo = class {
|
|
|
1636
68
|
* @returns The task creation result with id.
|
|
1637
69
|
*/
|
|
1638
70
|
async create(params, options) {
|
|
1639
|
-
const body = (0,
|
|
1640
|
-
rejectUnsupportedV3TurboFields(body);
|
|
1641
|
-
(0, import_core2.validateParams)(contract["text-to-video"], body);
|
|
1642
|
-
validateKlingO1References(body);
|
|
71
|
+
const body = (0, import_core.compactParams)(params);
|
|
1643
72
|
return this.http.request("POST", ENDPOINT, {
|
|
1644
73
|
body,
|
|
1645
74
|
...options
|
|
@@ -1657,42 +86,11 @@ var TextToVideo = class {
|
|
|
1657
86
|
});
|
|
1658
87
|
}
|
|
1659
88
|
};
|
|
1660
|
-
function rejectUnsupportedV3TurboFields(body) {
|
|
1661
|
-
if (body.model !== V3_TURBO_MODEL) return;
|
|
1662
|
-
const field = V3_TURBO_UNSUPPORTED_FIELDS.find((candidate) => fieldPresent(body, candidate));
|
|
1663
|
-
if (field) {
|
|
1664
|
-
throw new import_core2.ValidationError(`${field} is not supported by ${V3_TURBO_MODEL}`);
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
function fieldPresent(params, field) {
|
|
1668
|
-
if (!(field in params)) return false;
|
|
1669
|
-
const value = params[field];
|
|
1670
|
-
if (value === false) return true;
|
|
1671
|
-
if (Array.isArray(value)) return value.some((item) => presentValue(item));
|
|
1672
|
-
return presentValue(value);
|
|
1673
|
-
}
|
|
1674
|
-
function presentValue(value) {
|
|
1675
|
-
if (value === null || value === void 0 || value === false) return false;
|
|
1676
|
-
if (value === true) return true;
|
|
1677
|
-
if (typeof value === "string") return value.trim() !== "";
|
|
1678
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
1679
|
-
if (typeof value === "object") return Object.keys(value).length > 0;
|
|
1680
|
-
return true;
|
|
1681
|
-
}
|
|
1682
89
|
|
|
1683
90
|
// src/resources/image-to-video.ts
|
|
1684
|
-
var
|
|
91
|
+
var import_core2 = require("@runapi.ai/core");
|
|
1685
92
|
var import_internal2 = require("@runapi.ai/core/internal");
|
|
1686
93
|
var ENDPOINT2 = "/api/v1/kling/image_to_video";
|
|
1687
|
-
var V26_MODEL = "kling-v2.6";
|
|
1688
|
-
var V3_OMNI_MODEL = "kling-v3-omni";
|
|
1689
|
-
var V3_TURBO_MODEL2 = "kling-v3-turbo-image-to-video";
|
|
1690
|
-
var V3_TURBO_UNSUPPORTED_FIELDS2 = [
|
|
1691
|
-
"aspect_ratio",
|
|
1692
|
-
"negative_prompt",
|
|
1693
|
-
"cfg_scale",
|
|
1694
|
-
"last_frame_image_url"
|
|
1695
|
-
];
|
|
1696
94
|
var ImageToVideo = class {
|
|
1697
95
|
constructor(http) {
|
|
1698
96
|
this.http = http;
|
|
@@ -1719,12 +117,7 @@ var ImageToVideo = class {
|
|
|
1719
117
|
* @returns The task creation result with id.
|
|
1720
118
|
*/
|
|
1721
119
|
async create(params, options) {
|
|
1722
|
-
const body = (0,
|
|
1723
|
-
rejectUnsupportedV3TurboFields2(body);
|
|
1724
|
-
(0, import_core3.validateParams)(contract["image-to-video"], body);
|
|
1725
|
-
validateV26Params(body);
|
|
1726
|
-
validateV3OmniFields(body);
|
|
1727
|
-
validateKlingO1References(body);
|
|
120
|
+
const body = (0, import_core2.compactParams)(params);
|
|
1728
121
|
return this.http.request("POST", ENDPOINT2, {
|
|
1729
122
|
body,
|
|
1730
123
|
...options
|
|
@@ -1742,47 +135,9 @@ var ImageToVideo = class {
|
|
|
1742
135
|
});
|
|
1743
136
|
}
|
|
1744
137
|
};
|
|
1745
|
-
function validateV26Params(body) {
|
|
1746
|
-
if (body.model !== V26_MODEL) return;
|
|
1747
|
-
if (!fieldPresent2(body, "last_frame_image_url")) return;
|
|
1748
|
-
if (body.mode !== "pro") {
|
|
1749
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires mode pro for ${V26_MODEL}`);
|
|
1750
|
-
}
|
|
1751
|
-
if (body.duration_seconds !== void 0 && body.duration_seconds !== 5) {
|
|
1752
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL}`);
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
function validateV3OmniFields(body) {
|
|
1756
|
-
if (body.model !== V3_OMNI_MODEL || !fieldPresent2(body, "last_frame_image_url")) return;
|
|
1757
|
-
if ((body.duration_seconds ?? 5) !== 5) {
|
|
1758
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires duration_seconds 5 for ${V3_OMNI_MODEL}`);
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
function rejectUnsupportedV3TurboFields2(body) {
|
|
1762
|
-
if (body.model !== V3_TURBO_MODEL2) return;
|
|
1763
|
-
const field = V3_TURBO_UNSUPPORTED_FIELDS2.find((candidate) => fieldPresent2(body, candidate));
|
|
1764
|
-
if (field) {
|
|
1765
|
-
throw new import_core3.ValidationError(`${field} is not supported by ${V3_TURBO_MODEL2}`);
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
function fieldPresent2(params, field) {
|
|
1769
|
-
if (!(field in params)) return false;
|
|
1770
|
-
const value = params[field];
|
|
1771
|
-
if (value === false) return true;
|
|
1772
|
-
if (Array.isArray(value)) return value.some((item) => presentValue2(item));
|
|
1773
|
-
return presentValue2(value);
|
|
1774
|
-
}
|
|
1775
|
-
function presentValue2(value) {
|
|
1776
|
-
if (value === null || value === void 0 || value === false) return false;
|
|
1777
|
-
if (value === true) return true;
|
|
1778
|
-
if (typeof value === "string") return value.trim() !== "";
|
|
1779
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
1780
|
-
if (typeof value === "object") return Object.keys(value).length > 0;
|
|
1781
|
-
return true;
|
|
1782
|
-
}
|
|
1783
138
|
|
|
1784
139
|
// src/resources/ai-avatar.ts
|
|
1785
|
-
var
|
|
140
|
+
var import_core3 = require("@runapi.ai/core");
|
|
1786
141
|
var import_internal3 = require("@runapi.ai/core/internal");
|
|
1787
142
|
var ENDPOINT3 = "/api/v1/kling/ai_avatar";
|
|
1788
143
|
var AiAvatar = class {
|
|
@@ -1811,8 +166,7 @@ var AiAvatar = class {
|
|
|
1811
166
|
* @returns The task creation result with id.
|
|
1812
167
|
*/
|
|
1813
168
|
async create(params, options) {
|
|
1814
|
-
const body = (0,
|
|
1815
|
-
(0, import_core4.validateParams)(contract["avatar"], body);
|
|
169
|
+
const body = (0, import_core3.compactParams)(params);
|
|
1816
170
|
return this.http.request("POST", ENDPOINT3, {
|
|
1817
171
|
body,
|
|
1818
172
|
...options
|
|
@@ -1832,7 +186,7 @@ var AiAvatar = class {
|
|
|
1832
186
|
};
|
|
1833
187
|
|
|
1834
188
|
// src/resources/motion-control.ts
|
|
1835
|
-
var
|
|
189
|
+
var import_core4 = require("@runapi.ai/core");
|
|
1836
190
|
var import_internal4 = require("@runapi.ai/core/internal");
|
|
1837
191
|
var ENDPOINT4 = "/api/v1/kling/motion_control";
|
|
1838
192
|
var MotionControl = class {
|
|
@@ -1861,8 +215,7 @@ var MotionControl = class {
|
|
|
1861
215
|
* @returns The task creation result with id.
|
|
1862
216
|
*/
|
|
1863
217
|
async create(params, options) {
|
|
1864
|
-
const body = (0,
|
|
1865
|
-
(0, import_core5.validateParams)(contract["motion-control"], body);
|
|
218
|
+
const body = (0, import_core4.compactParams)(params);
|
|
1866
219
|
return this.http.request("POST", ENDPOINT4, {
|
|
1867
220
|
body,
|
|
1868
221
|
...options
|
|
@@ -1882,7 +235,7 @@ var MotionControl = class {
|
|
|
1882
235
|
};
|
|
1883
236
|
|
|
1884
237
|
// src/resources/extend-video.ts
|
|
1885
|
-
var
|
|
238
|
+
var import_core5 = require("@runapi.ai/core");
|
|
1886
239
|
var import_internal5 = require("@runapi.ai/core/internal");
|
|
1887
240
|
var ENDPOINT5 = "/api/v1/kling/extend_video";
|
|
1888
241
|
var ExtendVideo = class {
|
|
@@ -1898,8 +251,7 @@ var ExtendVideo = class {
|
|
|
1898
251
|
});
|
|
1899
252
|
}
|
|
1900
253
|
async create(params, options) {
|
|
1901
|
-
const body = (0,
|
|
1902
|
-
(0, import_core6.validateParams)(contract["extend-video"], body);
|
|
254
|
+
const body = (0, import_core5.compactParams)(params);
|
|
1903
255
|
return this.http.request("POST", ENDPOINT5, { body, ...options });
|
|
1904
256
|
}
|
|
1905
257
|
async get(id, options) {
|
|
@@ -1908,7 +260,7 @@ var ExtendVideo = class {
|
|
|
1908
260
|
};
|
|
1909
261
|
|
|
1910
262
|
// src/resources/edit-video.ts
|
|
1911
|
-
var
|
|
263
|
+
var import_core6 = require("@runapi.ai/core");
|
|
1912
264
|
var import_internal6 = require("@runapi.ai/core/internal");
|
|
1913
265
|
var ENDPOINT6 = "/api/v1/kling/edit_video";
|
|
1914
266
|
var EditVideo = class {
|
|
@@ -1924,8 +276,7 @@ var EditVideo = class {
|
|
|
1924
276
|
});
|
|
1925
277
|
}
|
|
1926
278
|
async create(params, options) {
|
|
1927
|
-
const body = (0,
|
|
1928
|
-
(0, import_core7.validateParams)(contract["edit-video"], body);
|
|
279
|
+
const body = (0, import_core6.compactParams)(params);
|
|
1929
280
|
return this.http.request("POST", ENDPOINT6, { body, ...options });
|
|
1930
281
|
}
|
|
1931
282
|
async get(id, options) {
|
|
@@ -1934,7 +285,7 @@ var EditVideo = class {
|
|
|
1934
285
|
};
|
|
1935
286
|
|
|
1936
287
|
// src/client.ts
|
|
1937
|
-
var KlingClient = class extends
|
|
288
|
+
var KlingClient = class extends import_core7.BaseClient {
|
|
1938
289
|
/** Text-to-video generation with multi-shot, sound, and Kling elements support on kling-3.0. */
|
|
1939
290
|
textToVideo;
|
|
1940
291
|
/** Image-to-video animation from a first-frame image guided by a text prompt. */
|
|
@@ -1958,7 +309,7 @@ var KlingClient = class extends import_core8.BaseClient {
|
|
|
1958
309
|
};
|
|
1959
310
|
|
|
1960
311
|
// src/index.ts
|
|
1961
|
-
var
|
|
312
|
+
var import_core8 = require("@runapi.ai/core");
|
|
1962
313
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1963
314
|
0 && (module.exports = {
|
|
1964
315
|
AuthenticationError,
|