@shop-os/modelkit 0.23.1 → 0.24.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/CHANGELOG.md CHANGED
@@ -9,6 +9,31 @@ header in the release PR.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.24.1] - Unreleased
13
+
14
+ ### Added
15
+ - `kling-image-4.0` (ENG-4129): Kling Image 4.0 on fal, `kling/v4/text-to-image`; references
16
+ switch to `kling/v4/image-to-image` (up to 10, `@Image1`..`@Image10`). Sizes 2K and 4K only
17
+ (v4 has no 1K; native 8K needs an `8K` ImageSize, ENG-4137). Ratios: the eight Kling ratios plus
18
+ `adaptive` (fal's `auto`), count 1-9. The endpoints have no `output_format` or `seed` field, so
19
+ the row does not list them. Prompt cap 21,000 (Kling's non-English limit). $0.063 per image at
20
+ 2K, $0.094 at 4K; reference images ($0.003 each) are not billed. Live-checked 2026-11-18:
21
+ text-to-image and edit at 2K.
22
+
23
+ ## [0.24.0] - Unreleased
24
+
25
+ ### Added
26
+ - `seedance-2.5-draft` (ENG-4106): Seedance 2.5 in BytePlus draft mode, as its own row on the same
27
+ provider model. Every call renders a 480p draft (`draft: true`); the job id is the draft task id.
28
+ A call with `VideoRequest.draftTaskId` renders the final on the same row: the ark adapter sends
29
+ only the `draft_task` item, the resolution (`constraints.draft.finalResolutions`, `1080p`) and
30
+ `watermark`, because BytePlus refuses every inherited field (probed 2026-11-17). The adapter
31
+ refuses `draftTaskId` on a row without `constraints.draft`, another draft resolution, a task type
32
+ on the draft row and a final outside `finalResolutions` before any call. The row ships with no
33
+ exposure (internal); `constraints.draft` is a loose object, so older kits keep the row.
34
+ `resolveVideoOptions` gives a final (`draftTaskId`) the first of `finalResolutions` and checks
35
+ it against them, not against the row's draft-only `resolutions` or its 480p default.
36
+
12
37
  ## [0.23.1] - Unreleased
13
38
 
14
39
  ### Changed
package/dist/catalog.cjs CHANGED
@@ -443,6 +443,34 @@ var FAL_IMAGE_MODELS = [
443
443
  logo: `${LOBE}/kling-color.png`
444
444
  }
445
445
  },
446
+ {
447
+ // kling/v4/text-to-image; references switch to kling/v4/image-to-image (up to 10,
448
+ // "@Image1".."@Image10"). Per output image: $0.063 at 2K, $0.094 at 4K (Kling price page,
449
+ // 2026-11-17); each reference adds $0.003, which we absorb. Native 8K is ENG-4137.
450
+ id: "kling-image-4.0",
451
+ aliases: [],
452
+ label: "Kling Image 4.0",
453
+ type: "image",
454
+ adapter: "fal",
455
+ providerModelId: "kling/v4/text-to-image",
456
+ lifecycle: "active",
457
+ exposure: EXPOSURE,
458
+ constraints: {
459
+ aspectRatios: [...KLING_RATIOS, "adaptive"],
460
+ sizes: ["2K", "4K"],
461
+ references: { images: 10 },
462
+ supports: ["count"],
463
+ prompt: { referenceSyntax: "numbered", maxChars: 21e3 }
464
+ },
465
+ defaults: { size: "2K", aspectRatio: "adaptive", count: 1 },
466
+ usage: { ...IMAGE_USAGE },
467
+ pricingKind: "image_size",
468
+ display: {
469
+ provider: "kuaishou",
470
+ description: "Kling Image 4.0 for photoreal text-to-image, long in-image text and multi-reference editing; takes a prompt and up to 10 reference images and outputs 2K or 4K.",
471
+ logo: `${LOBE}/kling-color.png`
472
+ }
473
+ },
446
474
  {
447
475
  // fal-ai/kling-image/v3/text-to-image; a reference switches to .../v3/image-to-image, which
448
476
  // takes exactly one image_url and no "auto" ratio. $0.028 per image.
@@ -6433,6 +6461,54 @@ var VIDEO_MODELS = [
6433
6461
  },
6434
6462
  capabilities: { acceptsSourceVideo: true, videoEdit: true, ...FRAMES_EXCLUDE_REFERENCES }
6435
6463
  },
6464
+ {
6465
+ // The same BytePlus model in draft mode. Probed 2026-11-17: a draft must be 480p; its
6466
+ // final is a second task on this row (draftTaskId), and 720p or no resolution is refused
6467
+ // there. A 4k final also rendered, but the docs list 1080p only. No alias for the provider
6468
+ // id: that alias resolves usage to seedance-2.5. Edit and extend stay on seedance-2.5.
6469
+ id: "seedance-2.5-draft",
6470
+ aliases: ["seedance-2-5-draft"],
6471
+ label: "Seedance 2.5 Draft",
6472
+ type: "video",
6473
+ adapter: "ark",
6474
+ providerModelId: "dreamina-seedance-2-5-260628",
6475
+ lifecycle: "active",
6476
+ exposure: [],
6477
+ constraints: {
6478
+ aspectRatios: [...SEEDANCE_RATIOS],
6479
+ resolutions: ["480p"],
6480
+ durations: { min: 4, max: 30 },
6481
+ references: {
6482
+ images: 30,
6483
+ videos: 10,
6484
+ audios: 10,
6485
+ videoSeconds: { min: 2, max: 30, total: 30 },
6486
+ ...SEEDANCE_REFERENCE_MEDIA,
6487
+ audioSeconds: { min: 2, max: 30, total: 30 },
6488
+ audioFormats: ["wav", "mp3"],
6489
+ audioMaxBytes: 15 * 1024 * 1024
6490
+ },
6491
+ ratioIgnoredWith: ["firstFrame"],
6492
+ supports: ["generateAudio", "lastFrame", "watermark"],
6493
+ draft: { resolution: "480p", finalResolutions: ["1080p"], ttlDays: 14 },
6494
+ prompt: SEEDANCE_PROMPT,
6495
+ audio: "optional"
6496
+ },
6497
+ defaults: {
6498
+ durationSeconds: 5,
6499
+ resolution: "480p",
6500
+ aspectRatio: "16:9",
6501
+ generateAudio: true
6502
+ },
6503
+ usage: { ...VIDEO_USAGE3 },
6504
+ pricingKind: "video_per_second",
6505
+ display: {
6506
+ provider: "bytedance",
6507
+ logo: BYTEDANCE_LOGO2,
6508
+ description: "A quick 480p Seedance 2.5 preview. Render the 1080p final from it within 14 days; the final keeps the draft's scene and motion."
6509
+ },
6510
+ capabilities: { acceptsSourceVideo: false, videoEdit: false, ...FRAMES_EXCLUDE_REFERENCES }
6511
+ },
6436
6512
  {
6437
6513
  // Limits probed on the live API 2026-11-16 (1080p is refused). Extend probe: a 4 s
6438
6514
  // extend returned 4 s of new footage only and billed input + output tokens, as on 2.5.
@@ -8416,6 +8492,13 @@ var ModelConstraintsSchema = import_zod3.z.looseObject({
8416
8492
  maxTotalSeconds: import_zod3.z.number(),
8417
8493
  returns: import_zod3.z.enum(["new", "joined"]).optional()
8418
8494
  }).optional(),
8495
+ // Loose so a kit before 0.24.0 keeps a row that carries it (an unknown `supports` value
8496
+ // would drop the row there).
8497
+ draft: import_zod3.z.looseObject({
8498
+ resolution: VideoResolutionSchema,
8499
+ finalResolutions: import_zod3.z.array(VideoResolutionSchema).min(1),
8500
+ ttlDays: import_zod3.z.number().positive()
8501
+ }).optional(),
8419
8502
  tool: VideoToolConstraintsSchema.optional(),
8420
8503
  model3d: Model3dConstraintsSchema.optional(),
8421
8504
  // Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
@@ -9529,6 +9612,20 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
9529
9612
  aspectRatios: KLING_RATIOS3
9530
9613
  }
9531
9614
  ],
9615
+ [
9616
+ // No output_format or seed field. Kling caps non-English prompts at 21,000 characters
9617
+ // (API update 2026-11-17), under the schema's 50,000.
9618
+ "kling/v4/text-to-image",
9619
+ {
9620
+ label: "Kling Image 4.0",
9621
+ maxReferences: 10,
9622
+ maxCount: 9,
9623
+ outputFormats: [],
9624
+ promptMax: 21e3,
9625
+ promptRequired: true,
9626
+ aspectRatios: [...KLING_RATIOS3, "adaptive"]
9627
+ }
9628
+ ],
9532
9629
  [
9533
9630
  "recraft/v4.1/flash/text-to-image",
9534
9631
  {
@@ -10024,6 +10121,25 @@ function resolveVideoResolution(requested, model, onUnsupported, warnings) {
10024
10121
  warnings
10025
10122
  );
10026
10123
  }
10124
+ function resolveDraftFinalResolution(requested, draft, model, onUnsupported, warnings) {
10125
+ const [first] = draft.finalResolutions;
10126
+ if (requested === void 0 || draft.finalResolutions.includes(requested))
10127
+ return requested ?? first;
10128
+ if (onUnsupported === "error") {
10129
+ throw new ModelKitError({
10130
+ code: "unsupported_option",
10131
+ message: `${model.id} renders a final from a draft at ${draft.finalResolutions.join(", ")} only`,
10132
+ model: model.id,
10133
+ retryable: false
10134
+ });
10135
+ }
10136
+ warnings.push({
10137
+ code: "resolution_coerced",
10138
+ field: "resolution",
10139
+ message: `${model.id} renders a final at ${String(first)}, not ${requested}`
10140
+ });
10141
+ return first;
10142
+ }
10027
10143
  function resolveDuration(requested, durations, model, onUnsupported, warnings) {
10028
10144
  if (requested === void 0 || !durations) return requested;
10029
10145
  const inSet = Array.isArray(durations) ? durations.includes(requested) : requested >= durations.min && requested <= durations.max;
@@ -10351,7 +10467,13 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
10351
10467
  );
10352
10468
  if (aspectRatio !== void 0) merged.aspectRatio = aspectRatio;
10353
10469
  fillKlingModeResolution(model, merged);
10354
- const resolution = resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
10470
+ const resolution = merged.draftTaskId !== void 0 && c.draft ? resolveDraftFinalResolution(
10471
+ request.resolution,
10472
+ c.draft,
10473
+ model,
10474
+ onUnsupported,
10475
+ warnings
10476
+ ) : resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
10355
10477
  if (resolution !== void 0) merged.resolution = resolution;
10356
10478
  if (takesKlingMode(model)) delete merged.mode;
10357
10479
  const duration = resolveDuration(