@runapi.ai/kling 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { BaseClient } from "@runapi.ai/core";
3
3
 
4
4
  // src/resources/text-to-video.ts
5
- import { ValidationError, compactParams, validateParams } from "@runapi.ai/core";
5
+ import { ValidationError as ValidationError2, compactParams, validateParams } from "@runapi.ai/core";
6
6
  import { pollUntilComplete } from "@runapi.ai/core/internal";
7
7
 
8
8
  // src/contract_gen.ts
@@ -105,6 +105,7 @@ var contract = {
105
105
  },
106
106
  "image-to-video": {
107
107
  "models": [
108
+ "kling-o1",
108
109
  "kling-v2.1-master-image-to-video",
109
110
  "kling-v2.1-pro",
110
111
  "kling-v2.1-standard",
@@ -114,6 +115,49 @@ var contract = {
114
115
  "kling-v3-turbo-image-to-video"
115
116
  ],
116
117
  "fields_by_model": {
118
+ "kling-o1": {
119
+ "aspect_ratio": {
120
+ "enum": [
121
+ "16:9",
122
+ "9:16",
123
+ "1:1"
124
+ ]
125
+ },
126
+ "duration_seconds": {
127
+ "enum": [
128
+ 5
129
+ ],
130
+ "type": "integer"
131
+ },
132
+ "first_frame_image_url": {
133
+ "required": true
134
+ },
135
+ "mode": {
136
+ "enum": [
137
+ "std",
138
+ "pro"
139
+ ]
140
+ },
141
+ "model": {
142
+ "required": true
143
+ },
144
+ "prompt": {
145
+ "required": true,
146
+ "min": 1,
147
+ "max": 2500,
148
+ "length": true
149
+ },
150
+ "reference_image_urls": {
151
+ "min_items": 1,
152
+ "max_items": 7
153
+ },
154
+ "reference_video_type": {
155
+ "enum": [
156
+ "base",
157
+ "feature"
158
+ ]
159
+ }
160
+ },
117
161
  "kling-v2.1-master-image-to-video": {
118
162
  "duration_seconds": {
119
163
  "enum": [
@@ -306,13 +350,27 @@ var contract = {
306
350
  }
307
351
  },
308
352
  "rules": [
353
+ {
354
+ "when": {
355
+ "model": "kling-o1"
356
+ },
357
+ "forbidden": [
358
+ "output_resolution",
359
+ "negative_prompt",
360
+ "cfg_scale"
361
+ ]
362
+ },
309
363
  {
310
364
  "when": {
311
365
  "model": "kling-v2.1-master-image-to-video"
312
366
  },
313
367
  "forbidden": [
314
368
  "output_resolution",
315
- "enable_sound"
369
+ "enable_sound",
370
+ "reference_image_urls",
371
+ "reference_video_url",
372
+ "reference_video_type",
373
+ "preserve_reference_video_audio"
316
374
  ]
317
375
  },
318
376
  {
@@ -321,7 +379,11 @@ var contract = {
321
379
  },
322
380
  "forbidden": [
323
381
  "output_resolution",
324
- "enable_sound"
382
+ "enable_sound",
383
+ "reference_image_urls",
384
+ "reference_video_url",
385
+ "reference_video_type",
386
+ "preserve_reference_video_audio"
325
387
  ]
326
388
  },
327
389
  {
@@ -330,7 +392,11 @@ var contract = {
330
392
  },
331
393
  "forbidden": [
332
394
  "output_resolution",
333
- "enable_sound"
395
+ "enable_sound",
396
+ "reference_image_urls",
397
+ "reference_video_url",
398
+ "reference_video_type",
399
+ "preserve_reference_video_audio"
334
400
  ]
335
401
  },
336
402
  {
@@ -339,7 +405,11 @@ var contract = {
339
405
  },
340
406
  "forbidden": [
341
407
  "output_resolution",
342
- "enable_sound"
408
+ "enable_sound",
409
+ "reference_image_urls",
410
+ "reference_video_url",
411
+ "reference_video_type",
412
+ "preserve_reference_video_audio"
343
413
  ]
344
414
  },
345
415
  {
@@ -349,7 +419,11 @@ var contract = {
349
419
  "forbidden": [
350
420
  "output_resolution",
351
421
  "negative_prompt",
352
- "cfg_scale"
422
+ "cfg_scale",
423
+ "reference_image_urls",
424
+ "reference_video_url",
425
+ "reference_video_type",
426
+ "preserve_reference_video_audio"
353
427
  ]
354
428
  },
355
429
  {
@@ -358,7 +432,11 @@ var contract = {
358
432
  },
359
433
  "forbidden": [
360
434
  "negative_prompt",
361
- "cfg_scale"
435
+ "cfg_scale",
436
+ "reference_image_urls",
437
+ "reference_video_url",
438
+ "reference_video_type",
439
+ "preserve_reference_video_audio"
362
440
  ]
363
441
  },
364
442
  {
@@ -370,14 +448,19 @@ var contract = {
370
448
  "aspect_ratio",
371
449
  "negative_prompt",
372
450
  "cfg_scale",
373
- "last_frame_image_url"
451
+ "last_frame_image_url",
452
+ "reference_image_urls",
453
+ "reference_video_url",
454
+ "reference_video_type",
455
+ "preserve_reference_video_audio"
374
456
  ]
375
457
  }
376
458
  ]
377
459
  },
378
460
  "motion-control": {
379
461
  "models": [
380
- "kling-3.0"
462
+ "kling-3.0",
463
+ "kling-v2.6"
381
464
  ],
382
465
  "fields_by_model": {
383
466
  "kling-3.0": {
@@ -408,12 +491,52 @@ var contract = {
408
491
  "source_image_url": {
409
492
  "required": true
410
493
  }
494
+ },
495
+ "kling-v2.6": {
496
+ "character_orientation": {
497
+ "enum": [
498
+ "video",
499
+ "image"
500
+ ],
501
+ "required": true
502
+ },
503
+ "model": {
504
+ "required": true
505
+ },
506
+ "output_resolution": {
507
+ "enum": [
508
+ "720p",
509
+ "1080p"
510
+ ],
511
+ "required": true
512
+ },
513
+ "prompt": {
514
+ "max": 2500,
515
+ "length": true
516
+ },
517
+ "reference_video_url": {
518
+ "required": true
519
+ },
520
+ "source_image_url": {
521
+ "required": true
522
+ }
411
523
  }
412
- }
524
+ },
525
+ "rules": [
526
+ {
527
+ "when": {
528
+ "model": "kling-v2.6"
529
+ },
530
+ "forbidden": [
531
+ "background_source"
532
+ ]
533
+ }
534
+ ]
413
535
  },
414
536
  "text-to-video": {
415
537
  "models": [
416
538
  "kling-3.0",
539
+ "kling-o1",
417
540
  "kling-v2.1-master-text-to-video",
418
541
  "kling-v2.5-turbo-text-to-video-pro",
419
542
  "kling-v2.6",
@@ -458,6 +581,46 @@ var contract = {
458
581
  ]
459
582
  }
460
583
  },
584
+ "kling-o1": {
585
+ "aspect_ratio": {
586
+ "enum": [
587
+ "16:9",
588
+ "9:16",
589
+ "1:1"
590
+ ]
591
+ },
592
+ "duration_seconds": {
593
+ "enum": [
594
+ 5
595
+ ],
596
+ "type": "integer"
597
+ },
598
+ "mode": {
599
+ "enum": [
600
+ "std",
601
+ "pro"
602
+ ]
603
+ },
604
+ "model": {
605
+ "required": true
606
+ },
607
+ "prompt": {
608
+ "required": true,
609
+ "min": 1,
610
+ "max": 2500,
611
+ "length": true
612
+ },
613
+ "reference_image_urls": {
614
+ "min_items": 1,
615
+ "max_items": 7
616
+ },
617
+ "reference_video_type": {
618
+ "enum": [
619
+ "base",
620
+ "feature"
621
+ ]
622
+ }
623
+ },
461
624
  "kling-v2.1-master-text-to-video": {
462
625
  "aspect_ratio": {
463
626
  "enum": [
@@ -614,12 +777,54 @@ var contract = {
614
777
  }
615
778
  },
616
779
  "rules": [
780
+ {
781
+ "when": {
782
+ "model": "kling-3.0"
783
+ },
784
+ "forbidden": [
785
+ "reference_image_urls",
786
+ "reference_video_url",
787
+ "reference_video_type",
788
+ "preserve_reference_video_audio"
789
+ ]
790
+ },
791
+ {
792
+ "when": {
793
+ "model": "kling-o1"
794
+ },
795
+ "forbidden": [
796
+ "output_resolution",
797
+ "negative_prompt",
798
+ "cfg_scale",
799
+ "multi_shots",
800
+ "multi_prompt",
801
+ "first_frame_image_url",
802
+ "last_frame_image_url",
803
+ "kling_elements"
804
+ ]
805
+ },
806
+ {
807
+ "when": {
808
+ "model": "kling-v2.1-master-text-to-video"
809
+ },
810
+ "forbidden": [
811
+ "mode",
812
+ "reference_image_urls",
813
+ "reference_video_url",
814
+ "reference_video_type",
815
+ "preserve_reference_video_audio"
816
+ ]
817
+ },
617
818
  {
618
819
  "when": {
619
820
  "model": "kling-v2.5-turbo-text-to-video-pro"
620
821
  },
621
822
  "forbidden": [
622
- "mode"
823
+ "mode",
824
+ "reference_image_urls",
825
+ "reference_video_url",
826
+ "reference_video_type",
827
+ "preserve_reference_video_audio"
623
828
  ]
624
829
  },
625
830
  {
@@ -634,7 +839,11 @@ var contract = {
634
839
  "multi_prompt",
635
840
  "first_frame_image_url",
636
841
  "last_frame_image_url",
637
- "kling_elements"
842
+ "kling_elements",
843
+ "reference_image_urls",
844
+ "reference_video_url",
845
+ "reference_video_type",
846
+ "preserve_reference_video_audio"
638
847
  ]
639
848
  },
640
849
  {
@@ -648,7 +857,11 @@ var contract = {
648
857
  "multi_prompt",
649
858
  "first_frame_image_url",
650
859
  "last_frame_image_url",
651
- "kling_elements"
860
+ "kling_elements",
861
+ "reference_image_urls",
862
+ "reference_video_url",
863
+ "reference_video_type",
864
+ "preserve_reference_video_audio"
652
865
  ]
653
866
  },
654
867
  {
@@ -663,13 +876,227 @@ var contract = {
663
876
  "multi_prompt",
664
877
  "first_frame_image_url",
665
878
  "last_frame_image_url",
666
- "kling_elements"
879
+ "kling_elements",
880
+ "reference_image_urls",
881
+ "reference_video_url",
882
+ "reference_video_type",
883
+ "preserve_reference_video_audio"
667
884
  ]
668
885
  }
669
886
  ]
670
887
  }
671
888
  };
672
889
 
890
+ // src/resources/o1-reference-validation.ts
891
+ import { ValidationError } from "@runapi.ai/core";
892
+ var O1_MODEL = "kling-o1";
893
+ var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png"]);
894
+ var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".mov"]);
895
+ var BLOCKED_IP_CIDRS = [
896
+ "0.0.0.0/8",
897
+ "10.0.0.0/8",
898
+ "100.64.0.0/10",
899
+ "127.0.0.0/8",
900
+ "169.254.0.0/16",
901
+ "172.16.0.0/12",
902
+ "192.0.0.0/24",
903
+ "192.0.2.0/24",
904
+ "192.88.99.0/24",
905
+ "192.168.0.0/16",
906
+ "198.18.0.0/15",
907
+ "198.51.100.0/24",
908
+ "203.0.113.0/24",
909
+ "224.0.0.0/4",
910
+ "240.0.0.0/4",
911
+ "255.255.255.255/32",
912
+ "::/128",
913
+ "::1/128",
914
+ "64:ff9b::/96",
915
+ "64:ff9b:1::/48",
916
+ "100::/64",
917
+ "2001::/32",
918
+ "2001:2::/48",
919
+ "2001:db8::/32",
920
+ "2002::/16",
921
+ "3fff::/20",
922
+ "fc00::/7",
923
+ "fe80::/10",
924
+ "ff00::/8"
925
+ ];
926
+ var BLOCKED_IP_NETWORKS = BLOCKED_IP_CIDRS.map((cidr) => {
927
+ const [address, prefixText] = cidr.split("/");
928
+ const parsed = parseIpLiteral(address);
929
+ if (!parsed) throw new Error("Invalid blocked IP range: " + cidr);
930
+ return { ...parsed, prefix: Number(prefixText) };
931
+ });
932
+ function validateKlingO1References(body) {
933
+ if (body.model !== O1_MODEL) return;
934
+ if (body.enable_sound === true) {
935
+ throw new ValidationError(`enable_sound is not supported by ${O1_MODEL}`);
936
+ }
937
+ validateFrameUrls(body);
938
+ if (typeof body.prompt !== "string") {
939
+ throw new ValidationError("prompt must be a string");
940
+ }
941
+ const prompt = body.prompt;
942
+ const referenceImages = Array.isArray(body.reference_image_urls) ? body.reference_image_urls : [];
943
+ if ("reference_video_url" in body && typeof body.reference_video_url !== "string") {
944
+ throw new ValidationError("reference_video_url must be a string");
945
+ }
946
+ const referenceVideoUrl = body.reference_video_url;
947
+ if (present(body.last_frame_image_url) && (referenceImages.length > 0 || present(referenceVideoUrl))) {
948
+ throw new ValidationError(
949
+ "last_frame_image_url cannot be combined with reference_image_urls or reference_video_url"
950
+ );
951
+ }
952
+ if (referenceVideoUrl && referenceImages.length > 4) {
953
+ throw new ValidationError(
954
+ "reference_image_urls must contain at most 4 items when reference_video_url is present"
955
+ );
956
+ }
957
+ validateReferenceImages(prompt, referenceImages);
958
+ validateReferenceVideo(body, prompt, referenceVideoUrl);
959
+ }
960
+ function validateFrameUrls(body) {
961
+ for (const field of ["first_frame_image_url", "last_frame_image_url"]) {
962
+ const value = body[field];
963
+ if (typeof value !== "string" || value.length === 0) continue;
964
+ if (!isPublicHttpUrl(value)) {
965
+ throw new ValidationError(`${field} must be a public HTTP or HTTPS URL`);
966
+ }
967
+ if (!IMAGE_EXTENSIONS.has(urlExtension(value))) {
968
+ throw new ValidationError(`${field} must use a JPG, JPEG, or PNG URL`);
969
+ }
970
+ }
971
+ }
972
+ function validateReferenceImages(prompt, urls) {
973
+ urls.forEach((url, index) => {
974
+ if (typeof url !== "string") {
975
+ throw new ValidationError(`reference_image_urls[${index}] must be a string`);
976
+ }
977
+ if (!isPublicHttpUrl(url)) {
978
+ throw new ValidationError(
979
+ `reference_image_urls[${index}] must be a public HTTP or HTTPS URL`
980
+ );
981
+ }
982
+ if (!IMAGE_EXTENSIONS.has(urlExtension(url))) {
983
+ throw new ValidationError(
984
+ `reference_image_urls[${index}] must use a JPG, JPEG, or PNG URL`
985
+ );
986
+ }
987
+ const marker = `<<<image_${index + 1}>>>`;
988
+ if (!prompt.includes(marker)) {
989
+ throw new ValidationError(
990
+ `prompt must reference reference_image_urls[${index}] as ${marker}`
991
+ );
992
+ }
993
+ });
994
+ for (const match of prompt.matchAll(/<<<image_(\d+)>>>/g)) {
995
+ const index = Number(match[1]);
996
+ if (index < 1 || index > urls.length) {
997
+ throw new ValidationError(`prompt references missing image_${index}`);
998
+ }
999
+ }
1000
+ }
1001
+ function validateReferenceVideo(body, prompt, referenceVideoUrl) {
1002
+ if (!referenceVideoUrl) {
1003
+ if ("reference_video_type" in body) {
1004
+ throw new ValidationError("reference_video_type requires reference_video_url");
1005
+ }
1006
+ if ("preserve_reference_video_audio" in body) {
1007
+ throw new ValidationError("preserve_reference_video_audio requires reference_video_url");
1008
+ }
1009
+ const missingMarker = prompt.match(/<<<video_([^>]+)>>>/);
1010
+ if (missingMarker) {
1011
+ throw new ValidationError(`prompt references missing video_${missingMarker[1]}`);
1012
+ }
1013
+ return;
1014
+ }
1015
+ if (!isPublicHttpUrl(referenceVideoUrl)) {
1016
+ throw new ValidationError("reference_video_url must be a public HTTP or HTTPS URL");
1017
+ }
1018
+ if (!VIDEO_EXTENSIONS.has(urlExtension(referenceVideoUrl))) {
1019
+ throw new ValidationError("reference_video_url must use an MP4 or MOV URL");
1020
+ }
1021
+ if (!prompt.includes("<<<video_1>>>")) {
1022
+ throw new ValidationError("prompt must reference reference_video_url as <<<video_1>>>");
1023
+ }
1024
+ for (const match of prompt.matchAll(/<<<video_([^>]+)>>>/g)) {
1025
+ if (match[1] !== "1") {
1026
+ throw new ValidationError("prompt may only reference video_1");
1027
+ }
1028
+ }
1029
+ const referenceVideoType = body.reference_video_type ?? "base";
1030
+ if (referenceVideoType === "base" && (present(body.first_frame_image_url) || present(body.last_frame_image_url))) {
1031
+ throw new ValidationError(
1032
+ "reference_video_type base cannot be combined with first_frame_image_url or last_frame_image_url"
1033
+ );
1034
+ }
1035
+ }
1036
+ function present(value) {
1037
+ return typeof value === "string" ? value.trim().length > 0 : value !== void 0 && value !== null;
1038
+ }
1039
+ function urlExtension(value) {
1040
+ try {
1041
+ const path = new URL(value).pathname;
1042
+ const dot = path.lastIndexOf(".");
1043
+ return dot >= 0 ? path.slice(dot).toLowerCase() : "";
1044
+ } catch {
1045
+ return "";
1046
+ }
1047
+ }
1048
+ function isPublicHttpUrl(value) {
1049
+ try {
1050
+ const url = new URL(value);
1051
+ return (url.protocol === "http:" || url.protocol === "https:") && url.hostname.length > 0 && url.username.length === 0 && url.password.length === 0 && !isBlockedHost(url.hostname);
1052
+ } catch {
1053
+ return false;
1054
+ }
1055
+ }
1056
+ function isBlockedHost(hostname) {
1057
+ const host = hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.$/, "");
1058
+ if (host === "localhost" || host.endsWith(".localhost")) return true;
1059
+ const parsed = parseIpLiteral(host);
1060
+ if (!parsed) return false;
1061
+ return BLOCKED_IP_NETWORKS.some((network) => {
1062
+ if (network.bits !== parsed.bits) return false;
1063
+ const shift = BigInt(parsed.bits - network.prefix);
1064
+ return parsed.value >> shift === network.value >> shift;
1065
+ });
1066
+ }
1067
+ function parseIpLiteral(value) {
1068
+ const ipv4 = parseIpv4(value);
1069
+ if (ipv4 !== void 0) return { bits: 32, value: ipv4 };
1070
+ if (!value.includes(":")) return void 0;
1071
+ const halves = value.toLowerCase().split("::");
1072
+ if (halves.length > 2) return void 0;
1073
+ const head = parseIpv6Half(halves[0]);
1074
+ const tail = parseIpv6Half(halves[1] ?? "");
1075
+ if (!head || !tail) return void 0;
1076
+ const compressed = halves.length === 2;
1077
+ const missing = 8 - head.length - tail.length;
1078
+ if (!compressed && missing !== 0 || compressed && missing < 1) return void 0;
1079
+ const segments = [...head, ...Array(missing).fill(0), ...tail];
1080
+ const address = segments.reduce((result, segment) => result << 16n | BigInt(segment), 0n);
1081
+ if (address >> 32n === 0xffffn) {
1082
+ return { bits: 32, value: address & 0xffffffffn };
1083
+ }
1084
+ return { bits: 128, value: address };
1085
+ }
1086
+ function parseIpv4(value) {
1087
+ const parts = value.split(".");
1088
+ if (parts.length !== 4 || parts.some((part) => !/^\d+$/.test(part))) return void 0;
1089
+ const octets = parts.map(Number);
1090
+ if (octets.some((octet) => octet < 0 || octet > 255)) return void 0;
1091
+ return octets.reduce((result, octet) => result << 8n | BigInt(octet), 0n);
1092
+ }
1093
+ function parseIpv6Half(value) {
1094
+ if (value === "") return [];
1095
+ const parts = value.split(":");
1096
+ if (parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) return void 0;
1097
+ return parts.map((part) => Number.parseInt(part, 16));
1098
+ }
1099
+
673
1100
  // src/resources/text-to-video.ts
674
1101
  var ENDPOINT = "/api/v1/kling/text_to_video";
675
1102
  var V26_MODEL = "kling-v2.6";
@@ -714,6 +1141,7 @@ var TextToVideo = class {
714
1141
  rejectUnsupportedV3TurboFields(body);
715
1142
  validateParams(contract["text-to-video"], body);
716
1143
  validateV26Params(body);
1144
+ validateKlingO1References(body);
717
1145
  return this.http.request("POST", ENDPOINT, {
718
1146
  body,
719
1147
  ...options
@@ -734,14 +1162,14 @@ var TextToVideo = class {
734
1162
  function validateV26Params(body) {
735
1163
  if (body.model !== V26_MODEL) return;
736
1164
  if (body.enable_sound === true && body.mode !== "pro") {
737
- throw new ValidationError(`enable_sound requires mode pro for ${V26_MODEL}`);
1165
+ throw new ValidationError2(`enable_sound requires mode pro for ${V26_MODEL}`);
738
1166
  }
739
1167
  }
740
1168
  function rejectUnsupportedV3TurboFields(body) {
741
1169
  if (body.model !== V3_TURBO_MODEL) return;
742
1170
  const field = V3_TURBO_UNSUPPORTED_FIELDS.find((candidate) => fieldPresent(body, candidate));
743
1171
  if (field) {
744
- throw new ValidationError(`${field} is not supported by ${V3_TURBO_MODEL}`);
1172
+ throw new ValidationError2(`${field} is not supported by ${V3_TURBO_MODEL}`);
745
1173
  }
746
1174
  }
747
1175
  function fieldPresent(params, field) {
@@ -761,7 +1189,7 @@ function presentValue(value) {
761
1189
  }
762
1190
 
763
1191
  // src/resources/image-to-video.ts
764
- import { ValidationError as ValidationError2, compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
1192
+ import { ValidationError as ValidationError3, compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
765
1193
  import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
766
1194
  var ENDPOINT2 = "/api/v1/kling/image_to_video";
767
1195
  var V26_MODEL2 = "kling-v2.6";
@@ -804,6 +1232,7 @@ var ImageToVideo = class {
804
1232
  validateParams2(contract["image-to-video"], body);
805
1233
  validateV26Params2(body);
806
1234
  validateV3OmniFields(body);
1235
+ validateKlingO1References(body);
807
1236
  return this.http.request("POST", ENDPOINT2, {
808
1237
  body,
809
1238
  ...options
@@ -824,27 +1253,27 @@ var ImageToVideo = class {
824
1253
  function validateV26Params2(body) {
825
1254
  if (body.model !== V26_MODEL2) return;
826
1255
  if (body.enable_sound === true && body.mode !== "pro") {
827
- throw new ValidationError2(`enable_sound requires mode pro for ${V26_MODEL2}`);
1256
+ throw new ValidationError3(`enable_sound requires mode pro for ${V26_MODEL2}`);
828
1257
  }
829
1258
  if (!fieldPresent2(body, "last_frame_image_url")) return;
830
1259
  if (body.mode !== "pro") {
831
- throw new ValidationError2(`last_frame_image_url requires mode pro for ${V26_MODEL2}`);
1260
+ throw new ValidationError3(`last_frame_image_url requires mode pro for ${V26_MODEL2}`);
832
1261
  }
833
1262
  if (body.duration_seconds !== void 0 && body.duration_seconds !== 5) {
834
- throw new ValidationError2(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL2}`);
1263
+ throw new ValidationError3(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL2}`);
835
1264
  }
836
1265
  }
837
1266
  function validateV3OmniFields(body) {
838
1267
  if (body.model !== V3_OMNI_MODEL || !fieldPresent2(body, "last_frame_image_url")) return;
839
1268
  if ((body.duration_seconds ?? 5) !== 5) {
840
- throw new ValidationError2(`last_frame_image_url requires duration_seconds 5 for ${V3_OMNI_MODEL}`);
1269
+ throw new ValidationError3(`last_frame_image_url requires duration_seconds 5 for ${V3_OMNI_MODEL}`);
841
1270
  }
842
1271
  }
843
1272
  function rejectUnsupportedV3TurboFields2(body) {
844
1273
  if (body.model !== V3_TURBO_MODEL2) return;
845
1274
  const field = V3_TURBO_UNSUPPORTED_FIELDS2.find((candidate) => fieldPresent2(body, candidate));
846
1275
  if (field) {
847
- throw new ValidationError2(`${field} is not supported by ${V3_TURBO_MODEL2}`);
1276
+ throw new ValidationError3(`${field} is not supported by ${V3_TURBO_MODEL2}`);
848
1277
  }
849
1278
  }
850
1279
  function fieldPresent2(params, field) {
@@ -1016,7 +1445,7 @@ import {
1016
1445
  AuthenticationError,
1017
1446
  InsufficientCreditsError,
1018
1447
  NotFoundError,
1019
- ValidationError as ValidationError3,
1448
+ ValidationError as ValidationError4,
1020
1449
  RateLimitError,
1021
1450
  ServiceUnavailableError,
1022
1451
  NetworkError,
@@ -1036,6 +1465,6 @@ export {
1036
1465
  TaskFailedError,
1037
1466
  TaskTimeoutError,
1038
1467
  TimeoutError,
1039
- ValidationError3 as ValidationError
1468
+ ValidationError4 as ValidationError
1040
1469
  };
1041
1470
  //# sourceMappingURL=index.mjs.map