@nodaro/shared 3.58.0 → 3.60.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/{chunk-OWNPYQSH.cjs → chunk-4GGLKRYI.cjs} +16 -3
- package/dist/chunk-4GGLKRYI.cjs.map +1 -0
- package/dist/{chunk-5PJC4ZWO.cjs → chunk-5G23AJBU.cjs} +6 -6
- package/dist/{chunk-5PJC4ZWO.cjs.map → chunk-5G23AJBU.cjs.map} +1 -1
- package/dist/{chunk-IKOKRJDI.cjs → chunk-5HK5Z5OB.cjs} +4 -4
- package/dist/{chunk-IKOKRJDI.cjs.map → chunk-5HK5Z5OB.cjs.map} +1 -1
- package/dist/{chunk-WLFT5UVV.cjs → chunk-5Y42RIGY.cjs} +8 -8
- package/dist/{chunk-WLFT5UVV.cjs.map → chunk-5Y42RIGY.cjs.map} +1 -1
- package/dist/{chunk-L26G7B27.js → chunk-6AJOTEVC.js} +3 -3
- package/dist/{chunk-L26G7B27.js.map → chunk-6AJOTEVC.js.map} +1 -1
- package/dist/{chunk-OMUYZKRB.js → chunk-6Q6SI7AG.js} +3 -3
- package/dist/{chunk-OMUYZKRB.js.map → chunk-6Q6SI7AG.js.map} +1 -1
- package/dist/{chunk-4ZZ6SVIQ.cjs → chunk-A6HRY3WF.cjs} +269 -37
- package/dist/chunk-A6HRY3WF.cjs.map +1 -0
- package/dist/{chunk-ZX6RRM6R.cjs → chunk-AXT7YNOR.cjs} +51 -51
- package/dist/{chunk-ZX6RRM6R.cjs.map → chunk-AXT7YNOR.cjs.map} +1 -1
- package/dist/{chunk-ODTZV3BW.js → chunk-AZGONXWV.js} +4 -4
- package/dist/{chunk-ODTZV3BW.js.map → chunk-AZGONXWV.js.map} +1 -1
- package/dist/{chunk-S5VBJJUT.cjs → chunk-BDXXOEBZ.cjs} +80 -57
- package/dist/chunk-BDXXOEBZ.cjs.map +1 -0
- package/dist/{chunk-QPBBIRLF.cjs → chunk-BGIJO5V4.cjs} +39 -39
- package/dist/{chunk-QPBBIRLF.cjs.map → chunk-BGIJO5V4.cjs.map} +1 -1
- package/dist/{chunk-NZRG5CXQ.cjs → chunk-BLJUCPMV.cjs} +5 -2
- package/dist/chunk-BLJUCPMV.cjs.map +1 -0
- package/dist/{chunk-KYHDKKUJ.cjs → chunk-BXNPO3PL.cjs} +8 -8
- package/dist/{chunk-KYHDKKUJ.cjs.map → chunk-BXNPO3PL.cjs.map} +1 -1
- package/dist/{chunk-S7FCFQ6X.js → chunk-CF4S4N5X.js} +16 -4
- package/dist/chunk-CF4S4N5X.js.map +1 -0
- package/dist/{chunk-4UUX62S3.cjs → chunk-CIOXUPCJ.cjs} +12 -12
- package/dist/{chunk-4UUX62S3.cjs.map → chunk-CIOXUPCJ.cjs.map} +1 -1
- package/dist/{chunk-5UVBFY2G.cjs → chunk-DQIJPDHC.cjs} +11 -11
- package/dist/{chunk-5UVBFY2G.cjs.map → chunk-DQIJPDHC.cjs.map} +1 -1
- package/dist/{chunk-UMPZR56R.js → chunk-DS2TOM32.js} +3 -3
- package/dist/{chunk-UMPZR56R.js.map → chunk-DS2TOM32.js.map} +1 -1
- package/dist/{chunk-K6UMB37V.js → chunk-EN2YI5TV.js} +3 -3
- package/dist/{chunk-K6UMB37V.js.map → chunk-EN2YI5TV.js.map} +1 -1
- package/dist/{chunk-SEQ5L72K.js → chunk-G6GMY5BC.js} +21 -4
- package/dist/chunk-G6GMY5BC.js.map +1 -0
- package/dist/chunk-G7ZYZQKO.cjs +27 -0
- package/dist/{chunk-QCW6J6BQ.cjs.map → chunk-G7ZYZQKO.cjs.map} +1 -1
- package/dist/{chunk-WBERPAXE.cjs → chunk-GNPJ2JLE.cjs} +6 -6
- package/dist/{chunk-WBERPAXE.cjs.map → chunk-GNPJ2JLE.cjs.map} +1 -1
- package/dist/{chunk-VZXRDSWA.cjs → chunk-GWBQ3GPO.cjs} +43 -21
- package/dist/chunk-GWBQ3GPO.cjs.map +1 -0
- package/dist/{chunk-DCP7JFSE.cjs → chunk-HDHLZK7C.cjs} +5 -5
- package/dist/{chunk-DCP7JFSE.cjs.map → chunk-HDHLZK7C.cjs.map} +1 -1
- package/dist/{chunk-QVPIO2NU.cjs → chunk-HNEF2N5C.cjs} +5 -5
- package/dist/{chunk-QVPIO2NU.cjs.map → chunk-HNEF2N5C.cjs.map} +1 -1
- package/dist/{chunk-7JM5EZF3.cjs → chunk-HOKWJXHA.cjs} +13 -13
- package/dist/{chunk-7JM5EZF3.cjs.map → chunk-HOKWJXHA.cjs.map} +1 -1
- package/dist/{chunk-FVKCNAEQ.js → chunk-HP3YIWNJ.js} +9 -4
- package/dist/chunk-HP3YIWNJ.js.map +1 -0
- package/dist/{chunk-UJJUX6NW.cjs → chunk-HW6TLOK4.cjs} +9 -3
- package/dist/chunk-HW6TLOK4.cjs.map +1 -0
- package/dist/{chunk-A5ESI2NY.js → chunk-ICDLYU4I.js} +9 -9
- package/dist/{chunk-A5ESI2NY.js.map → chunk-ICDLYU4I.js.map} +1 -1
- package/dist/{chunk-JUEFRVHZ.js → chunk-IV6IDECY.js} +4 -4
- package/dist/{chunk-JUEFRVHZ.js.map → chunk-IV6IDECY.js.map} +1 -1
- package/dist/{chunk-HEUWAIXG.js → chunk-JKZVRKN3.js} +36 -14
- package/dist/chunk-JKZVRKN3.js.map +1 -0
- package/dist/{chunk-ZMH56CLL.js → chunk-KJZVQIN4.js} +3 -3
- package/dist/{chunk-ZMH56CLL.js.map → chunk-KJZVQIN4.js.map} +1 -1
- package/dist/{chunk-6CYS7VRH.js → chunk-KOLC7AF2.js} +262 -38
- package/dist/chunk-KOLC7AF2.js.map +1 -0
- package/dist/{chunk-CNSRCZYY.js → chunk-LN3EVFRS.js} +5 -5
- package/dist/{chunk-CNSRCZYY.js.map → chunk-LN3EVFRS.js.map} +1 -1
- package/dist/{chunk-DC2QPACA.js → chunk-MHY47BLL.js} +4 -4
- package/dist/{chunk-DC2QPACA.js.map → chunk-MHY47BLL.js.map} +1 -1
- package/dist/{chunk-AWS4BWEC.js → chunk-Q6IES3U2.js} +5 -2
- package/dist/chunk-Q6IES3U2.js.map +1 -0
- package/dist/{chunk-PK4ZR2SK.cjs → chunk-RRPPXZ36.cjs} +4 -4
- package/dist/{chunk-PK4ZR2SK.cjs.map → chunk-RRPPXZ36.cjs.map} +1 -1
- package/dist/{chunk-6TFWFYYI.js → chunk-SCYBGTX6.js} +3 -3
- package/dist/{chunk-6TFWFYYI.js.map → chunk-SCYBGTX6.js.map} +1 -1
- package/dist/{chunk-I7NG2D6X.cjs → chunk-SKFJIFEV.cjs} +21 -21
- package/dist/{chunk-I7NG2D6X.cjs.map → chunk-SKFJIFEV.cjs.map} +1 -1
- package/dist/{chunk-VVGSIWNL.js → chunk-TZ42IVSF.js} +4 -4
- package/dist/{chunk-VVGSIWNL.js.map → chunk-TZ42IVSF.js.map} +1 -1
- package/dist/{chunk-IQBIH3AE.js → chunk-URLDVK67.js} +3 -3
- package/dist/{chunk-IQBIH3AE.js.map → chunk-URLDVK67.js.map} +1 -1
- package/dist/{chunk-IOET54EV.js → chunk-VB2ARGQ6.js} +35 -3
- package/dist/chunk-VB2ARGQ6.js.map +1 -0
- package/dist/{chunk-BSENM6HM.js → chunk-VYQ25YQF.js} +3 -3
- package/dist/{chunk-BSENM6HM.js.map → chunk-VYQ25YQF.js.map} +1 -1
- package/dist/{chunk-QSWUSXRL.cjs → chunk-WGKAOUEQ.cjs} +41 -2
- package/dist/chunk-WGKAOUEQ.cjs.map +1 -0
- package/dist/{chunk-M7SMSAOU.js → chunk-YHVEZVAO.js} +4 -4
- package/dist/{chunk-M7SMSAOU.js.map → chunk-YHVEZVAO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -43
- package/dist/entries/apps.js +8 -8
- package/dist/entries/credits.cjs +155 -151
- package/dist/entries/credits.d.cts +32 -3
- package/dist/entries/credits.d.ts +32 -3
- package/dist/entries/credits.js +8 -8
- package/dist/entries/edl.cjs +63 -59
- package/dist/entries/edl.d.cts +15 -1
- package/dist/entries/edl.d.ts +15 -1
- package/dist/entries/edl.js +1 -1
- package/dist/entries/llm-models.d.cts +1 -1
- package/dist/entries/llm-models.d.ts +1 -1
- package/dist/entries/model-catalog.cjs +144 -84
- package/dist/entries/model-catalog.d.cts +4 -47
- package/dist/entries/model-catalog.d.ts +4 -47
- package/dist/entries/model-catalog.js +5 -5
- package/dist/entries/models.cjs +308 -288
- package/dist/entries/models.d.cts +3 -3
- package/dist/entries/models.d.ts +3 -3
- package/dist/entries/models.js +4 -4
- package/dist/entries/nodes.cjs +208 -208
- package/dist/entries/nodes.d.cts +1 -1
- package/dist/entries/nodes.d.ts +1 -1
- package/dist/entries/nodes.js +10 -10
- package/dist/entries/pipeline.cjs +152 -152
- package/dist/entries/pipeline.d.cts +1 -1
- package/dist/entries/pipeline.d.ts +1 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/runtime-config.cjs +32 -28
- package/dist/entries/runtime-config.d.cts +24 -2
- package/dist/entries/runtime-config.d.ts +24 -2
- package/dist/entries/runtime-config.js +1 -1
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +117 -117
- package/dist/entries/video.js +4 -4
- package/dist/entries/workflow.cjs +147 -147
- package/dist/entries/workflow.d.cts +8 -0
- package/dist/entries/workflow.d.ts +8 -0
- package/dist/entries/workflow.js +2 -2
- package/dist/gpt-image-2-6-BeZdT-pW.d.cts +98 -0
- package/dist/gpt-image-2-6-BeZdT-pW.d.ts +98 -0
- package/dist/index.cjs +1412 -1320
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +22 -22
- package/dist/{model-catalog-CCsA1isC.d.ts → model-catalog-D6Es7VG-.d.cts} +59 -3
- package/dist/{model-catalog-CCsA1isC.d.cts → model-catalog-D6Es7VG-.d.ts} +59 -3
- package/dist/{model-constants-BtXkUsX3.d.cts → model-constants-22k3fjp1.d.cts} +22 -1
- package/dist/{model-constants-BtXkUsX3.d.ts → model-constants-22k3fjp1.d.ts} +22 -1
- package/package.json +1 -1
- package/src/__tests__/camera-switch-contract.test.ts +12 -3
- package/src/__tests__/credit-identifiers.test.ts +18 -9
- package/src/__tests__/gpt-image-2-6-formats.test.ts +171 -0
- package/src/__tests__/gpt-image-2-size-rules.test.ts +80 -0
- package/src/__tests__/normalize-model-input.test.ts +10 -10
- package/src/__tests__/runtime-config.test.ts +28 -0
- package/src/camera-switch-contract.ts +13 -1
- package/src/credit-identifiers.ts +63 -3
- package/src/entries/credits.ts +1 -0
- package/src/entries/model-catalog.ts +17 -0
- package/src/entries/models.ts +7 -0
- package/src/entries/runtime-config.ts +1 -0
- package/src/gpt-image-2-6.ts +72 -0
- package/src/model-catalog.ts +350 -40
- package/src/model-constants.ts +40 -0
- package/src/node-execution-state.ts +8 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/runtime-config/contract.ts +34 -0
- package/dist/chunk-4ZZ6SVIQ.cjs.map +0 -1
- package/dist/chunk-6CYS7VRH.js.map +0 -1
- package/dist/chunk-AWS4BWEC.js.map +0 -1
- package/dist/chunk-FVKCNAEQ.js.map +0 -1
- package/dist/chunk-HEUWAIXG.js.map +0 -1
- package/dist/chunk-IOET54EV.js.map +0 -1
- package/dist/chunk-NZRG5CXQ.cjs.map +0 -1
- package/dist/chunk-OWNPYQSH.cjs.map +0 -1
- package/dist/chunk-QCW6J6BQ.cjs +0 -27
- package/dist/chunk-QSWUSXRL.cjs.map +0 -1
- package/dist/chunk-S5VBJJUT.cjs.map +0 -1
- package/dist/chunk-S7FCFQ6X.js.map +0 -1
- package/dist/chunk-SEQ5L72K.js.map +0 -1
- package/dist/chunk-UJJUX6NW.cjs.map +0 -1
- package/dist/chunk-VZXRDSWA.cjs.map +0 -1
package/src/model-catalog.ts
CHANGED
|
@@ -379,6 +379,25 @@ export interface ModelCatalogEntry {
|
|
|
379
379
|
* `transparentResolution`. Above it nothing is sent.
|
|
380
380
|
*/
|
|
381
381
|
backgroundOnlyAtTransparentResolution?: true
|
|
382
|
+
/**
|
|
383
|
+
* The files this image model can write (`png`, `jpeg`, `webp`, `gif`, `svg`),
|
|
384
|
+
* the first being what it writes when none is named. Absent: a single format,
|
|
385
|
+
* not a setting, and a value sent is dropped. With `gif` the aspect ratio and
|
|
386
|
+
* size do not apply (a GIF is square, `IMAGE_GIF_FRAME_SIZE` a frame), and a
|
|
387
|
+
* transparent background is only kept with `png` and `webp`
|
|
388
|
+
* (`TRANSPARENT_OUTPUT_FORMATS`); `normalizeModelInput` says what it moved.
|
|
389
|
+
*/
|
|
390
|
+
outputFormats?: readonly string[]
|
|
391
|
+
/**
|
|
392
|
+
* How many frames a GIF of this model can have: a whole number from `min` to
|
|
393
|
+
* `max`, or one of `values` when the provider takes only some. Read only when
|
|
394
|
+
* `outputFormats` lists `gif`.
|
|
395
|
+
*/
|
|
396
|
+
gifFrames?: { readonly min: number; readonly max: number; readonly default: number; readonly values?: readonly number[] }
|
|
397
|
+
/** How long each frame of a GIF shows, in ms: `min` to `max` in steps of `step`. */
|
|
398
|
+
gifFrameDurationMs?: { readonly min: number; readonly max: number; readonly step: number; readonly default: number }
|
|
399
|
+
/** The levels of detail an SVG of this model is drawn at (`standard`, `detailed`, `max`), the first the default. Read only when `outputFormats` lists `svg`. */
|
|
400
|
+
svgLevels?: readonly string[]
|
|
382
401
|
durations?: readonly number[]
|
|
383
402
|
/**
|
|
384
403
|
* The length (seconds) this model renders when the request names no duration
|
|
@@ -500,6 +519,12 @@ const FLUX_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"] as const
|
|
|
500
519
|
const KONTEXT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "21:9"] as const
|
|
501
520
|
const GROK_RATIOS = ["1:1", "16:9", "9:16", "3:2", "2:3"] as const
|
|
502
521
|
const GPT_IMAGE_RATIOS = ["1:1", "3:2", "2:3"] as const
|
|
522
|
+
// GPT Image 2 (text-to-image and image-to-image) renders every one of these
|
|
523
|
+
// ratios at 1K, 2K and 4K, "auto" and 1:1 included (checked 2026-11-10: 1:1 at
|
|
524
|
+
// 4K came back 2880x2880, "auto" at 2K 2048x2048, and an edit at "auto" and 2K
|
|
525
|
+
// kept a 768x1024 photo's shape at 1536x2048), so it declares no
|
|
526
|
+
// `resolutionsByAspectRatio`. The provider's docs limit 2K and 4K only at ratios
|
|
527
|
+
// it does not offer here (5:4, 4:5, 3:1, 1:3, 9:21).
|
|
503
528
|
const GPT_IMAGE_2_RATIOS = ["auto", "1:1", "16:9", "9:16", "4:3", "3:4"] as const
|
|
504
529
|
// GPT Image 2.5 (Flare + Sunburst) widen the set to thirteen — the GPT Image 2
|
|
505
530
|
// six plus 3:2/2:3, ultra-wide 21:9/27:16, ultra-tall 16:27 and near-square
|
|
@@ -536,6 +561,17 @@ const GPT_IMAGE_2_6_VALUE_LABELS = {
|
|
|
536
561
|
// The GPT Image background setting. KIE renders a transparent one at 1K only
|
|
537
562
|
// (`transparentResolution`), which normalizeModelInput enforces.
|
|
538
563
|
const GPT_IMAGE_BACKGROUNDS = ["auto", "opaque", "transparent"] as const
|
|
564
|
+
// GPT Image 2.6's files (docs.kie.ai/market/gpt/gpt-image-2-6-*). Flare and
|
|
565
|
+
// Sunburst write PNG, JPEG, WebP, an animated GIF or an SVG, from a prompt and
|
|
566
|
+
// from an edit; a GIF has 2 to 16 frames (KIE's cap, not the 64 of the model's
|
|
567
|
+
// own guide), each shown 20 to 2000 ms in steps of 10. Economy writes a PNG or
|
|
568
|
+
// a GIF from a prompt and a PNG from an edit, and takes a GIF's frames only as
|
|
569
|
+
// 4, 9, 16, 25, 36 or 64: the platform offers those up to 16.
|
|
570
|
+
const GPT_IMAGE_2_6_FORMATS = ["png", "jpeg", "webp", "gif", "svg"] as const
|
|
571
|
+
const GPT_IMAGE_2_6_GIF_FRAMES = { min: 2, max: 16, default: 9 } as const
|
|
572
|
+
const GPT_IMAGE_2_6_GIF_FRAME_DURATION = { min: 20, max: 2000, step: 10, default: 200 } as const
|
|
573
|
+
const GPT_IMAGE_2_6_ECONOMY_GIF_FRAMES = { min: 4, max: 16, default: 9, values: [4, 9, 16] } as const
|
|
574
|
+
const GPT_IMAGE_2_6_SVG_LEVELS = ["standard", "detailed", "max"] as const
|
|
539
575
|
const IMAGEN4_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4"] as const
|
|
540
576
|
const IDEOGRAM_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4"] as const
|
|
541
577
|
const SEEDREAM_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "21:9"] as const
|
|
@@ -1066,7 +1102,7 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1066
1102
|
maker: "openai",
|
|
1067
1103
|
label: "GPT Image 2.6 Flare",
|
|
1068
1104
|
series: "GPT Image",
|
|
1069
|
-
description: "Fast GPT Image 2.6 - pick it for speed: posters, product shots and quick iteration, with stronger layouts. Up to 4K, quality from low to max or auto (priced up to the max), a transparent background at 1K.",
|
|
1105
|
+
description: "Fast GPT Image 2.6 - pick it for speed: posters, product shots and quick iteration, with stronger layouts. Up to 4K, quality from low to max or auto (priced up to the max), a transparent background at 1K. Writes PNG, JPEG, WebP, an animated GIF or an SVG.",
|
|
1070
1106
|
useCases: ["typography", "high-res", "general", "draft"],
|
|
1071
1107
|
features: ["reference-image"],
|
|
1072
1108
|
aspectRatios: GPT_IMAGE_2_6_RATIOS,
|
|
@@ -1076,6 +1112,10 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1076
1112
|
defaultQuality: "medium",
|
|
1077
1113
|
backgrounds: GPT_IMAGE_BACKGROUNDS,
|
|
1078
1114
|
transparentResolution: "1K",
|
|
1115
|
+
outputFormats: GPT_IMAGE_2_6_FORMATS,
|
|
1116
|
+
gifFrames: GPT_IMAGE_2_6_GIF_FRAMES,
|
|
1117
|
+
gifFrameDurationMs: GPT_IMAGE_2_6_GIF_FRAME_DURATION,
|
|
1118
|
+
svgLevels: GPT_IMAGE_2_6_SVG_LEVELS,
|
|
1079
1119
|
pricing: [
|
|
1080
1120
|
{ identifier: "gpt-image-2-6-flare", credits: 20, note: "medium, 1K default" },
|
|
1081
1121
|
{ identifier: "gpt-image-2-6-flare:low:1K", credits: 12, note: "low, 1K" },
|
|
@@ -1096,6 +1136,33 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1096
1136
|
{ identifier: "gpt-image-2-6-flare:auto:1K", credits: 96, note: "auto, 1K: the most it can cost, settled on what it really cost" },
|
|
1097
1137
|
{ identifier: "gpt-image-2-6-flare:auto:2K", credits: 193, note: "auto, 2K: the most it can cost, settled on what it really cost" },
|
|
1098
1138
|
{ identifier: "gpt-image-2-6-flare:auto:4K", credits: 321, note: "auto, 4K: the most it can cost, settled on what it really cost" },
|
|
1139
|
+
{ identifier: "gpt-image-2-6-flare:low:gif-2-8", credits: 8, note: "GIF, low, 2 to 8 frames" },
|
|
1140
|
+
{ identifier: "gpt-image-2-6-flare:low:gif-9-12", credits: 17, note: "GIF, low, 9 to 12 frames" },
|
|
1141
|
+
{ identifier: "gpt-image-2-6-flare:low:gif-13-16", credits: 23, note: "GIF, low, 13 to 16 frames" },
|
|
1142
|
+
{ identifier: "gpt-image-2-6-flare:medium:gif-2-8", credits: 14, note: "GIF, medium, 2 to 8 frames" },
|
|
1143
|
+
{ identifier: "gpt-image-2-6-flare:medium:gif-9-12", credits: 29, note: "GIF, medium, 9 to 12 frames" },
|
|
1144
|
+
{ identifier: "gpt-image-2-6-flare:medium:gif-13-16", credits: 41, note: "GIF, medium, 13 to 16 frames" },
|
|
1145
|
+
{ identifier: "gpt-image-2-6-flare:high:gif-2-8", credits: 17, note: "GIF, high, 2 to 8 frames" },
|
|
1146
|
+
{ identifier: "gpt-image-2-6-flare:high:gif-9-12", credits: 35, note: "GIF, high, 9 to 12 frames" },
|
|
1147
|
+
{ identifier: "gpt-image-2-6-flare:high:gif-13-16", credits: 49, note: "GIF, high, 13 to 16 frames" },
|
|
1148
|
+
{ identifier: "gpt-image-2-6-flare:xhigh:gif-2-8", credits: 29, note: "GIF, extra high, 2 to 8 frames" },
|
|
1149
|
+
{ identifier: "gpt-image-2-6-flare:xhigh:gif-9-12", credits: 61, note: "GIF, extra high, 9 to 12 frames" },
|
|
1150
|
+
{ identifier: "gpt-image-2-6-flare:xhigh:gif-13-16", credits: 86, note: "GIF, extra high, 13 to 16 frames" },
|
|
1151
|
+
{ identifier: "gpt-image-2-6-flare:max:gif-2-8", credits: 65, note: "GIF, max, 2 to 8 frames" },
|
|
1152
|
+
{ identifier: "gpt-image-2-6-flare:max:gif-9-12", credits: 136, note: "GIF, max, 9 to 12 frames" },
|
|
1153
|
+
{ identifier: "gpt-image-2-6-flare:max:gif-13-16", credits: 194, note: "GIF, max, 13 to 16 frames" },
|
|
1154
|
+
{ identifier: "gpt-image-2-6-flare:auto:gif-2-8", credits: 65, note: "GIF, auto, 2 to 8 frames: the most it can cost, settled on what it really cost" },
|
|
1155
|
+
{ identifier: "gpt-image-2-6-flare:auto:gif-9-12", credits: 136, note: "GIF, auto, 9 to 12 frames: the most it can cost, settled on what it really cost" },
|
|
1156
|
+
{ identifier: "gpt-image-2-6-flare:auto:gif-13-16", credits: 194, note: "GIF, auto, 13 to 16 frames: the most it can cost, settled on what it really cost" },
|
|
1157
|
+
{ identifier: "gpt-image-2-6-flare:medium:1K:svg-standard", credits: 25, note: "SVG standard, medium, 1K" },
|
|
1158
|
+
{ identifier: "gpt-image-2-6-flare:medium:2K:svg-standard", credits: 45, note: "SVG standard, medium, 2K" },
|
|
1159
|
+
{ identifier: "gpt-image-2-6-flare:medium:4K:svg-standard", credits: 72, note: "SVG standard, medium, 4K" },
|
|
1160
|
+
{ identifier: "gpt-image-2-6-flare:medium:1K:svg-detailed", credits: 64, note: "SVG detailed, medium, 1K" },
|
|
1161
|
+
{ identifier: "gpt-image-2-6-flare:medium:2K:svg-detailed", credits: 84, note: "SVG detailed, medium, 2K" },
|
|
1162
|
+
{ identifier: "gpt-image-2-6-flare:medium:4K:svg-detailed", credits: 111, note: "SVG detailed, medium, 4K" },
|
|
1163
|
+
{ identifier: "gpt-image-2-6-flare:medium:1K:svg-max", credits: 81, note: "SVG max, medium, 1K" },
|
|
1164
|
+
{ identifier: "gpt-image-2-6-flare:medium:2K:svg-max", credits: 101, note: "SVG max, medium, 2K" },
|
|
1165
|
+
{ identifier: "gpt-image-2-6-flare:medium:4K:svg-max", credits: 128, note: "SVG max, medium, 4K" },
|
|
1099
1166
|
],
|
|
1100
1167
|
valueLabels: GPT_IMAGE_2_6_VALUE_LABELS,
|
|
1101
1168
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
@@ -1108,7 +1175,7 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1108
1175
|
maker: "openai",
|
|
1109
1176
|
label: "GPT Image 2.6 Flare (I2I)",
|
|
1110
1177
|
series: "GPT Image",
|
|
1111
|
-
description: "Fast GPT Image 2.6 edits - up to 16 input images, priced per image. Pick it while iterating.",
|
|
1178
|
+
description: "Fast GPT Image 2.6 edits - up to 16 input images, priced per image. Writes PNG, JPEG, WebP, an animated GIF or an SVG. Pick it while iterating.",
|
|
1112
1179
|
useCases: ["edit", "high-res"],
|
|
1113
1180
|
features: ["reference-image"],
|
|
1114
1181
|
aspectRatios: GPT_IMAGE_2_6_RATIOS,
|
|
@@ -1118,6 +1185,10 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1118
1185
|
defaultQuality: "medium",
|
|
1119
1186
|
backgrounds: GPT_IMAGE_BACKGROUNDS,
|
|
1120
1187
|
transparentResolution: "1K",
|
|
1188
|
+
outputFormats: GPT_IMAGE_2_6_FORMATS,
|
|
1189
|
+
gifFrames: GPT_IMAGE_2_6_GIF_FRAMES,
|
|
1190
|
+
gifFrameDurationMs: GPT_IMAGE_2_6_GIF_FRAME_DURATION,
|
|
1191
|
+
svgLevels: GPT_IMAGE_2_6_SVG_LEVELS,
|
|
1121
1192
|
pricing: [
|
|
1122
1193
|
{ identifier: "gpt-image-2-6-flare-i2i", credits: 20, note: "medium, 1K default" },
|
|
1123
1194
|
{ identifier: "gpt-image-2-6-flare-i2i:low:1K:1ref", credits: 17, note: "low, 1K, one input image (the least)" },
|
|
@@ -1125,6 +1196,8 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1125
1196
|
{ identifier: "gpt-image-2-6-flare-i2i:high:4K:16ref", credits: 169, note: "high, 4K, sixteen input images" },
|
|
1126
1197
|
{ identifier: "gpt-image-2-6-flare-i2i:max:4K:16ref", credits: 409, note: "max, 4K, sixteen input images (the most)" },
|
|
1127
1198
|
{ identifier: "gpt-image-2-6-flare-i2i:auto:1K:1ref", credits: 101, note: "auto, 1K, one input image: the most it can cost, settled on what it really cost" },
|
|
1199
|
+
{ identifier: "gpt-image-2-6-flare-i2i:medium:gif-9-12:1ref", credits: 34, note: "GIF, medium, 9 to 12 frames, one input image" },
|
|
1200
|
+
{ identifier: "gpt-image-2-6-flare-i2i:medium:1K:svg-standard:1ref", credits: 31, note: "SVG standard, medium, 1K, one input image" },
|
|
1128
1201
|
],
|
|
1129
1202
|
valueLabels: GPT_IMAGE_2_6_VALUE_LABELS,
|
|
1130
1203
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
@@ -1137,7 +1210,7 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1137
1210
|
maker: "openai",
|
|
1138
1211
|
label: "GPT Image 2.6 Sunburst",
|
|
1139
1212
|
series: "GPT Image",
|
|
1140
|
-
description: "Precision GPT Image 2.6 - pick it when every detail counts: the strongest consistency across edits and the finest detail. Up to 4K, quality from low to max or auto (priced up to the max), a transparent background at 1K.",
|
|
1213
|
+
description: "Precision GPT Image 2.6 - pick it when every detail counts: the strongest consistency across edits and the finest detail. Up to 4K, quality from low to max or auto (priced up to the max), a transparent background at 1K. Writes PNG, JPEG, WebP, an animated GIF or an SVG.",
|
|
1141
1214
|
useCases: ["typography", "high-res", "general"],
|
|
1142
1215
|
features: ["reference-image"],
|
|
1143
1216
|
aspectRatios: GPT_IMAGE_2_6_RATIOS,
|
|
@@ -1147,6 +1220,10 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1147
1220
|
defaultQuality: "medium",
|
|
1148
1221
|
backgrounds: GPT_IMAGE_BACKGROUNDS,
|
|
1149
1222
|
transparentResolution: "1K",
|
|
1223
|
+
outputFormats: GPT_IMAGE_2_6_FORMATS,
|
|
1224
|
+
gifFrames: GPT_IMAGE_2_6_GIF_FRAMES,
|
|
1225
|
+
gifFrameDurationMs: GPT_IMAGE_2_6_GIF_FRAME_DURATION,
|
|
1226
|
+
svgLevels: GPT_IMAGE_2_6_SVG_LEVELS,
|
|
1150
1227
|
pricing: [
|
|
1151
1228
|
{ identifier: "gpt-image-2-6-sunburst", credits: 20, note: "medium, 1K default" },
|
|
1152
1229
|
{ identifier: "gpt-image-2-6-sunburst:low:1K", credits: 12, note: "low, 1K" },
|
|
@@ -1167,6 +1244,33 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1167
1244
|
{ identifier: "gpt-image-2-6-sunburst:auto:1K", credits: 96, note: "auto, 1K: the most it can cost, settled on what it really cost" },
|
|
1168
1245
|
{ identifier: "gpt-image-2-6-sunburst:auto:2K", credits: 193, note: "auto, 2K: the most it can cost, settled on what it really cost" },
|
|
1169
1246
|
{ identifier: "gpt-image-2-6-sunburst:auto:4K", credits: 321, note: "auto, 4K: the most it can cost, settled on what it really cost" },
|
|
1247
|
+
{ identifier: "gpt-image-2-6-sunburst:low:gif-2-8", credits: 8, note: "GIF, low, 2 to 8 frames" },
|
|
1248
|
+
{ identifier: "gpt-image-2-6-sunburst:low:gif-9-12", credits: 17, note: "GIF, low, 9 to 12 frames" },
|
|
1249
|
+
{ identifier: "gpt-image-2-6-sunburst:low:gif-13-16", credits: 23, note: "GIF, low, 13 to 16 frames" },
|
|
1250
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:gif-2-8", credits: 14, note: "GIF, medium, 2 to 8 frames" },
|
|
1251
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:gif-9-12", credits: 29, note: "GIF, medium, 9 to 12 frames" },
|
|
1252
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:gif-13-16", credits: 41, note: "GIF, medium, 13 to 16 frames" },
|
|
1253
|
+
{ identifier: "gpt-image-2-6-sunburst:high:gif-2-8", credits: 17, note: "GIF, high, 2 to 8 frames" },
|
|
1254
|
+
{ identifier: "gpt-image-2-6-sunburst:high:gif-9-12", credits: 35, note: "GIF, high, 9 to 12 frames" },
|
|
1255
|
+
{ identifier: "gpt-image-2-6-sunburst:high:gif-13-16", credits: 49, note: "GIF, high, 13 to 16 frames" },
|
|
1256
|
+
{ identifier: "gpt-image-2-6-sunburst:xhigh:gif-2-8", credits: 29, note: "GIF, extra high, 2 to 8 frames" },
|
|
1257
|
+
{ identifier: "gpt-image-2-6-sunburst:xhigh:gif-9-12", credits: 61, note: "GIF, extra high, 9 to 12 frames" },
|
|
1258
|
+
{ identifier: "gpt-image-2-6-sunburst:xhigh:gif-13-16", credits: 86, note: "GIF, extra high, 13 to 16 frames" },
|
|
1259
|
+
{ identifier: "gpt-image-2-6-sunburst:max:gif-2-8", credits: 65, note: "GIF, max, 2 to 8 frames" },
|
|
1260
|
+
{ identifier: "gpt-image-2-6-sunburst:max:gif-9-12", credits: 136, note: "GIF, max, 9 to 12 frames" },
|
|
1261
|
+
{ identifier: "gpt-image-2-6-sunburst:max:gif-13-16", credits: 194, note: "GIF, max, 13 to 16 frames" },
|
|
1262
|
+
{ identifier: "gpt-image-2-6-sunburst:auto:gif-2-8", credits: 65, note: "GIF, auto, 2 to 8 frames: the most it can cost, settled on what it really cost" },
|
|
1263
|
+
{ identifier: "gpt-image-2-6-sunburst:auto:gif-9-12", credits: 136, note: "GIF, auto, 9 to 12 frames: the most it can cost, settled on what it really cost" },
|
|
1264
|
+
{ identifier: "gpt-image-2-6-sunburst:auto:gif-13-16", credits: 194, note: "GIF, auto, 13 to 16 frames: the most it can cost, settled on what it really cost" },
|
|
1265
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:1K:svg-standard", credits: 25, note: "SVG standard, medium, 1K" },
|
|
1266
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:2K:svg-standard", credits: 45, note: "SVG standard, medium, 2K" },
|
|
1267
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:4K:svg-standard", credits: 72, note: "SVG standard, medium, 4K" },
|
|
1268
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:1K:svg-detailed", credits: 64, note: "SVG detailed, medium, 1K" },
|
|
1269
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:2K:svg-detailed", credits: 84, note: "SVG detailed, medium, 2K" },
|
|
1270
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:4K:svg-detailed", credits: 111, note: "SVG detailed, medium, 4K" },
|
|
1271
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:1K:svg-max", credits: 81, note: "SVG max, medium, 1K" },
|
|
1272
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:2K:svg-max", credits: 101, note: "SVG max, medium, 2K" },
|
|
1273
|
+
{ identifier: "gpt-image-2-6-sunburst:medium:4K:svg-max", credits: 128, note: "SVG max, medium, 4K" },
|
|
1170
1274
|
],
|
|
1171
1275
|
valueLabels: GPT_IMAGE_2_6_VALUE_LABELS,
|
|
1172
1276
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
@@ -1179,7 +1283,7 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1179
1283
|
maker: "openai",
|
|
1180
1284
|
label: "GPT Image 2.6 Sunburst (I2I)",
|
|
1181
1285
|
series: "GPT Image",
|
|
1182
|
-
description: "Precision GPT Image 2.6 edits - up to 16 input images, priced per image. Pick it for finished, detail-critical edits.",
|
|
1286
|
+
description: "Precision GPT Image 2.6 edits - up to 16 input images, priced per image. Writes PNG, JPEG, WebP, an animated GIF or an SVG. Pick it for finished, detail-critical edits.",
|
|
1183
1287
|
useCases: ["edit", "high-res"],
|
|
1184
1288
|
features: ["reference-image"],
|
|
1185
1289
|
aspectRatios: GPT_IMAGE_2_6_RATIOS,
|
|
@@ -1189,6 +1293,10 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1189
1293
|
defaultQuality: "medium",
|
|
1190
1294
|
backgrounds: GPT_IMAGE_BACKGROUNDS,
|
|
1191
1295
|
transparentResolution: "1K",
|
|
1296
|
+
outputFormats: GPT_IMAGE_2_6_FORMATS,
|
|
1297
|
+
gifFrames: GPT_IMAGE_2_6_GIF_FRAMES,
|
|
1298
|
+
gifFrameDurationMs: GPT_IMAGE_2_6_GIF_FRAME_DURATION,
|
|
1299
|
+
svgLevels: GPT_IMAGE_2_6_SVG_LEVELS,
|
|
1192
1300
|
pricing: [
|
|
1193
1301
|
{ identifier: "gpt-image-2-6-sunburst-i2i", credits: 20, note: "medium, 1K default" },
|
|
1194
1302
|
{ identifier: "gpt-image-2-6-sunburst-i2i:low:1K:1ref", credits: 17, note: "low, 1K, one input image (the least)" },
|
|
@@ -1196,6 +1304,8 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1196
1304
|
{ identifier: "gpt-image-2-6-sunburst-i2i:high:4K:16ref", credits: 169, note: "high, 4K, sixteen input images" },
|
|
1197
1305
|
{ identifier: "gpt-image-2-6-sunburst-i2i:max:4K:16ref", credits: 409, note: "max, 4K, sixteen input images (the most)" },
|
|
1198
1306
|
{ identifier: "gpt-image-2-6-sunburst-i2i:auto:1K:1ref", credits: 101, note: "auto, 1K, one input image: the most it can cost, settled on what it really cost" },
|
|
1307
|
+
{ identifier: "gpt-image-2-6-sunburst-i2i:medium:gif-9-12:1ref", credits: 34, note: "GIF, medium, 9 to 12 frames, one input image" },
|
|
1308
|
+
{ identifier: "gpt-image-2-6-sunburst-i2i:medium:1K:svg-standard:1ref", credits: 31, note: "SVG standard, medium, 1K, one input image" },
|
|
1199
1309
|
],
|
|
1200
1310
|
valueLabels: GPT_IMAGE_2_6_VALUE_LABELS,
|
|
1201
1311
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
@@ -1220,6 +1330,11 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1220
1330
|
aspectRatios: GPT_IMAGE_2_6_ECONOMY_RATIOS,
|
|
1221
1331
|
autoAspectFromSourceImage: true,
|
|
1222
1332
|
backgrounds: GPT_IMAGE_BACKGROUNDS,
|
|
1333
|
+
// A GIF is priced at the flat row for now: check its price on a real run
|
|
1334
|
+
// before Economy is switched back on (backend gpt-image-2-6-pricing.ts).
|
|
1335
|
+
outputFormats: ["png", "gif"],
|
|
1336
|
+
gifFrames: GPT_IMAGE_2_6_ECONOMY_GIF_FRAMES,
|
|
1337
|
+
gifFrameDurationMs: GPT_IMAGE_2_6_GIF_FRAME_DURATION,
|
|
1223
1338
|
pricing: [{ identifier: "gpt-image-2-6-economy", credits: 13, note: "1K flat" }],
|
|
1224
1339
|
valueLabels: GPT_IMAGE_2_6_VALUE_LABELS,
|
|
1225
1340
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
@@ -1239,6 +1354,7 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1239
1354
|
aspectRatios: GPT_IMAGE_2_6_ECONOMY_RATIOS,
|
|
1240
1355
|
autoAspectFromSourceImage: true,
|
|
1241
1356
|
backgrounds: GPT_IMAGE_BACKGROUNDS,
|
|
1357
|
+
outputFormats: ["png"],
|
|
1242
1358
|
pricing: [{ identifier: "gpt-image-2-6-economy-i2i", credits: 13, note: "1K flat" }],
|
|
1243
1359
|
valueLabels: GPT_IMAGE_2_6_VALUE_LABELS,
|
|
1244
1360
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
@@ -4014,9 +4130,25 @@ function sameOptionValue(a: string | number, b: string | number): boolean {
|
|
|
4014
4130
|
return Number.isFinite(fa) && Number.isFinite(fb) && fa === fb
|
|
4015
4131
|
}
|
|
4016
4132
|
|
|
4133
|
+
/** Every lever `normalizeModelInput` can correct, as an adjustment names it. */
|
|
4134
|
+
export const MODEL_INPUT_ADJUSTMENT_FIELDS = [
|
|
4135
|
+
"aspectRatio", "resolution", "quality", "duration", "background",
|
|
4136
|
+
"outputFormat", "gifFrames", "gifFrameDurationMs", "svgLevel",
|
|
4137
|
+
] as const
|
|
4138
|
+
export type ModelInputAdjustmentField = (typeof MODEL_INPUT_ADJUSTMENT_FIELDS)[number]
|
|
4139
|
+
|
|
4140
|
+
/** The pixel size of every frame of a GIF the platform asks for: a GIF is square. */
|
|
4141
|
+
export const IMAGE_GIF_FRAME_SIZE = 512
|
|
4142
|
+
|
|
4143
|
+
/** The output formats that take no inpainting mask: the image routes refuse a mask with them (a 400). */
|
|
4144
|
+
export const MASKLESS_OUTPUT_FORMATS: readonly string[] = ["gif", "svg"]
|
|
4145
|
+
|
|
4146
|
+
/** The output formats that keep a transparent background; with any other a transparent one becomes `auto`. */
|
|
4147
|
+
export const TRANSPARENT_OUTPUT_FORMATS: readonly string[] = ["png", "webp"]
|
|
4148
|
+
|
|
4017
4149
|
/** One correction `normalizeModelInput` made, for disclosure to the user. */
|
|
4018
4150
|
export interface ModelInputAdjustment {
|
|
4019
|
-
field:
|
|
4151
|
+
field: ModelInputAdjustmentField
|
|
4020
4152
|
/** The value that was asked for. */
|
|
4021
4153
|
from: string | number
|
|
4022
4154
|
/** What it became — `undefined` means the lever was dropped entirely. */
|
|
@@ -4030,6 +4162,10 @@ export interface NormalizedModelInput {
|
|
|
4030
4162
|
quality?: string
|
|
4031
4163
|
duration?: number
|
|
4032
4164
|
background?: string
|
|
4165
|
+
outputFormat?: string
|
|
4166
|
+
gifFrames?: number
|
|
4167
|
+
gifFrameDurationMs?: number
|
|
4168
|
+
svgLevel?: string
|
|
4033
4169
|
/** Empty when the input was already valid. */
|
|
4034
4170
|
adjustments: ModelInputAdjustment[]
|
|
4035
4171
|
}
|
|
@@ -4183,7 +4319,9 @@ export function resolutionAtAspectRatio(
|
|
|
4183
4319
|
* shape; the first listed ratio would reframe every source of another shape.
|
|
4184
4320
|
* - Value outside the model's allow-list → snap to the model's default
|
|
4185
4321
|
* (`defaultResolutionFor`) or the first valid option.
|
|
4186
|
-
* - Then apply cross-field constraints
|
|
4322
|
+
* - Then apply the cross-field constraints the catalog declares: a size the
|
|
4323
|
+
* ratio does not render (`resolutionsByAspectRatio`), and the size a
|
|
4324
|
+
* background setting renders at (`transparentResolution`).
|
|
4187
4325
|
*
|
|
4188
4326
|
* Unknown model ids pass through untouched — the route's Zod model enum is the
|
|
4189
4327
|
* right gate for those, exactly as in `validateModelInput`.
|
|
@@ -4199,6 +4337,10 @@ export function normalizeModelInput(
|
|
|
4199
4337
|
quality?: string
|
|
4200
4338
|
duration?: number
|
|
4201
4339
|
background?: string
|
|
4340
|
+
outputFormat?: string
|
|
4341
|
+
gifFrames?: number
|
|
4342
|
+
gifFrameDurationMs?: number
|
|
4343
|
+
svgLevel?: string
|
|
4202
4344
|
},
|
|
4203
4345
|
context: ModelInputContext = {},
|
|
4204
4346
|
): NormalizedModelInput {
|
|
@@ -4243,11 +4385,31 @@ export function normalizeModelInput(
|
|
|
4243
4385
|
return next
|
|
4244
4386
|
}
|
|
4245
4387
|
|
|
4388
|
+
// The file first: a GIF's ratio and size, and every format's background, follow it.
|
|
4389
|
+
const format = normalizeOutputFormat(m, input, adjustments)
|
|
4390
|
+
out.outputFormat = format.levers.outputFormat
|
|
4391
|
+
out.gifFrames = format.levers.gifFrames
|
|
4392
|
+
out.gifFrameDurationMs = format.levers.gifFrameDurationMs
|
|
4393
|
+
out.svgLevel = format.levers.svgLevel
|
|
4394
|
+
const gif = format.levers.outputFormat === "gif"
|
|
4395
|
+
|
|
4246
4396
|
const sourceRatio =
|
|
4247
|
-
autoAspectNeedsSourceImage(modelId, input.aspectRatio) && usableSize(context.sourceImage)
|
|
4397
|
+
!gif && autoAspectNeedsSourceImage(modelId, input.aspectRatio) && usableSize(context.sourceImage)
|
|
4248
4398
|
? nearestCatalogAspectRatio(context.sourceImage.width, context.sourceImage.height, m.aspectRatios ?? [])
|
|
4249
4399
|
: undefined
|
|
4250
|
-
if (
|
|
4400
|
+
if (gif) {
|
|
4401
|
+
// A GIF is square, IMAGE_GIF_FRAME_SIZE a frame: neither lever applies.
|
|
4402
|
+
// "auto" leaves the shape to the model, and square is its answer.
|
|
4403
|
+
if (input.aspectRatio !== undefined && input.aspectRatio !== "1:1" && !isAutoAspectToken(input.aspectRatio)) {
|
|
4404
|
+
adjustments.push({
|
|
4405
|
+
field: "aspectRatio",
|
|
4406
|
+
from: input.aspectRatio,
|
|
4407
|
+
to: "1:1",
|
|
4408
|
+
reason: `A GIF from ${m.label} is square (${IMAGE_GIF_FRAME_SIZE}x${IMAGE_GIF_FRAME_SIZE} a frame), so the aspect ratio does not apply.`,
|
|
4409
|
+
})
|
|
4410
|
+
}
|
|
4411
|
+
out.aspectRatio = input.aspectRatio === undefined ? undefined : "1:1"
|
|
4412
|
+
} else if (sourceRatio !== undefined && input.aspectRatio !== undefined) {
|
|
4251
4413
|
const { width, height } = context.sourceImage!
|
|
4252
4414
|
const why = m.autoAspectFromSourceImage === true
|
|
4253
4415
|
? `${m.label}'s own "auto" does not keep the photo's shape`
|
|
@@ -4262,22 +4424,53 @@ export function normalizeModelInput(
|
|
|
4262
4424
|
} else {
|
|
4263
4425
|
out.aspectRatio = snap("aspectRatio", input.aspectRatio, m.aspectRatios)
|
|
4264
4426
|
}
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4427
|
+
if (gif) {
|
|
4428
|
+
if (input.resolution !== undefined) {
|
|
4429
|
+
adjustments.push({
|
|
4430
|
+
field: "resolution",
|
|
4431
|
+
from: input.resolution,
|
|
4432
|
+
to: undefined,
|
|
4433
|
+
reason: `A GIF from ${m.label} is ${IMAGE_GIF_FRAME_SIZE}x${IMAGE_GIF_FRAME_SIZE} a frame, so the size does not apply.`,
|
|
4434
|
+
})
|
|
4435
|
+
}
|
|
4436
|
+
out.resolution = undefined
|
|
4437
|
+
} else {
|
|
4438
|
+
out.resolution = snap(
|
|
4439
|
+
"resolution",
|
|
4440
|
+
input.resolution,
|
|
4441
|
+
m.resolutions,
|
|
4442
|
+
defaultResolutionFor(modelId),
|
|
4443
|
+
)
|
|
4444
|
+
}
|
|
4271
4445
|
out.quality = snap("quality", input.quality, m.qualities, m.defaultQuality)
|
|
4272
4446
|
out.background = snap("background", input.background, m.backgrounds)
|
|
4447
|
+
// A transparent background is kept only by a format with an alpha channel the
|
|
4448
|
+
// provider fills (PNG, WebP); an SVG takes no background setting at all.
|
|
4449
|
+
const writes = format.levers.outputFormat
|
|
4450
|
+
if (writes !== undefined && out.background !== undefined && out.background !== "auto") {
|
|
4451
|
+
const dropped = writes === "svg" || (out.background === "transparent" && !TRANSPARENT_OUTPUT_FORMATS.includes(writes))
|
|
4452
|
+
if (dropped) {
|
|
4453
|
+
adjustments.push({
|
|
4454
|
+
field: "background",
|
|
4455
|
+
from: out.background,
|
|
4456
|
+
to: "auto",
|
|
4457
|
+
reason: writes === "svg"
|
|
4458
|
+
? `An SVG from ${m.label} takes no background setting.`
|
|
4459
|
+
: `${m.label} only keeps a transparent background in PNG or WebP, not ${writes.toUpperCase()}.`,
|
|
4460
|
+
})
|
|
4461
|
+
out.background = "auto"
|
|
4462
|
+
}
|
|
4463
|
+
}
|
|
4273
4464
|
out.duration =
|
|
4274
4465
|
m.autoDuration === true && isAutoVideoDuration(input.duration)
|
|
4275
4466
|
? input.duration
|
|
4276
4467
|
: snap("duration", input.duration, m.durations)
|
|
4277
4468
|
|
|
4278
|
-
// A size the chosen ratio does not render (`resolutionsByAspectRatio
|
|
4279
|
-
// to the largest one it does at or
|
|
4280
|
-
// below
|
|
4469
|
+
// A size the chosen ratio does not render (`resolutionsByAspectRatio`: GPT
|
|
4470
|
+
// Image 2.5's four 1K-only ratios) moves to the largest one it does at or
|
|
4471
|
+
// below it. After the snaps above, so it sees the
|
|
4472
|
+
// ratio and size as they will be sent; before the background rules below,
|
|
4473
|
+
// which read the size this leaves, and before any price is built.
|
|
4281
4474
|
const sized = resolutionAtAspectRatio(modelId, out.aspectRatio, out.resolution)
|
|
4282
4475
|
if (out.resolution !== undefined && sized !== undefined && sized !== out.resolution) {
|
|
4283
4476
|
const offered = resolutionsAtAspectRatio(modelId, out.aspectRatio) ?? [sized]
|
|
@@ -4290,29 +4483,6 @@ export function normalizeModelInput(
|
|
|
4290
4483
|
out.resolution = sized
|
|
4291
4484
|
}
|
|
4292
4485
|
|
|
4293
|
-
// Cross-field constraints — a pair that is individually valid but jointly
|
|
4294
|
-
// rejected upstream. GPT Image 2 (per docs.kie.ai): `auto` requires 1K, and
|
|
4295
|
-
// 1:1 cannot go to 4K. Applied last so it sees the already-snapped values.
|
|
4296
|
-
if (modelId === "gpt-image-2" || modelId === "gpt-image-2-i2i") {
|
|
4297
|
-
if (out.aspectRatio === "auto" && out.resolution !== undefined && out.resolution !== "1K") {
|
|
4298
|
-
adjustments.push({
|
|
4299
|
-
field: "resolution",
|
|
4300
|
-
from: out.resolution,
|
|
4301
|
-
to: "1K",
|
|
4302
|
-
reason: `${m.label} only renders 1K at the "auto" aspect ratio.`,
|
|
4303
|
-
})
|
|
4304
|
-
out.resolution = "1K"
|
|
4305
|
-
} else if (out.aspectRatio === "1:1" && out.resolution === "4K") {
|
|
4306
|
-
adjustments.push({
|
|
4307
|
-
field: "resolution",
|
|
4308
|
-
from: "4K",
|
|
4309
|
-
to: "2K",
|
|
4310
|
-
reason: `${m.label} cannot render 4K at a 1:1 aspect ratio.`,
|
|
4311
|
-
})
|
|
4312
|
-
out.resolution = "2K"
|
|
4313
|
-
}
|
|
4314
|
-
}
|
|
4315
|
-
|
|
4316
4486
|
// A transparent background only renders at the size the provider allows it.
|
|
4317
4487
|
// Priced after this, so the run pays for the size it renders.
|
|
4318
4488
|
if (
|
|
@@ -4352,6 +4522,110 @@ export function normalizeModelInput(
|
|
|
4352
4522
|
return out
|
|
4353
4523
|
}
|
|
4354
4524
|
|
|
4525
|
+
/** The format levers of a request after `normalizeOutputFormat`: a GIF's and an SVG's only when that is the file written. */
|
|
4526
|
+
interface NormalizedFormatLevers {
|
|
4527
|
+
outputFormat?: string
|
|
4528
|
+
gifFrames?: number
|
|
4529
|
+
gifFrameDurationMs?: number
|
|
4530
|
+
svgLevel?: string
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4533
|
+
/**
|
|
4534
|
+
* The file a request writes, snapped to what the model writes, and the levers
|
|
4535
|
+
* of that file: a GIF's frames and speed, an SVG's level. Each takes its
|
|
4536
|
+
* default when the file is written and it is not named (so what is sent and
|
|
4537
|
+
* priced is what is recorded), and is left out for any other file, a value
|
|
4538
|
+
* the canvas keeps on a node for when GIF is chosen again. No format named is
|
|
4539
|
+
* the model's own (PNG), and nothing is set.
|
|
4540
|
+
*/
|
|
4541
|
+
function normalizeOutputFormat(
|
|
4542
|
+
m: ModelCatalogEntry,
|
|
4543
|
+
input: { outputFormat?: string; gifFrames?: number; gifFrameDurationMs?: number; svgLevel?: string },
|
|
4544
|
+
adjustments: ModelInputAdjustment[],
|
|
4545
|
+
): { levers: NormalizedFormatLevers } {
|
|
4546
|
+
if (input.outputFormat === undefined) return { levers: {} }
|
|
4547
|
+
const asked = input.outputFormat.trim().toLowerCase()
|
|
4548
|
+
const value = asked === "jpg" ? "jpeg" : asked
|
|
4549
|
+
const formats = m.outputFormats
|
|
4550
|
+
if (!formats || formats.length === 0) {
|
|
4551
|
+
adjustments.push({
|
|
4552
|
+
field: "outputFormat",
|
|
4553
|
+
from: input.outputFormat,
|
|
4554
|
+
to: undefined,
|
|
4555
|
+
reason: `${m.label} has no outputFormat setting — the value was dropped.`,
|
|
4556
|
+
})
|
|
4557
|
+
return { levers: {} }
|
|
4558
|
+
}
|
|
4559
|
+
let outputFormat = formats.find((f) => f === value)
|
|
4560
|
+
if (outputFormat === undefined) {
|
|
4561
|
+
outputFormat = formats[0]!
|
|
4562
|
+
adjustments.push({
|
|
4563
|
+
field: "outputFormat",
|
|
4564
|
+
from: input.outputFormat,
|
|
4565
|
+
to: outputFormat,
|
|
4566
|
+
reason: `${m.label} does not write "${input.outputFormat}" — using "${outputFormat}" instead. Supported: ${formats.join(", ")}.`,
|
|
4567
|
+
})
|
|
4568
|
+
}
|
|
4569
|
+
if (outputFormat === "gif") {
|
|
4570
|
+
return { levers: { outputFormat, gifFrames: gifFramesFor(m, input.gifFrames, adjustments), gifFrameDurationMs: gifFrameDurationFor(m, input.gifFrameDurationMs, adjustments) } }
|
|
4571
|
+
}
|
|
4572
|
+
if (outputFormat === "svg") {
|
|
4573
|
+
const levels = m.svgLevels ?? []
|
|
4574
|
+
const askedLevel = input.svgLevel?.trim().toLowerCase()
|
|
4575
|
+
let svgLevel = askedLevel === undefined ? levels[0] : levels.find((l) => l === askedLevel)
|
|
4576
|
+
if (input.svgLevel !== undefined && svgLevel === undefined && levels.length > 0) {
|
|
4577
|
+
svgLevel = levels[0]
|
|
4578
|
+
adjustments.push({
|
|
4579
|
+
field: "svgLevel",
|
|
4580
|
+
from: input.svgLevel,
|
|
4581
|
+
to: svgLevel,
|
|
4582
|
+
reason: `${m.label} does not draw an SVG at level "${input.svgLevel}" — using "${svgLevel}" instead. Supported: ${levels.join(", ")}.`,
|
|
4583
|
+
})
|
|
4584
|
+
}
|
|
4585
|
+
return { levers: { outputFormat, ...(svgLevel !== undefined && { svgLevel }) } }
|
|
4586
|
+
}
|
|
4587
|
+
return { levers: { outputFormat } }
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4590
|
+
/** A GIF's frames on `m`: the default when none, else a whole number in its range, or the nearest it takes. */
|
|
4591
|
+
function gifFramesFor(m: ModelCatalogEntry, asked: number | undefined, adjustments: ModelInputAdjustment[]): number | undefined {
|
|
4592
|
+
const spec = m.gifFrames
|
|
4593
|
+
if (!spec) return asked
|
|
4594
|
+
if (asked === undefined || !Number.isFinite(asked)) return spec.default
|
|
4595
|
+
const inRange = Math.min(Math.max(Math.round(asked), spec.min), spec.max)
|
|
4596
|
+
const frames = spec.values && spec.values.length > 0
|
|
4597
|
+
? spec.values.reduce((best, v) => (Math.abs(v - inRange) < Math.abs(best - inRange) ? v : best), spec.values[0]!)
|
|
4598
|
+
: inRange
|
|
4599
|
+
if (frames !== asked) {
|
|
4600
|
+
adjustments.push({
|
|
4601
|
+
field: "gifFrames",
|
|
4602
|
+
from: asked,
|
|
4603
|
+
to: frames,
|
|
4604
|
+
reason: spec.values && spec.values.length > 0
|
|
4605
|
+
? `A GIF from ${m.label} has ${spec.values.join(", ")} frames — using ${frames}.`
|
|
4606
|
+
: `A GIF from ${m.label} has ${spec.min} to ${spec.max} frames — using ${frames}.`,
|
|
4607
|
+
})
|
|
4608
|
+
}
|
|
4609
|
+
return frames
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
/** How long each GIF frame shows on `m`: the default when none, else inside its range, rounded to its step. */
|
|
4613
|
+
function gifFrameDurationFor(m: ModelCatalogEntry, asked: number | undefined, adjustments: ModelInputAdjustment[]): number | undefined {
|
|
4614
|
+
const spec = m.gifFrameDurationMs
|
|
4615
|
+
if (!spec) return asked
|
|
4616
|
+
if (asked === undefined || !Number.isFinite(asked)) return spec.default
|
|
4617
|
+
const ms = Math.min(Math.max(Math.round(asked / spec.step) * spec.step, spec.min), spec.max)
|
|
4618
|
+
if (ms !== asked) {
|
|
4619
|
+
adjustments.push({
|
|
4620
|
+
field: "gifFrameDurationMs",
|
|
4621
|
+
from: asked,
|
|
4622
|
+
to: ms,
|
|
4623
|
+
reason: `${m.label} shows each GIF frame ${spec.min} to ${spec.max} ms, in steps of ${spec.step} — using ${ms}.`,
|
|
4624
|
+
})
|
|
4625
|
+
}
|
|
4626
|
+
return ms
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4355
4629
|
/** Aspect tokens that mean "match the input" or "let the provider decide". They
|
|
4356
4630
|
* are NOT concrete ratios, so snapping them onto one is always wrong — the
|
|
4357
4631
|
* provider adapter (applySeedance2Params, applyMinimaxH3Params) resolves them
|
|
@@ -4746,6 +5020,42 @@ export function backgroundOptionsByKind(kind: ModelKind): Record<string, Labeled
|
|
|
4746
5020
|
return out
|
|
4747
5021
|
}
|
|
4748
5022
|
|
|
5023
|
+
/** How an output format is named in a menu. */
|
|
5024
|
+
export const IMAGE_OUTPUT_FORMAT_LABELS: Readonly<Record<string, string>> = {
|
|
5025
|
+
png: "PNG",
|
|
5026
|
+
jpeg: "JPEG",
|
|
5027
|
+
webp: "WebP",
|
|
5028
|
+
gif: "GIF (animated)",
|
|
5029
|
+
svg: "SVG (vector)",
|
|
5030
|
+
}
|
|
5031
|
+
|
|
5032
|
+
/** How an SVG level of detail is named in a menu (its own table: `max` is also a quality). */
|
|
5033
|
+
export const IMAGE_SVG_LEVEL_LABELS: Readonly<Record<string, string>> = {
|
|
5034
|
+
standard: "SVG Standard",
|
|
5035
|
+
detailed: "SVG Detailed",
|
|
5036
|
+
max: "SVG Max",
|
|
5037
|
+
}
|
|
5038
|
+
|
|
5039
|
+
/** The output formats per model of a kind, the model's default first. No entry: a single format, not a setting. */
|
|
5040
|
+
export function outputFormatOptionsByKind(kind: ModelKind): Record<string, LabeledOption[]> {
|
|
5041
|
+
const out: Record<string, LabeledOption[]> = {}
|
|
5042
|
+
for (const m of Object.values(MODEL_CATALOG)) {
|
|
5043
|
+
if (m.kind !== kind || !m.outputFormats || m.outputFormats.length < 2) continue
|
|
5044
|
+
out[m.id] = m.outputFormats.map((v) => ({ value: v, label: IMAGE_OUTPUT_FORMAT_LABELS[v] ?? v }))
|
|
5045
|
+
}
|
|
5046
|
+
return out
|
|
5047
|
+
}
|
|
5048
|
+
|
|
5049
|
+
/** The SVG levels per model of a kind that writes SVG. */
|
|
5050
|
+
export function svgLevelOptionsByKind(kind: ModelKind): Record<string, LabeledOption[]> {
|
|
5051
|
+
const out: Record<string, LabeledOption[]> = {}
|
|
5052
|
+
for (const m of Object.values(MODEL_CATALOG)) {
|
|
5053
|
+
if (m.kind !== kind || !m.outputFormats?.includes("svg") || !m.svgLevels) continue
|
|
5054
|
+
out[m.id] = m.svgLevels.map((v) => ({ value: v, label: IMAGE_SVG_LEVEL_LABELS[v] ?? v }))
|
|
5055
|
+
}
|
|
5056
|
+
return out
|
|
5057
|
+
}
|
|
5058
|
+
|
|
4749
5059
|
/** One shaped model row for a picker — capabilities derived from the catalog. */
|
|
4750
5060
|
export interface ModelMenuOption {
|
|
4751
5061
|
/** Catalog id (the API enum value). */
|
package/src/model-constants.ts
CHANGED
|
@@ -74,6 +74,39 @@ export type ImageQuality = typeof IMAGE_QUALITY_VALUES[number]
|
|
|
74
74
|
export const IMAGE_BACKGROUND_VALUES = ["auto", "opaque", "transparent"] as const
|
|
75
75
|
export type ImageBackground = typeof IMAGE_BACKGROUND_VALUES[number]
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* The `outputFormat` vocabulary of the same two routes: the file a run writes
|
|
79
|
+
* (vocabulary bound; the catalog snap gates per model, `outputFormats`). No
|
|
80
|
+
* value is PNG. `gif` is an animation of square frames, `svg` a vector drawing.
|
|
81
|
+
*/
|
|
82
|
+
export const IMAGE_OUTPUT_FORMAT_VALUES = ["png", "jpeg", "webp", "gif", "svg"] as const
|
|
83
|
+
export type ImageOutputFormat = typeof IMAGE_OUTPUT_FORMAT_VALUES[number]
|
|
84
|
+
|
|
85
|
+
/** The `svgLevel` vocabulary: how much detail an SVG is drawn with, Standard to Max. */
|
|
86
|
+
export const IMAGE_SVG_LEVEL_VALUES = ["standard", "detailed", "max"] as const
|
|
87
|
+
export type ImageSvgLevel = typeof IMAGE_SVG_LEVEL_VALUES[number]
|
|
88
|
+
|
|
89
|
+
/** The pixel size of every frame of a GIF the platform asks for (square). Declared beside the catalog rule that reads it. */
|
|
90
|
+
export { IMAGE_GIF_FRAME_SIZE } from "./model-catalog.js"
|
|
91
|
+
|
|
92
|
+
/** The MIME type of each output format, as it is stored and served. */
|
|
93
|
+
export const IMAGE_OUTPUT_FORMAT_MIME: Readonly<Record<ImageOutputFormat, string>> = {
|
|
94
|
+
png: "image/png",
|
|
95
|
+
jpeg: "image/jpeg",
|
|
96
|
+
webp: "image/webp",
|
|
97
|
+
gif: "image/gif",
|
|
98
|
+
svg: "image/svg+xml",
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The file extension each output format is stored under. */
|
|
102
|
+
export const IMAGE_OUTPUT_FORMAT_EXT: Readonly<Record<ImageOutputFormat, string>> = {
|
|
103
|
+
png: "png",
|
|
104
|
+
jpeg: "jpg",
|
|
105
|
+
webp: "webp",
|
|
106
|
+
gif: "gif",
|
|
107
|
+
svg: "svg",
|
|
108
|
+
}
|
|
109
|
+
|
|
77
110
|
/** The `renderingSpeed` vocabulary (Ideogram's speed tiers — see {@link RENDERING_SPEED_SUPPORT}). */
|
|
78
111
|
export const IMAGE_RENDERING_SPEED_VALUES = ["TURBO", "BALANCED", "QUALITY"] as const
|
|
79
112
|
export type ImageRenderingSpeed = typeof IMAGE_RENDERING_SPEED_VALUES[number]
|
|
@@ -1325,6 +1358,13 @@ export function isSeedanceVideoEditProvider(provider: string | undefined): provi
|
|
|
1325
1358
|
export const VIDEO_TO_VIDEO_NODE_PROVIDERS = [...VIDEO_TO_VIDEO_PROVIDERS, ...SEEDANCE_VIDEO_EDIT_PROVIDERS] as const
|
|
1326
1359
|
export type VideoToVideoNodeProvider = typeof VIDEO_TO_VIDEO_NODE_PROVIDERS[number]
|
|
1327
1360
|
|
|
1361
|
+
/**
|
|
1362
|
+
* The model a Video to Video request or node that names none runs on: the
|
|
1363
|
+
* route's and the worker's default, and what the node's model menu shows for an
|
|
1364
|
+
* unset model. One constant, so the server and the editor cannot disagree.
|
|
1365
|
+
*/
|
|
1366
|
+
export const DEFAULT_VIDEO_TO_VIDEO_PROVIDER: VideoToVideoNodeProvider = "wan"
|
|
1367
|
+
|
|
1328
1368
|
/**
|
|
1329
1369
|
* The request shape Seedance edit mode requires, sent UP FRONT by the Video to
|
|
1330
1370
|
* Video node: the output takes the source clip's own ratio and length
|
|
@@ -89,6 +89,14 @@ export interface NodeExecutionStateWire<TOutput = Record<string, unknown>> {
|
|
|
89
89
|
error?: string | null
|
|
90
90
|
/** Stable code for a refusal a client may branch on — never on the text. */
|
|
91
91
|
errorCode?: string
|
|
92
|
+
/**
|
|
93
|
+
* The provider's own words for a `failed` node's failure (the job's
|
|
94
|
+
* `error_detail`), with links cut to their host and secrets removed; absent
|
|
95
|
+
* when the failure had no provider text (a platform refusal, a timeout).
|
|
96
|
+
* Display-only, beside `error`: branch on `errorCode` or the hint, never on
|
|
97
|
+
* these words. A published app's runner never receives it.
|
|
98
|
+
*/
|
|
99
|
+
errorDetail?: string | null
|
|
92
100
|
/**
|
|
93
101
|
* What the node produced.
|
|
94
102
|
*
|