@shop-os/modelkit 0.16.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -593,6 +593,76 @@ var IMAGE_MODELS = [
593
593
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/1204b494-8962-4f7f-af5e-699a8bdc98e3_compressed.png"
594
594
  }
595
595
  },
596
+ {
597
+ // Same Images API surface as gpt-image-2.5 (live-checked 2026-11-05; 2.6 also takes a `complexity` field the kit does not send).
598
+ id: "gpt-image-2.6-sunburst",
599
+ aliases: [],
600
+ label: "GPT Image 2.6 Sunburst",
601
+ type: "image",
602
+ adapter: "openai-image",
603
+ providerModelId: "gpt-image-2.6-sunburst",
604
+ lifecycle: "active",
605
+ exposure: ["cowork", "space_builder"],
606
+ constraints: {
607
+ exactSizes: {
608
+ "1:1": "1024x1024",
609
+ "3:2": "1536x1024",
610
+ "2:3": "1024x1536",
611
+ "16:9": "2048x1152",
612
+ "9:16": "1152x2048",
613
+ "4:5": "1024x1280",
614
+ "5:4": "1280x1024"
615
+ },
616
+ aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
617
+ sizes: ["1K", "2K", "4K"],
618
+ qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
619
+ references: { images: 16 },
620
+ supports: ["quality", "count", "outputFormat"],
621
+ prompt: GPT_IMAGE_PROMPT
622
+ },
623
+ defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
624
+ usage: { ...IMAGE_USAGE3 },
625
+ pricingKind: "image_size",
626
+ display: {
627
+ provider: "openai",
628
+ description: "OpenAI's most detailed GPT Image 2.6 tier, built for intricate detail and editing precision; takes text and image input and outputs images in low, medium, high, xhigh, or max quality."
629
+ }
630
+ },
631
+ {
632
+ // Same Images API surface as gpt-image-2.5 (live-checked 2026-11-05; 2.6 also takes a `complexity` field the kit does not send).
633
+ id: "gpt-image-2.6-flare",
634
+ aliases: [],
635
+ label: "GPT Image 2.6 Flare",
636
+ type: "image",
637
+ adapter: "openai-image",
638
+ providerModelId: "gpt-image-2.6-flare",
639
+ lifecycle: "active",
640
+ exposure: ["cowork", "space_builder"],
641
+ constraints: {
642
+ exactSizes: {
643
+ "1:1": "1024x1024",
644
+ "3:2": "1536x1024",
645
+ "2:3": "1024x1536",
646
+ "16:9": "2048x1152",
647
+ "9:16": "1152x2048",
648
+ "4:5": "1024x1280",
649
+ "5:4": "1280x1024"
650
+ },
651
+ aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
652
+ sizes: ["1K", "2K", "4K"],
653
+ qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
654
+ references: { images: 16 },
655
+ supports: ["quality", "count", "outputFormat"],
656
+ prompt: GPT_IMAGE_PROMPT
657
+ },
658
+ defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
659
+ usage: { ...IMAGE_USAGE3 },
660
+ pricingKind: "image_size",
661
+ display: {
662
+ provider: "openai",
663
+ description: "OpenAI's fast GPT Image 2.6 tier for everyday image generation and editing, with natural lighting, rich textures and complex layouts; takes text and image input and outputs images in low, medium, high, xhigh, or max quality."
664
+ }
665
+ },
596
666
  {
597
667
  // Same Images API surface as gpt-image-2 plus the "xhigh" and "max" quality tiers.
598
668
  id: "gpt-image-2.5-sunburst",
@@ -5074,6 +5144,7 @@ var KLING_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
5074
5144
  var H3_PROMPT = { referenceSyntax: "numbered", maxChars: 5e4 };
5075
5145
  var KLING_V4_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
5076
5146
  var KLING_V4_AUDIO = "always";
5147
+ var KLING_V4_FLASH_PROMPT = { referenceSyntax: "numbered", maxChars: 26e3 };
5077
5148
  var NO_REFERENCES = { images: 0, videos: 0, audios: 0 };
5078
5149
  function klingMotionControl(tier) {
5079
5150
  const label = tier === "pro" ? "Pro" : "Standard";
@@ -5251,6 +5322,85 @@ var VIDEO_FAMILY_MODELS = [
5251
5322
  },
5252
5323
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
5253
5324
  },
5325
+ {
5326
+ // https://fal.ai/models/kling/v4/flash/reference-to-video/api (+ /text-to-video,
5327
+ // /image-to-video): routed like kling-4.0, at 720p only and 3-20 s. image-to-video takes
5328
+ // a start frame (300 px min, ratio 0.40-2.50) and no end frame; its prompt is optional.
5329
+ // Reference images: 10, the start frame included. Reference videos: 5, 3-20.05 s each
5330
+ // and 20 s combined, 700 px min. Prompts up to 26,000 characters. No sound switch.
5331
+ id: "kling-4.0-flash",
5332
+ aliases: ["kling-4-flash", "kling-v4-flash"],
5333
+ label: "Kling 4.0 Flash",
5334
+ type: "video",
5335
+ adapter: "fal",
5336
+ providerModelId: "kling/v4/flash",
5337
+ lifecycle: "active",
5338
+ exposure: ["cowork", "space_builder"],
5339
+ constraints: {
5340
+ aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
5341
+ resolutions: ["720p"],
5342
+ durations: { min: 3, max: 20 },
5343
+ durationPresets: [5, 10, 15, 20],
5344
+ references: {
5345
+ ...NO_REFERENCES,
5346
+ images: 10,
5347
+ videos: 5,
5348
+ videoSeconds: { min: 3, max: 20.05, total: 20 },
5349
+ videoPixels: { minWidth: 700, minHeight: 700 }
5350
+ },
5351
+ supports: [],
5352
+ prompt: KLING_V4_FLASH_PROMPT,
5353
+ audio: KLING_V4_AUDIO
5354
+ },
5355
+ defaults: { durationSeconds: 5, resolution: "720p", aspectRatio: "16:9" },
5356
+ usage: { ...VIDEO_USAGE },
5357
+ pricingKind: "video_per_second",
5358
+ display: {
5359
+ provider: "kuaishou",
5360
+ logo: KLING_LOGO,
5361
+ description: "Kuaishou Kling 4.0 Flash: fast text-to-video, a start frame, or reference-to-video from up to 10 images and 5 videos (20 seconds combined), 3 to 20 seconds at 720p. Prompts name references @Image1, @Video1."
5362
+ }
5363
+ },
5364
+ {
5365
+ // https://fal.ai/models/kling/v4/flash/video-to-video/api: source 3-20.05 s (700 px
5366
+ // min, 23.9-60.05 fps), up to 10 reference images and 4 reference videos; the source
5367
+ // and reference videos total 20 s at most. duration 3-20, or left out for the source's
5368
+ // length. The prompt names the source @Video1, reference videos @Video2 on, images @Image1.
5369
+ id: "kling-4.0-flash-edit",
5370
+ aliases: ["kling-4-flash-edit", "kling-v4-flash-edit"],
5371
+ label: "Kling 4.0 Flash Edit",
5372
+ type: "video",
5373
+ adapter: "fal",
5374
+ providerModelId: "kling/v4/flash/video-to-video",
5375
+ lifecycle: "active",
5376
+ exposure: ["cowork", "space_builder"],
5377
+ constraints: {
5378
+ resolutions: ["720p"],
5379
+ durations: { min: 3, max: 20 },
5380
+ references: {
5381
+ ...NO_REFERENCES,
5382
+ images: 10,
5383
+ videos: 4,
5384
+ videoSeconds: { min: 3, max: 20.05, total: 20 },
5385
+ videoPixels: { minWidth: 700, minHeight: 700 }
5386
+ },
5387
+ requires: ["sourceVideo"],
5388
+ sourceVideoSeconds: { min: 3, max: 20.05, inReferenceTotal: true },
5389
+ sourceVideoPixels: { minWidth: 700, minHeight: 700 },
5390
+ supports: [],
5391
+ prompt: KLING_V4_FLASH_PROMPT,
5392
+ audio: KLING_V4_AUDIO
5393
+ },
5394
+ defaults: { resolution: "720p" },
5395
+ usage: { ...VIDEO_USAGE },
5396
+ pricingKind: "video_per_second",
5397
+ display: {
5398
+ provider: "kuaishou",
5399
+ logo: KLING_LOGO,
5400
+ description: "Kuaishou Kling 4.0 Flash video edit: change a 3-20 second clip with a prompt, up to 10 reference images and 4 reference videos (20 seconds in all with the source), at 720p, as long as the source or a set 3-20 seconds. Prompts name the source @Video1."
5401
+ },
5402
+ capabilities: { acceptsSourceVideo: true, videoEdit: true }
5403
+ },
5254
5404
  {
5255
5405
  // https://fal.ai/models/minimax/h3-max-turbo/text-to-video/api (+ /image-to-video).
5256
5406
  // image-to-video takes a start frame, an end frame, or both, and no aspect_ratio.
@@ -11706,8 +11856,13 @@ var MOTION_PRO = "fal-ai/kling-video/v3/pro/motion-control";
11706
11856
  var MOTION_STANDARD = "fal-ai/kling-video/v3/standard/motion-control";
11707
11857
  var O3_REFERENCE = "fal-ai/kling-video/o3/pro/reference-to-video";
11708
11858
  var O3_EDIT = "fal-ai/kling-video/o3/pro/video-to-video/edit";
11709
- var V4_FAMILY = "kling/v4";
11710
- var V4_EDIT = "kling/v4/video-to-video/edit";
11859
+ var V4 = { generate: "kling/v4", edit: "kling/v4/video-to-video/edit", flash: false };
11860
+ var V4_FLASH = {
11861
+ generate: "kling/v4/flash",
11862
+ edit: "kling/v4/flash/video-to-video",
11863
+ flash: true
11864
+ };
11865
+ var V4_VARIANTS = [V4, V4_FLASH];
11711
11866
  function motionControl(endpoint, req, ctx) {
11712
11867
  const [character] = req.referenceImages ?? [];
11713
11868
  const [motion] = req.referenceVideos ?? [];
@@ -11767,15 +11922,18 @@ var klingV3Family = {
11767
11922
  return motionControl(id, req, ctx);
11768
11923
  }
11769
11924
  };
11770
- function v4Generate(req, ctx) {
11925
+ function v4Generate(variant, req, ctx) {
11771
11926
  const images = urls(req.referenceImages);
11772
11927
  const videos = urls(req.referenceVideos);
11773
11928
  const duration = wholeSeconds(req, ctx);
11774
11929
  const resolution = resolutionOf(req, ctx);
11775
- const input = { prompt: req.prompt.trim(), duration, resolution };
11930
+ const references = images.length + videos.length > 0;
11931
+ const input = { duration, resolution };
11932
+ if (variant.flash && !references && req.firstFrame) optionalPrompt(input, req);
11933
+ else input["prompt"] = req.prompt.trim();
11776
11934
  let endpoint;
11777
- if (images.length + videos.length > 0) {
11778
- endpoint = `${V4_FAMILY}/reference-to-video`;
11935
+ if (references) {
11936
+ endpoint = `${variant.generate}/reference-to-video`;
11779
11937
  if (images.length > 0) input["image_urls"] = images;
11780
11938
  if (videos.length > 0) input["video_urls"] = videos;
11781
11939
  if (req.firstFrame) input["start_image_url"] = refToUrl(req.firstFrame);
@@ -11783,17 +11941,17 @@ function v4Generate(req, ctx) {
11783
11941
  input["aspect_ratio"] = req.aspectRatio === "adaptive" ? "auto" : req.aspectRatio;
11784
11942
  }
11785
11943
  } else if (req.firstFrame) {
11786
- endpoint = `${V4_FAMILY}/image-to-video`;
11944
+ endpoint = `${variant.generate}/image-to-video`;
11787
11945
  input["start_image_url"] = refToUrl(req.firstFrame);
11788
11946
  if (req.lastFrame) input["end_image_url"] = refToUrl(req.lastFrame);
11789
11947
  } else {
11790
- endpoint = `${V4_FAMILY}/text-to-video`;
11948
+ endpoint = `${variant.generate}/text-to-video`;
11791
11949
  const ratio = concreteRatio(req);
11792
11950
  if (ratio !== void 0) input["aspect_ratio"] = ratio;
11793
11951
  }
11794
11952
  return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
11795
11953
  }
11796
- function v4Edit(req, ctx) {
11954
+ function v4Edit(variant, req, ctx) {
11797
11955
  if (req.sourceVideo === void 0) throw refusal(ctx, "needs a source video", "missing_input");
11798
11956
  const resolution = resolutionOf(req, ctx);
11799
11957
  const input = {
@@ -11803,9 +11961,11 @@ function v4Edit(req, ctx) {
11803
11961
  };
11804
11962
  const images = urls(req.referenceImages);
11805
11963
  if (images.length > 0) input["image_urls"] = images;
11964
+ const videos = urls(req.referenceVideos);
11965
+ if (variant.flash && videos.length > 0) input["video_urls"] = videos;
11806
11966
  if (req.durationSeconds === void 0) {
11807
11967
  return {
11808
- endpoint: V4_EDIT,
11968
+ endpoint: variant.edit,
11809
11969
  input,
11810
11970
  resolution,
11811
11971
  seconds: inputLengthSeconds(req, req.sourceVideo)
@@ -11813,13 +11973,18 @@ function v4Edit(req, ctx) {
11813
11973
  }
11814
11974
  const duration = wholeSeconds(req, ctx);
11815
11975
  input["duration"] = duration;
11816
- return { endpoint: V4_EDIT, input, resolution, seconds: requestedSeconds(duration) };
11976
+ return { endpoint: variant.edit, input, resolution, seconds: requestedSeconds(duration) };
11817
11977
  }
11818
- var KLING_V4_VIDEO_IDS = /* @__PURE__ */ new Set([V4_FAMILY, V4_EDIT]);
11978
+ var KLING_V4_VIDEO_IDS = new Set(
11979
+ V4_VARIANTS.flatMap((v) => [v.generate, v.edit])
11980
+ );
11819
11981
  var klingV4Family = {
11820
11982
  ids: KLING_V4_VIDEO_IDS,
11821
11983
  plan(req, ctx) {
11822
- return ctx.model.providerModelId.toLowerCase() === V4_EDIT ? v4Edit(req, ctx) : v4Generate(req, ctx);
11984
+ const id = ctx.model.providerModelId.toLowerCase();
11985
+ const edit2 = V4_VARIANTS.find((v) => v.edit === id);
11986
+ if (edit2 !== void 0) return v4Edit(edit2, req, ctx);
11987
+ return v4Generate(V4_VARIANTS.find((v) => v.generate === id) ?? V4, req, ctx);
11823
11988
  }
11824
11989
  };
11825
11990
 
@@ -11894,6 +12059,8 @@ var O3_REFERENCE2 = "fal-ai/kling-video/o3/pro/reference-to-video";
11894
12059
  var O3_EDIT2 = "fal-ai/kling-video/o3/pro/video-to-video/edit";
11895
12060
  var KLING_V4 = "kling/v4";
11896
12061
  var KLING_V4_EDIT = "kling/v4/video-to-video/edit";
12062
+ var KLING_V4_FLASH = "kling/v4/flash";
12063
+ var KLING_V4_FLASH_EDIT = "kling/v4/flash/video-to-video";
11897
12064
  var H3_TURBO = "minimax/h3-max-turbo";
11898
12065
  var H3_RECAST = "minimax/h3-max/recast";
11899
12066
  var H3_RELIGHT = "minimax/h3-max/relight";
@@ -11975,6 +12142,11 @@ function klingV4(req) {
11975
12142
  }
11976
12143
  return needsPrompt(req);
11977
12144
  }
12145
+ function klingV4Flash(req) {
12146
+ if (req.lastFrame !== void 0) return unsupported2("takes no end frame");
12147
+ if (!hasReferences(req) && req.firstFrame !== void 0) return void 0;
12148
+ return klingV4(req);
12149
+ }
11978
12150
  function h3Turbo(req) {
11979
12151
  if (count(req.referenceImages) + count(req.referenceVideos) > 0) {
11980
12152
  return unsupported2("takes no reference images or videos");
@@ -12055,6 +12227,8 @@ var RULES = /* @__PURE__ */ new Map([
12055
12227
  [O3_EDIT2, (req) => needsSource(req) ?? needsPrompt(req)],
12056
12228
  [KLING_V4, klingV4],
12057
12229
  [KLING_V4_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
12230
+ [KLING_V4_FLASH, klingV4Flash],
12231
+ [KLING_V4_FLASH_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
12058
12232
  [H3_TURBO, h3Turbo],
12059
12233
  [MINIMAX_H3_INSERT, h3Insert],
12060
12234
  [H3_RECAST, h3Recast],
@@ -12104,7 +12278,7 @@ function applyFalVideoRules(model, req, callerRatio, warnings) {
12104
12278
  warnings.push(viduSilentWarning(model));
12105
12279
  req.generateAudio = false;
12106
12280
  }
12107
- if (id === KLING_V4 && req.firstFrame !== void 0 && !hasReferences(req)) {
12281
+ if ((id === KLING_V4 || id === KLING_V4_FLASH) && req.firstFrame !== void 0 && !hasReferences(req)) {
12108
12282
  if (req.aspectRatio !== void 0) {
12109
12283
  if (callerRatio !== void 0) {
12110
12284
  warnings.push({