@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.cjs CHANGED
@@ -741,6 +741,76 @@ var IMAGE_MODELS = [
741
741
  logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/1204b494-8962-4f7f-af5e-699a8bdc98e3_compressed.png"
742
742
  }
743
743
  },
744
+ {
745
+ // 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).
746
+ id: "gpt-image-2.6-sunburst",
747
+ aliases: [],
748
+ label: "GPT Image 2.6 Sunburst",
749
+ type: "image",
750
+ adapter: "openai-image",
751
+ providerModelId: "gpt-image-2.6-sunburst",
752
+ lifecycle: "active",
753
+ exposure: ["cowork", "space_builder"],
754
+ constraints: {
755
+ exactSizes: {
756
+ "1:1": "1024x1024",
757
+ "3:2": "1536x1024",
758
+ "2:3": "1024x1536",
759
+ "16:9": "2048x1152",
760
+ "9:16": "1152x2048",
761
+ "4:5": "1024x1280",
762
+ "5:4": "1280x1024"
763
+ },
764
+ aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
765
+ sizes: ["1K", "2K", "4K"],
766
+ qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
767
+ references: { images: 16 },
768
+ supports: ["quality", "count", "outputFormat"],
769
+ prompt: GPT_IMAGE_PROMPT
770
+ },
771
+ defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
772
+ usage: { ...IMAGE_USAGE3 },
773
+ pricingKind: "image_size",
774
+ display: {
775
+ provider: "openai",
776
+ 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."
777
+ }
778
+ },
779
+ {
780
+ // 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).
781
+ id: "gpt-image-2.6-flare",
782
+ aliases: [],
783
+ label: "GPT Image 2.6 Flare",
784
+ type: "image",
785
+ adapter: "openai-image",
786
+ providerModelId: "gpt-image-2.6-flare",
787
+ lifecycle: "active",
788
+ exposure: ["cowork", "space_builder"],
789
+ constraints: {
790
+ exactSizes: {
791
+ "1:1": "1024x1024",
792
+ "3:2": "1536x1024",
793
+ "2:3": "1024x1536",
794
+ "16:9": "2048x1152",
795
+ "9:16": "1152x2048",
796
+ "4:5": "1024x1280",
797
+ "5:4": "1280x1024"
798
+ },
799
+ aspectRatios: ["1:1", "3:2", "2:3", "16:9", "9:16", "4:5", "5:4", "adaptive"],
800
+ sizes: ["1K", "2K", "4K"],
801
+ qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
802
+ references: { images: 16 },
803
+ supports: ["quality", "count", "outputFormat"],
804
+ prompt: GPT_IMAGE_PROMPT
805
+ },
806
+ defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
807
+ usage: { ...IMAGE_USAGE3 },
808
+ pricingKind: "image_size",
809
+ display: {
810
+ provider: "openai",
811
+ 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."
812
+ }
813
+ },
744
814
  {
745
815
  // Same Images API surface as gpt-image-2 plus the "xhigh" and "max" quality tiers.
746
816
  id: "gpt-image-2.5-sunburst",
@@ -5222,6 +5292,7 @@ var KLING_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
5222
5292
  var H3_PROMPT = { referenceSyntax: "numbered", maxChars: 5e4 };
5223
5293
  var KLING_V4_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
5224
5294
  var KLING_V4_AUDIO = "always";
5295
+ var KLING_V4_FLASH_PROMPT = { referenceSyntax: "numbered", maxChars: 26e3 };
5225
5296
  var NO_REFERENCES = { images: 0, videos: 0, audios: 0 };
5226
5297
  function klingMotionControl(tier) {
5227
5298
  const label = tier === "pro" ? "Pro" : "Standard";
@@ -5399,6 +5470,85 @@ var VIDEO_FAMILY_MODELS = [
5399
5470
  },
5400
5471
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
5401
5472
  },
5473
+ {
5474
+ // https://fal.ai/models/kling/v4/flash/reference-to-video/api (+ /text-to-video,
5475
+ // /image-to-video): routed like kling-4.0, at 720p only and 3-20 s. image-to-video takes
5476
+ // a start frame (300 px min, ratio 0.40-2.50) and no end frame; its prompt is optional.
5477
+ // Reference images: 10, the start frame included. Reference videos: 5, 3-20.05 s each
5478
+ // and 20 s combined, 700 px min. Prompts up to 26,000 characters. No sound switch.
5479
+ id: "kling-4.0-flash",
5480
+ aliases: ["kling-4-flash", "kling-v4-flash"],
5481
+ label: "Kling 4.0 Flash",
5482
+ type: "video",
5483
+ adapter: "fal",
5484
+ providerModelId: "kling/v4/flash",
5485
+ lifecycle: "active",
5486
+ exposure: ["cowork", "space_builder"],
5487
+ constraints: {
5488
+ aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
5489
+ resolutions: ["720p"],
5490
+ durations: { min: 3, max: 20 },
5491
+ durationPresets: [5, 10, 15, 20],
5492
+ references: {
5493
+ ...NO_REFERENCES,
5494
+ images: 10,
5495
+ videos: 5,
5496
+ videoSeconds: { min: 3, max: 20.05, total: 20 },
5497
+ videoPixels: { minWidth: 700, minHeight: 700 }
5498
+ },
5499
+ supports: [],
5500
+ prompt: KLING_V4_FLASH_PROMPT,
5501
+ audio: KLING_V4_AUDIO
5502
+ },
5503
+ defaults: { durationSeconds: 5, resolution: "720p", aspectRatio: "16:9" },
5504
+ usage: { ...VIDEO_USAGE },
5505
+ pricingKind: "video_per_second",
5506
+ display: {
5507
+ provider: "kuaishou",
5508
+ logo: KLING_LOGO,
5509
+ 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."
5510
+ }
5511
+ },
5512
+ {
5513
+ // https://fal.ai/models/kling/v4/flash/video-to-video/api: source 3-20.05 s (700 px
5514
+ // min, 23.9-60.05 fps), up to 10 reference images and 4 reference videos; the source
5515
+ // and reference videos total 20 s at most. duration 3-20, or left out for the source's
5516
+ // length. The prompt names the source @Video1, reference videos @Video2 on, images @Image1.
5517
+ id: "kling-4.0-flash-edit",
5518
+ aliases: ["kling-4-flash-edit", "kling-v4-flash-edit"],
5519
+ label: "Kling 4.0 Flash Edit",
5520
+ type: "video",
5521
+ adapter: "fal",
5522
+ providerModelId: "kling/v4/flash/video-to-video",
5523
+ lifecycle: "active",
5524
+ exposure: ["cowork", "space_builder"],
5525
+ constraints: {
5526
+ resolutions: ["720p"],
5527
+ durations: { min: 3, max: 20 },
5528
+ references: {
5529
+ ...NO_REFERENCES,
5530
+ images: 10,
5531
+ videos: 4,
5532
+ videoSeconds: { min: 3, max: 20.05, total: 20 },
5533
+ videoPixels: { minWidth: 700, minHeight: 700 }
5534
+ },
5535
+ requires: ["sourceVideo"],
5536
+ sourceVideoSeconds: { min: 3, max: 20.05, inReferenceTotal: true },
5537
+ sourceVideoPixels: { minWidth: 700, minHeight: 700 },
5538
+ supports: [],
5539
+ prompt: KLING_V4_FLASH_PROMPT,
5540
+ audio: KLING_V4_AUDIO
5541
+ },
5542
+ defaults: { resolution: "720p" },
5543
+ usage: { ...VIDEO_USAGE },
5544
+ pricingKind: "video_per_second",
5545
+ display: {
5546
+ provider: "kuaishou",
5547
+ logo: KLING_LOGO,
5548
+ 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."
5549
+ },
5550
+ capabilities: { acceptsSourceVideo: true, videoEdit: true }
5551
+ },
5402
5552
  {
5403
5553
  // https://fal.ai/models/minimax/h3-max-turbo/text-to-video/api (+ /image-to-video).
5404
5554
  // image-to-video takes a start frame, an end frame, or both, and no aspect_ratio.
@@ -11854,8 +12004,13 @@ var MOTION_PRO = "fal-ai/kling-video/v3/pro/motion-control";
11854
12004
  var MOTION_STANDARD = "fal-ai/kling-video/v3/standard/motion-control";
11855
12005
  var O3_REFERENCE = "fal-ai/kling-video/o3/pro/reference-to-video";
11856
12006
  var O3_EDIT = "fal-ai/kling-video/o3/pro/video-to-video/edit";
11857
- var V4_FAMILY = "kling/v4";
11858
- var V4_EDIT = "kling/v4/video-to-video/edit";
12007
+ var V4 = { generate: "kling/v4", edit: "kling/v4/video-to-video/edit", flash: false };
12008
+ var V4_FLASH = {
12009
+ generate: "kling/v4/flash",
12010
+ edit: "kling/v4/flash/video-to-video",
12011
+ flash: true
12012
+ };
12013
+ var V4_VARIANTS = [V4, V4_FLASH];
11859
12014
  function motionControl(endpoint, req, ctx) {
11860
12015
  const [character] = req.referenceImages ?? [];
11861
12016
  const [motion] = req.referenceVideos ?? [];
@@ -11915,15 +12070,18 @@ var klingV3Family = {
11915
12070
  return motionControl(id, req, ctx);
11916
12071
  }
11917
12072
  };
11918
- function v4Generate(req, ctx) {
12073
+ function v4Generate(variant, req, ctx) {
11919
12074
  const images = urls(req.referenceImages);
11920
12075
  const videos = urls(req.referenceVideos);
11921
12076
  const duration = wholeSeconds(req, ctx);
11922
12077
  const resolution = resolutionOf(req, ctx);
11923
- const input = { prompt: req.prompt.trim(), duration, resolution };
12078
+ const references = images.length + videos.length > 0;
12079
+ const input = { duration, resolution };
12080
+ if (variant.flash && !references && req.firstFrame) optionalPrompt(input, req);
12081
+ else input["prompt"] = req.prompt.trim();
11924
12082
  let endpoint;
11925
- if (images.length + videos.length > 0) {
11926
- endpoint = `${V4_FAMILY}/reference-to-video`;
12083
+ if (references) {
12084
+ endpoint = `${variant.generate}/reference-to-video`;
11927
12085
  if (images.length > 0) input["image_urls"] = images;
11928
12086
  if (videos.length > 0) input["video_urls"] = videos;
11929
12087
  if (req.firstFrame) input["start_image_url"] = refToUrl(req.firstFrame);
@@ -11931,17 +12089,17 @@ function v4Generate(req, ctx) {
11931
12089
  input["aspect_ratio"] = req.aspectRatio === "adaptive" ? "auto" : req.aspectRatio;
11932
12090
  }
11933
12091
  } else if (req.firstFrame) {
11934
- endpoint = `${V4_FAMILY}/image-to-video`;
12092
+ endpoint = `${variant.generate}/image-to-video`;
11935
12093
  input["start_image_url"] = refToUrl(req.firstFrame);
11936
12094
  if (req.lastFrame) input["end_image_url"] = refToUrl(req.lastFrame);
11937
12095
  } else {
11938
- endpoint = `${V4_FAMILY}/text-to-video`;
12096
+ endpoint = `${variant.generate}/text-to-video`;
11939
12097
  const ratio = concreteRatio(req);
11940
12098
  if (ratio !== void 0) input["aspect_ratio"] = ratio;
11941
12099
  }
11942
12100
  return { endpoint, input, resolution, seconds: requestedSeconds(duration) };
11943
12101
  }
11944
- function v4Edit(req, ctx) {
12102
+ function v4Edit(variant, req, ctx) {
11945
12103
  if (req.sourceVideo === void 0) throw refusal(ctx, "needs a source video", "missing_input");
11946
12104
  const resolution = resolutionOf(req, ctx);
11947
12105
  const input = {
@@ -11951,9 +12109,11 @@ function v4Edit(req, ctx) {
11951
12109
  };
11952
12110
  const images = urls(req.referenceImages);
11953
12111
  if (images.length > 0) input["image_urls"] = images;
12112
+ const videos = urls(req.referenceVideos);
12113
+ if (variant.flash && videos.length > 0) input["video_urls"] = videos;
11954
12114
  if (req.durationSeconds === void 0) {
11955
12115
  return {
11956
- endpoint: V4_EDIT,
12116
+ endpoint: variant.edit,
11957
12117
  input,
11958
12118
  resolution,
11959
12119
  seconds: inputLengthSeconds(req, req.sourceVideo)
@@ -11961,13 +12121,18 @@ function v4Edit(req, ctx) {
11961
12121
  }
11962
12122
  const duration = wholeSeconds(req, ctx);
11963
12123
  input["duration"] = duration;
11964
- return { endpoint: V4_EDIT, input, resolution, seconds: requestedSeconds(duration) };
12124
+ return { endpoint: variant.edit, input, resolution, seconds: requestedSeconds(duration) };
11965
12125
  }
11966
- var KLING_V4_VIDEO_IDS = /* @__PURE__ */ new Set([V4_FAMILY, V4_EDIT]);
12126
+ var KLING_V4_VIDEO_IDS = new Set(
12127
+ V4_VARIANTS.flatMap((v) => [v.generate, v.edit])
12128
+ );
11967
12129
  var klingV4Family = {
11968
12130
  ids: KLING_V4_VIDEO_IDS,
11969
12131
  plan(req, ctx) {
11970
- return ctx.model.providerModelId.toLowerCase() === V4_EDIT ? v4Edit(req, ctx) : v4Generate(req, ctx);
12132
+ const id = ctx.model.providerModelId.toLowerCase();
12133
+ const edit2 = V4_VARIANTS.find((v) => v.edit === id);
12134
+ if (edit2 !== void 0) return v4Edit(edit2, req, ctx);
12135
+ return v4Generate(V4_VARIANTS.find((v) => v.generate === id) ?? V4, req, ctx);
11971
12136
  }
11972
12137
  };
11973
12138
 
@@ -12042,6 +12207,8 @@ var O3_REFERENCE2 = "fal-ai/kling-video/o3/pro/reference-to-video";
12042
12207
  var O3_EDIT2 = "fal-ai/kling-video/o3/pro/video-to-video/edit";
12043
12208
  var KLING_V4 = "kling/v4";
12044
12209
  var KLING_V4_EDIT = "kling/v4/video-to-video/edit";
12210
+ var KLING_V4_FLASH = "kling/v4/flash";
12211
+ var KLING_V4_FLASH_EDIT = "kling/v4/flash/video-to-video";
12045
12212
  var H3_TURBO = "minimax/h3-max-turbo";
12046
12213
  var H3_RECAST = "minimax/h3-max/recast";
12047
12214
  var H3_RELIGHT = "minimax/h3-max/relight";
@@ -12123,6 +12290,11 @@ function klingV4(req) {
12123
12290
  }
12124
12291
  return needsPrompt(req);
12125
12292
  }
12293
+ function klingV4Flash(req) {
12294
+ if (req.lastFrame !== void 0) return unsupported2("takes no end frame");
12295
+ if (!hasReferences(req) && req.firstFrame !== void 0) return void 0;
12296
+ return klingV4(req);
12297
+ }
12126
12298
  function h3Turbo(req) {
12127
12299
  if (count(req.referenceImages) + count(req.referenceVideos) > 0) {
12128
12300
  return unsupported2("takes no reference images or videos");
@@ -12203,6 +12375,8 @@ var RULES = /* @__PURE__ */ new Map([
12203
12375
  [O3_EDIT2, (req) => needsSource(req) ?? needsPrompt(req)],
12204
12376
  [KLING_V4, klingV4],
12205
12377
  [KLING_V4_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
12378
+ [KLING_V4_FLASH, klingV4Flash],
12379
+ [KLING_V4_FLASH_EDIT, (req) => needsSource(req) ?? needsPrompt(req)],
12206
12380
  [H3_TURBO, h3Turbo],
12207
12381
  [MINIMAX_H3_INSERT, h3Insert],
12208
12382
  [H3_RECAST, h3Recast],
@@ -12252,7 +12426,7 @@ function applyFalVideoRules(model, req, callerRatio, warnings) {
12252
12426
  warnings.push(viduSilentWarning(model));
12253
12427
  req.generateAudio = false;
12254
12428
  }
12255
- if (id === KLING_V4 && req.firstFrame !== void 0 && !hasReferences(req)) {
12429
+ if ((id === KLING_V4 || id === KLING_V4_FLASH) && req.firstFrame !== void 0 && !hasReferences(req)) {
12256
12430
  if (req.aspectRatio !== void 0) {
12257
12431
  if (callerRatio !== void 0) {
12258
12432
  warnings.push({