@nodaro/shared 3.60.1 → 3.62.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-5Y42RIGY.cjs → chunk-2D5LQFV4.cjs} +18 -332
- package/dist/chunk-2D5LQFV4.cjs.map +1 -0
- package/dist/{chunk-5G23AJBU.cjs → chunk-2HZGDZZN.cjs} +6 -6
- package/dist/{chunk-5G23AJBU.cjs.map → chunk-2HZGDZZN.cjs.map} +1 -1
- package/dist/{chunk-DS2TOM32.js → chunk-2QKF7M2Z.js} +28 -4
- package/dist/chunk-2QKF7M2Z.js.map +1 -0
- package/dist/{chunk-CIOXUPCJ.cjs → chunk-2W745U4A.cjs} +228 -355
- package/dist/chunk-2W745U4A.cjs.map +1 -0
- package/dist/{chunk-LN3EVFRS.js → chunk-3OYO3XCC.js} +70 -6
- package/dist/chunk-3OYO3XCC.js.map +1 -0
- package/dist/{chunk-5HK5Z5OB.cjs → chunk-4ZEFP2FQ.cjs} +4 -4
- package/dist/{chunk-5HK5Z5OB.cjs.map → chunk-4ZEFP2FQ.cjs.map} +1 -1
- package/dist/{chunk-KOLC7AF2.js → chunk-5YYN5X57.js} +398 -38
- package/dist/chunk-5YYN5X57.js.map +1 -0
- package/dist/{chunk-RRPPXZ36.cjs → chunk-6CSXMWL4.cjs} +4 -4
- package/dist/{chunk-RRPPXZ36.cjs.map → chunk-6CSXMWL4.cjs.map} +1 -1
- package/dist/{chunk-M3SXUUWC.cjs → chunk-6FQBKI2A.cjs} +4 -11
- package/dist/chunk-6FQBKI2A.cjs.map +1 -0
- package/dist/{chunk-G4XWVWRI.js → chunk-6G7NN4S4.js} +5 -4
- package/dist/chunk-6G7NN4S4.js.map +1 -0
- package/dist/{chunk-HOKWJXHA.cjs → chunk-A2PX5IRC.cjs} +31 -4
- package/dist/chunk-A2PX5IRC.cjs.map +1 -0
- package/dist/{chunk-W4M7TNXG.cjs → chunk-AFYTX4AI.cjs} +52 -43
- package/dist/chunk-AFYTX4AI.cjs.map +1 -0
- package/dist/chunk-ALRXY4QH.cjs +13 -0
- package/dist/chunk-ALRXY4QH.cjs.map +1 -0
- package/dist/chunk-AOJ6B7K4.cjs +351 -0
- package/dist/chunk-AOJ6B7K4.cjs.map +1 -0
- package/dist/{chunk-KJZVQIN4.js → chunk-C7POAYFE.js} +3 -3
- package/dist/{chunk-KJZVQIN4.js.map → chunk-C7POAYFE.js.map} +1 -1
- package/dist/{chunk-6Q6SI7AG.js → chunk-CC4V2B7S.js} +3 -3
- package/dist/{chunk-6Q6SI7AG.js.map → chunk-CC4V2B7S.js.map} +1 -1
- package/dist/{chunk-GNPJ2JLE.cjs → chunk-CIPPPT7E.cjs} +6 -6
- package/dist/{chunk-GNPJ2JLE.cjs.map → chunk-CIPPPT7E.cjs.map} +1 -1
- package/dist/{chunk-6XVHYD5R.js → chunk-CLAKSLXF.js} +4 -9
- package/dist/chunk-CLAKSLXF.js.map +1 -0
- package/dist/chunk-CTANEPMY.js +61 -0
- package/dist/chunk-CTANEPMY.js.map +1 -0
- package/dist/{chunk-WGKAOUEQ.cjs → chunk-D34K455O.cjs} +3 -2
- package/dist/chunk-D34K455O.cjs.map +1 -0
- package/dist/chunk-E2HZTGYX.js +331 -0
- package/dist/chunk-E2HZTGYX.js.map +1 -0
- package/dist/{chunk-SKFJIFEV.cjs → chunk-G3KVK7OU.cjs} +21 -21
- package/dist/{chunk-SKFJIFEV.cjs.map → chunk-G3KVK7OU.cjs.map} +1 -1
- package/dist/chunk-G4U3HW6W.js +453 -0
- package/dist/chunk-G4U3HW6W.js.map +1 -0
- package/dist/{chunk-EN2YI5TV.js → chunk-GSFB537T.js} +3 -3
- package/dist/{chunk-EN2YI5TV.js.map → chunk-GSFB537T.js.map} +1 -1
- package/dist/chunk-HRY7KGAE.cjs +506 -0
- package/dist/chunk-HRY7KGAE.cjs.map +1 -0
- package/dist/{chunk-6AJOTEVC.js → chunk-I2RQB7VG.js} +3 -3
- package/dist/{chunk-6AJOTEVC.js.map → chunk-I2RQB7VG.js.map} +1 -1
- package/dist/chunk-IDTKF5EX.cjs +48 -0
- package/dist/chunk-IDTKF5EX.cjs.map +1 -0
- package/dist/{chunk-DQIJPDHC.cjs → chunk-IWWVPR3W.cjs} +88 -11
- package/dist/chunk-IWWVPR3W.cjs.map +1 -0
- package/dist/{chunk-URLDVK67.js → chunk-JJNNM23P.js} +3 -3
- package/dist/{chunk-URLDVK67.js.map → chunk-JJNNM23P.js.map} +1 -1
- package/dist/{chunk-YHVEZVAO.js → chunk-JZGZ26YB.js} +6 -306
- package/dist/chunk-JZGZ26YB.js.map +1 -0
- package/dist/{chunk-XROE3CAS.cjs → chunk-KHH54GRP.cjs} +120 -79
- package/dist/chunk-KHH54GRP.cjs.map +1 -0
- package/dist/{chunk-AXT7YNOR.cjs → chunk-KJSRPHJ2.cjs} +48 -47
- package/dist/chunk-KJSRPHJ2.cjs.map +1 -0
- package/dist/{chunk-FVVD6XY2.js → chunk-KL6GAYTT.js} +13 -4
- package/dist/chunk-KL6GAYTT.js.map +1 -0
- package/dist/{chunk-AFQFGZN7.cjs → chunk-KYMHFVAZ.cjs} +8 -6
- package/dist/chunk-KYMHFVAZ.cjs.map +1 -0
- package/dist/{chunk-A6HRY3WF.cjs → chunk-MYJQELFN.cjs} +420 -37
- package/dist/chunk-MYJQELFN.cjs.map +1 -0
- package/dist/chunk-N5HH46JF.cjs +68 -0
- package/dist/chunk-N5HH46JF.cjs.map +1 -0
- package/dist/{chunk-BXNPO3PL.cjs → chunk-N7OUQK7E.cjs} +8 -8
- package/dist/{chunk-BXNPO3PL.cjs.map → chunk-N7OUQK7E.cjs.map} +1 -1
- package/dist/{chunk-JKZVRKN3.js → chunk-NGKKNSK6.js} +31 -8
- package/dist/chunk-NGKKNSK6.js.map +1 -0
- package/dist/{chunk-SWVGHAYO.js → chunk-O7RZRUMZ.js} +110 -74
- package/dist/chunk-O7RZRUMZ.js.map +1 -0
- package/dist/{chunk-SCYBGTX6.js → chunk-PTD6EDUU.js} +3 -3
- package/dist/{chunk-SCYBGTX6.js.map → chunk-PTD6EDUU.js.map} +1 -1
- package/dist/{chunk-BDXXOEBZ.cjs → chunk-QWYFHQYK.cjs} +79 -54
- package/dist/chunk-QWYFHQYK.cjs.map +1 -0
- package/dist/{chunk-VB2ARGQ6.js → chunk-RGNHHIMN.js} +3 -3
- package/dist/chunk-RGNHHIMN.js.map +1 -0
- package/dist/{chunk-AZGONXWV.js → chunk-S24ZBUB4.js} +194 -299
- package/dist/chunk-S24ZBUB4.js.map +1 -0
- package/dist/{chunk-IV6IDECY.js → chunk-S5TMRJMX.js} +4 -4
- package/dist/{chunk-IV6IDECY.js.map → chunk-S5TMRJMX.js.map} +1 -1
- package/dist/chunk-SMOO5FAH.js +10 -0
- package/dist/chunk-SMOO5FAH.js.map +1 -0
- package/dist/{chunk-HYBACFYW.js → chunk-SYWR5G3T.js} +16 -7
- package/dist/chunk-SYWR5G3T.js.map +1 -0
- package/dist/{chunk-GWBQ3GPO.cjs → chunk-TRVWMKNE.cjs} +343 -53
- package/dist/chunk-TRVWMKNE.cjs.map +1 -0
- package/dist/{chunk-G6GMY5BC.js → chunk-UDDVDQMF.js} +298 -36
- package/dist/chunk-UDDVDQMF.js.map +1 -0
- package/dist/{chunk-PONP5J5E.cjs → chunk-V24EPI5N.cjs} +13 -3
- package/dist/chunk-V24EPI5N.cjs.map +1 -0
- package/dist/{chunk-HDHLZK7C.cjs → chunk-VACPZPUA.cjs} +5 -5
- package/dist/{chunk-HDHLZK7C.cjs.map → chunk-VACPZPUA.cjs.map} +1 -1
- package/dist/{chunk-ICDLYU4I.js → chunk-Y6X7UJSD.js} +10 -9
- package/dist/chunk-Y6X7UJSD.js.map +1 -0
- package/dist/chunk-YCXRSWCQ.js +42 -0
- package/dist/chunk-YCXRSWCQ.js.map +1 -0
- package/dist/entries/apps.cjs +44 -44
- package/dist/entries/apps.js +9 -9
- package/dist/entries/credits.cjs +217 -152
- package/dist/entries/credits.d.cts +112 -6
- package/dist/entries/credits.d.ts +112 -6
- package/dist/entries/credits.js +13 -8
- package/dist/entries/entities.cjs +188 -143
- package/dist/entries/entities.d.cts +122 -1
- package/dist/entries/entities.d.ts +122 -1
- package/dist/entries/entities.js +2 -1
- package/dist/entries/llm-models.d.cts +2 -1
- package/dist/entries/llm-models.d.ts +2 -1
- package/dist/entries/media.cjs +92 -87
- package/dist/entries/media.d.cts +11 -1
- package/dist/entries/media.d.ts +11 -1
- package/dist/entries/media.js +3 -2
- package/dist/entries/model-catalog.cjs +207 -99
- package/dist/entries/model-catalog.d.cts +90 -4
- package/dist/entries/model-catalog.d.ts +90 -4
- package/dist/entries/model-catalog.js +5 -5
- package/dist/entries/models.cjs +407 -294
- package/dist/entries/models.d.cts +4 -3
- package/dist/entries/models.d.ts +4 -3
- package/dist/entries/models.js +6 -5
- package/dist/entries/nodes.cjs +241 -233
- package/dist/entries/nodes.d.cts +15 -2
- package/dist/entries/nodes.d.ts +15 -2
- package/dist/entries/nodes.js +10 -10
- package/dist/entries/pipeline.cjs +152 -152
- package/dist/entries/pipeline.d.cts +2 -1
- package/dist/entries/pipeline.d.ts +2 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +308 -204
- package/dist/entries/video.d.cts +480 -98
- package/dist/entries/video.d.ts +480 -98
- package/dist/entries/video.js +8 -4
- package/dist/entries/workflow.cjs +111 -99
- package/dist/entries/workflow.d.cts +29 -2
- package/dist/entries/workflow.d.ts +29 -2
- package/dist/entries/workflow.js +2 -2
- package/dist/{gpt-image-2-6-BeZdT-pW.d.cts → gpt-image-2-6-jIRQBRag.d.cts} +6 -0
- package/dist/{gpt-image-2-6-BeZdT-pW.d.ts → gpt-image-2-6-jIRQBRag.d.ts} +6 -0
- package/dist/index.cjs +2321 -1870
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +26 -23
- package/dist/{model-catalog-D6Es7VG-.d.cts → model-catalog-CCEcv08q.d.cts} +179 -14
- package/dist/{model-catalog-D6Es7VG-.d.ts → model-catalog-CCEcv08q.d.ts} +179 -14
- package/dist/{model-constants-22k3fjp1.d.cts → model-constants-B88p6XR0.d.ts} +305 -20
- package/dist/{model-constants-22k3fjp1.d.ts → model-constants-Cf3zaITt.d.cts} +305 -20
- package/package.json +1 -1
- package/src/__tests__/extend-providers.test.ts +114 -0
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +118 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +68 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +4 -1
- package/src/__tests__/gpt-image-2-6.test.ts +7 -0
- package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
- package/src/__tests__/gvp-supported-providers.test.ts +5 -2
- package/src/__tests__/image-mask-mode.test.ts +34 -1
- package/src/__tests__/mask-edit-follows-source.test.ts +150 -0
- package/src/__tests__/minimax-h3-image.test.ts +140 -0
- package/src/__tests__/model-makers.test.ts +49 -11
- package/src/__tests__/model-tree.test.ts +13 -0
- package/src/__tests__/retired-video-provider.test.ts +15 -5
- package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
- package/src/__tests__/seedance-task-type.test.ts +178 -0
- package/src/__tests__/seedream-5-5.test.ts +117 -0
- package/src/__tests__/unit-contract-compose.test.ts +27 -1
- package/src/__tests__/unit-contracts.test.ts +20 -6
- package/src/__tests__/upscale-factors.test.ts +107 -0
- package/src/__tests__/video-character-refs.test.ts +20 -2
- package/src/__tests__/video-collapse-parity.test.ts +19 -0
- package/src/__tests__/video-overlay-geometry.test.ts +68 -0
- package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
- package/src/__tests__/video-overlay-layouts.test.ts +529 -0
- package/src/__tests__/video-overlay-pricing.test.ts +61 -0
- package/src/__tests__/video-overlay-validate.test.ts +128 -0
- package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
- package/src/__tests__/video-overlay.test.ts +280 -194
- package/src/__tests__/video-ref-limits.test.ts +2 -1
- package/src/__tests__/video-reference-only.test.ts +6 -2
- package/src/__tests__/video-start-frame-only.test.ts +98 -0
- package/src/__tests__/wired-character-names.test.ts +220 -0
- package/src/credit-estimators/index.ts +8 -0
- package/src/credit-estimators/video-overlay.ts +70 -0
- package/src/credit-identifiers.ts +102 -5
- package/src/entity-image-url.ts +21 -0
- package/src/entries/credits.ts +14 -0
- package/src/entries/entities.ts +14 -0
- package/src/entries/model-catalog.ts +39 -1
- package/src/entries/models.ts +34 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/video.ts +6 -0
- package/src/entries/workflow.ts +1 -0
- package/src/generated/unit-contracts.ts +8 -1
- package/src/gpt-image-2-6.ts +6 -0
- package/src/input-image-pricing.ts +76 -0
- package/src/mask-composite.ts +11 -0
- package/src/minimax-h3-image.ts +61 -0
- package/src/model-catalog.ts +512 -48
- package/src/model-constants.ts +602 -34
- package/src/node-default-mappings.ts +12 -2
- package/src/node-execution-state.ts +4 -1
- package/src/producer-types.ts +23 -1
- package/src/seedance-task-type.ts +37 -0
- package/src/seedream-5-5.ts +45 -0
- package/src/unit-contract-compose.ts +4 -1
- package/src/upscale-factors.ts +111 -0
- package/src/video-character-refs.ts +7 -4
- package/src/video-overlay-geometry.ts +99 -0
- package/src/video-overlay-input.ts +25 -0
- package/src/video-overlay-layout-ids.ts +48 -0
- package/src/video-overlay-layouts.ts +315 -0
- package/src/video-overlay-validate.ts +223 -0
- package/src/video-overlay-video-layers.ts +304 -0
- package/src/video-overlay.ts +165 -297
- package/src/video-ui-defaults.ts +8 -6
- package/src/wired-character-names.ts +202 -0
- package/src/wired-image-size.ts +55 -0
- package/dist/chunk-5Y42RIGY.cjs.map +0 -1
- package/dist/chunk-6XVHYD5R.js.map +0 -1
- package/dist/chunk-A6HRY3WF.cjs.map +0 -1
- package/dist/chunk-AFQFGZN7.cjs.map +0 -1
- package/dist/chunk-AXT7YNOR.cjs.map +0 -1
- package/dist/chunk-AZGONXWV.js.map +0 -1
- package/dist/chunk-BDXXOEBZ.cjs.map +0 -1
- package/dist/chunk-CIOXUPCJ.cjs.map +0 -1
- package/dist/chunk-DQIJPDHC.cjs.map +0 -1
- package/dist/chunk-DS2TOM32.js.map +0 -1
- package/dist/chunk-FVVD6XY2.js.map +0 -1
- package/dist/chunk-G4XWVWRI.js.map +0 -1
- package/dist/chunk-G6GMY5BC.js.map +0 -1
- package/dist/chunk-G7ZYZQKO.cjs +0 -27
- package/dist/chunk-G7ZYZQKO.cjs.map +0 -1
- package/dist/chunk-GWBQ3GPO.cjs.map +0 -1
- package/dist/chunk-HNEF2N5C.cjs +0 -19
- package/dist/chunk-HNEF2N5C.cjs.map +0 -1
- package/dist/chunk-HOKWJXHA.cjs.map +0 -1
- package/dist/chunk-HYBACFYW.js.map +0 -1
- package/dist/chunk-ICDLYU4I.js.map +0 -1
- package/dist/chunk-JKZVRKN3.js.map +0 -1
- package/dist/chunk-KOLC7AF2.js.map +0 -1
- package/dist/chunk-LN3EVFRS.js.map +0 -1
- package/dist/chunk-M3SXUUWC.cjs.map +0 -1
- package/dist/chunk-MHY47BLL.js +0 -23
- package/dist/chunk-MHY47BLL.js.map +0 -1
- package/dist/chunk-PONP5J5E.cjs.map +0 -1
- package/dist/chunk-SWVGHAYO.js.map +0 -1
- package/dist/chunk-VB2ARGQ6.js.map +0 -1
- package/dist/chunk-VYQ25YQF.js +0 -17
- package/dist/chunk-VYQ25YQF.js.map +0 -1
- package/dist/chunk-W4M7TNXG.cjs.map +0 -1
- package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
- package/dist/chunk-XROE3CAS.cjs.map +0 -1
- package/dist/chunk-YHVEZVAO.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { MODEL_CATALOG, hasFeature } from "../model-catalog.js"
|
|
3
|
+
import {
|
|
4
|
+
IMAGE_TO_VIDEO_PROVIDERS,
|
|
5
|
+
TEXT_TO_VIDEO_PROVIDERS,
|
|
6
|
+
GROK_VIDEO_15_PROVIDER,
|
|
7
|
+
GROK_VIDEO_15_MAX_MIDDLE_FRAMES,
|
|
8
|
+
isGrokVideo15Provider,
|
|
9
|
+
normalizeGrokVideo15Resolution,
|
|
10
|
+
grokVideo15MiddleFrameSlots,
|
|
11
|
+
videoKeyframesMiddleCap,
|
|
12
|
+
kling4KeyframeFrameCap,
|
|
13
|
+
KLING_4_MAX_MIDDLE_FRAMES,
|
|
14
|
+
VIDEO_REF_LIMITS_BY_PROVIDER,
|
|
15
|
+
VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL,
|
|
16
|
+
RESOLUTION_DURATION_PRICING,
|
|
17
|
+
PRICING_DEFAULT_RESOLUTION,
|
|
18
|
+
videoProviderRequiresImage,
|
|
19
|
+
videoProviderAppendsFrames,
|
|
20
|
+
videoProviderRunsFromReferences,
|
|
21
|
+
videoProviderTakesLoneEndFrame,
|
|
22
|
+
videoProviderRefsReplaceStartFrame,
|
|
23
|
+
videoProviderFoldsLoneEndFrame,
|
|
24
|
+
isGeminiOmniPerSecondProvider,
|
|
25
|
+
resolveVideoModeForInputs,
|
|
26
|
+
isGvpSupportedProvider,
|
|
27
|
+
} from "../model-constants.js"
|
|
28
|
+
import { buildVideoCreditModelIdentifier, pricedVideoSelection } from "../credit-identifiers.js"
|
|
29
|
+
import { uiResolutionFill } from "../video-ui-defaults.js"
|
|
30
|
+
import { mapQuality } from "../node-default-mappings.js"
|
|
31
|
+
|
|
32
|
+
const ID = "grok-imagine-video-1.5"
|
|
33
|
+
const videoIds = Object.values(MODEL_CATALOG).filter((m) => m.kind === "video").map((m) => m.id)
|
|
34
|
+
|
|
35
|
+
describe("grok-imagine-video-1.5 catalog (frames, in-between frames, 1080p)", () => {
|
|
36
|
+
it("an image-to-video model with an end frame and in-between frames, 1-15s at 480p / 720p / 1080p", () => {
|
|
37
|
+
const m = MODEL_CATALOG[ID]!
|
|
38
|
+
expect(isGrokVideo15Provider(ID)).toBe(true)
|
|
39
|
+
expect(GROK_VIDEO_15_PROVIDER).toBe(ID)
|
|
40
|
+
expect([...m.modes]).toEqual(["i2v"])
|
|
41
|
+
expect([...(m.features ?? [])].sort()).toEqual(["end-frame", "keyframes", "reference-image"])
|
|
42
|
+
// In-between frames need the start frame: no references-only mode.
|
|
43
|
+
expect(videoProviderRunsFromReferences(ID)).toBe(false)
|
|
44
|
+
expect(m.durations).toEqual(Array.from({ length: 15 }, (_, i) => i + 1))
|
|
45
|
+
expect(m.defaultDuration).toBe(8)
|
|
46
|
+
expect(m.resolutions).toEqual(["480p", "720p", "1080p"])
|
|
47
|
+
expect(m.noSeed).toBe(true)
|
|
48
|
+
// Unchanged by this model's frames: the ratio list and the lanes it is in.
|
|
49
|
+
expect(m.aspectRatios).toEqual(["16:9", "9:16", "1:1", "4:3", "3:4"])
|
|
50
|
+
expect(IMAGE_TO_VIDEO_PROVIDERS as readonly string[]).toContain(ID)
|
|
51
|
+
expect(TEXT_TO_VIDEO_PROVIDERS as readonly string[]).toContain(ID)
|
|
52
|
+
expect(videoProviderRequiresImage(ID)).toBe(true)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it("the in-between frames ride their own channel, at most 4, and keep the model out of generate-video-pro", () => {
|
|
56
|
+
expect(VIDEO_REF_LIMITS_BY_PROVIDER[ID]).toEqual({ images: GROK_VIDEO_15_MAX_MIDDLE_FRAMES })
|
|
57
|
+
expect(GROK_VIDEO_15_MAX_MIDDLE_FRAMES).toBe(4)
|
|
58
|
+
expect(VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL.has(ID)).toBe(true)
|
|
59
|
+
expect(videoProviderAppendsFrames(ID)).toBe(false)
|
|
60
|
+
expect(isGvpSupportedProvider(ID)).toBe(false)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it("480p stays the default: the first priced tier, the collapse target and the bare id's tier", () => {
|
|
64
|
+
expect(RESOLUTION_DURATION_PRICING[ID]).toEqual(["480p", "720p", "1080p"])
|
|
65
|
+
expect(MODEL_CATALOG[ID]!.unlistedResolutionRendersAs).toBe("480p")
|
|
66
|
+
expect(normalizeGrokVideo15Resolution(undefined)).toBe("480p")
|
|
67
|
+
expect(buildVideoCreditModelIdentifier(ID)).toBe(`${ID}:8s:480p`)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it("an unset resolution is 480p for every reader of the declared default", () => {
|
|
71
|
+
expect(PRICING_DEFAULT_RESOLUTION[ID]).toBe("480p")
|
|
72
|
+
// The routes and the workflow run fill it (and send it), at the same price.
|
|
73
|
+
expect(pricedVideoSelection({ provider: ID }).resolution).toBe("480p")
|
|
74
|
+
expect(pricedVideoSelection({ provider: ID, resolution: "720p" }).resolution).toBe("720p")
|
|
75
|
+
expect(buildVideoCreditModelIdentifier(ID, 8, undefined, "image-to-video", undefined, undefined)).toBe(`${ID}:8s:480p`)
|
|
76
|
+
// The editor's persisted fill is family-scoped and stays out of it: the
|
|
77
|
+
// panel's own snap keeps 480p first.
|
|
78
|
+
expect(uiResolutionFill(ID)).toBeUndefined()
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it("the quality rungs land on the three tiers", () => {
|
|
82
|
+
expect(mapQuality(ID, "low")).toEqual({ field: "resolution", value: "480p" })
|
|
83
|
+
expect(mapQuality(ID, "mid")).toEqual({ field: "resolution", value: "720p" })
|
|
84
|
+
expect(mapQuality(ID, "high")).toEqual({ field: "resolution", value: "1080p" })
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
describe("one resolution normalizer for the wire and the bill", () => {
|
|
89
|
+
it("folds case and collapses anything else to 480p", () => {
|
|
90
|
+
expect(normalizeGrokVideo15Resolution("1080P")).toBe("1080p")
|
|
91
|
+
expect(normalizeGrokVideo15Resolution(" 720p ")).toBe("720p")
|
|
92
|
+
expect(normalizeGrokVideo15Resolution("480p")).toBe("480p")
|
|
93
|
+
expect(normalizeGrokVideo15Resolution("4k")).toBe("480p")
|
|
94
|
+
expect(normalizeGrokVideo15Resolution("")).toBe("480p")
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it("the credit identifier bills what the runner renders, for every spelling", () => {
|
|
98
|
+
const cases: Array<[string | undefined, string]> = [
|
|
99
|
+
["1080P", "1080p"],
|
|
100
|
+
["1080p", "1080p"],
|
|
101
|
+
["720P", "720p"],
|
|
102
|
+
["480p", "480p"],
|
|
103
|
+
[undefined, "480p"],
|
|
104
|
+
["4k", "480p"],
|
|
105
|
+
["nonsense", "480p"],
|
|
106
|
+
]
|
|
107
|
+
for (const [asked, billed] of cases) {
|
|
108
|
+
expect(normalizeGrokVideo15Resolution(asked)).toBe(billed)
|
|
109
|
+
expect(buildVideoCreditModelIdentifier(ID, 8, undefined, "image-to-video", undefined, asked)).toBe(`${ID}:8s:${billed}`)
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it("prices every second 1-15 on its own row, the default 8s when unset", () => {
|
|
114
|
+
for (let s = 1; s <= 15; s++) {
|
|
115
|
+
expect(buildVideoCreditModelIdentifier(ID, s, undefined, "image-to-video", undefined, "720p")).toBe(`${ID}:${s}s:720p`)
|
|
116
|
+
}
|
|
117
|
+
expect(buildVideoCreditModelIdentifier(ID, undefined, undefined, "image-to-video", undefined, "1080p")).toBe(`${ID}:8s:1080p`)
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe("in-between frame slots", () => {
|
|
122
|
+
it("one per whole second inside the clip, at most 4", () => {
|
|
123
|
+
const expected: Record<number, number> = { 1: 0, 2: 1, 3: 2, 4: 3, 5: 4, 8: 4, 15: 4 }
|
|
124
|
+
for (const [seconds, slots] of Object.entries(expected)) {
|
|
125
|
+
expect(grokVideo15MiddleFrameSlots(Number(seconds)), `${seconds}s`).toBe(slots)
|
|
126
|
+
}
|
|
127
|
+
// Unset renders the 8s default.
|
|
128
|
+
expect(grokVideo15MiddleFrameSlots(undefined)).toBe(4)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
it("the start and end frames take no slot on Grok, and share the cap on Kling 4.0 Keyframes", () => {
|
|
132
|
+
for (const hasStartFrame of [false, true]) {
|
|
133
|
+
for (const hasEndFrame of [false, true]) {
|
|
134
|
+
expect(videoKeyframesMiddleCap(ID, 3, { hasStartFrame, hasEndFrame })).toBe(2)
|
|
135
|
+
for (const seconds of [3, 5, 9, 30]) {
|
|
136
|
+
const ends = (hasStartFrame ? 1 : 0) + (hasEndFrame ? 1 : 0)
|
|
137
|
+
expect(videoKeyframesMiddleCap("kling-4-keyframes", seconds, { hasStartFrame, hasEndFrame }))
|
|
138
|
+
.toBe(Math.max(0, Math.min(KLING_4_MAX_MIDDLE_FRAMES, kling4KeyframeFrameCap(seconds) - ends)))
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
expect(videoKeyframesMiddleCap("seedance-2", 8, { hasStartFrame: true, hasEndFrame: false })).toBeUndefined()
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
describe("a lone end frame and references alone: Grok keeps the general rule", () => {
|
|
147
|
+
it("Grok needs its start image: a lone end frame is not kept as the end, in-between frames do not replace it", () => {
|
|
148
|
+
expect(videoProviderTakesLoneEndFrame(ID)).toBe(false)
|
|
149
|
+
expect(videoProviderFoldsLoneEndFrame(ID)).toBe(false)
|
|
150
|
+
expect(videoProviderRefsReplaceStartFrame(ID)).toBe(false)
|
|
151
|
+
// The workflow run's mode resolver agrees: in-between frames alone go to the
|
|
152
|
+
// text-to-video lane, whose image gate refuses the run.
|
|
153
|
+
expect(resolveVideoModeForInputs(ID, { hasStartFrame: false, hasImageRefs: true })).toBe("text-to-video")
|
|
154
|
+
expect(resolveVideoModeForInputs(ID, { hasStartFrame: true, hasImageRefs: true })).toBe("image-to-video")
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it("every other model answers exactly as the rules these helpers replace did", () => {
|
|
158
|
+
for (const id of videoIds) {
|
|
159
|
+
if (id === ID) continue
|
|
160
|
+
const oldTakesLoneEnd = hasFeature(id, "keyframes") || isGeminiOmniPerSecondProvider(id)
|
|
161
|
+
expect(videoProviderTakesLoneEndFrame(id), id).toBe(oldTakesLoneEnd)
|
|
162
|
+
const oldRefsCarried = (VIDEO_REF_LIMITS_BY_PROVIDER[id]?.images ?? 0) > 0
|
|
163
|
+
expect(videoProviderRefsReplaceStartFrame(id), id).toBe(oldRefsCarried)
|
|
164
|
+
}
|
|
165
|
+
expect(videoProviderTakesLoneEndFrame("kling-4-keyframes")).toBe(true)
|
|
166
|
+
expect(videoProviderTakesLoneEndFrame("gemini-omni-flash-1-2")).toBe(true)
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
describe("the price ladder", () => {
|
|
171
|
+
it("each catalog row is ceil(rate × seconds × 2.5 / 10) × 10 at the per-second rate of its resolution", () => {
|
|
172
|
+
// Rates in tenths of a provider credit a second (integers, so no float lands
|
|
173
|
+
// a boundary row one step up); the bare id is the 8s 480p row.
|
|
174
|
+
const tenths: Record<string, number> = { "480p": 24, "720p": 45, "1080p": 80 }
|
|
175
|
+
const ladder = (res: string, s: number) => Math.ceil((tenths[res]! * s * 25) / 1000) * 10
|
|
176
|
+
for (const row of MODEL_CATALOG[ID]!.pricing) {
|
|
177
|
+
const m = /^grok-imagine-video-1\.5(?::(\d+)s:(\d+p))?$/.exec(row.identifier)
|
|
178
|
+
expect(m, row.identifier).not.toBeNull()
|
|
179
|
+
const [s, res] = m![1] ? [Number(m![1]), m![2]!] : [8, "480p"]
|
|
180
|
+
expect(row.credits, row.identifier).toBe(ladder(res, s))
|
|
181
|
+
}
|
|
182
|
+
expect(ladder("480p", 8)).toBe(50)
|
|
183
|
+
expect(ladder("720p", 8)).toBe(90)
|
|
184
|
+
expect(ladder("1080p", 8)).toBe(160)
|
|
185
|
+
expect(ladder("480p", 15)).toBe(90)
|
|
186
|
+
expect(ladder("720p", 15)).toBe(170)
|
|
187
|
+
expect(ladder("1080p", 15)).toBe(300)
|
|
188
|
+
})
|
|
189
|
+
})
|
|
@@ -62,6 +62,7 @@ describe("GVP_SUPPORTED_PROVIDERS", () => {
|
|
|
62
62
|
"gemini-omni-flash",
|
|
63
63
|
"gemini-omni-flash-1-2",
|
|
64
64
|
"kling-4",
|
|
65
|
+
"kling-4-flash",
|
|
65
66
|
"grok-i2v",
|
|
66
67
|
"wan-3",
|
|
67
68
|
"wan-3-prime",
|
|
@@ -91,8 +92,8 @@ describe("GVP_SUPPORTED_PROVIDERS", () => {
|
|
|
91
92
|
* The cross-check that makes the catalog flag trustworthy.
|
|
92
93
|
* VIDEO_REF_LIMITS_BY_PROVIDER was built by the 2026-06-28 audit of actual
|
|
93
94
|
* backend reference-FORWARDING paths (it deliberately omits wan-i2v /
|
|
94
|
-
* hailuo-2.3[-pro] / bytedance-pro[-fast]
|
|
95
|
-
*
|
|
95
|
+
* hailuo-2.3[-pro] / bytedance-pro[-fast], which take a single image_url
|
|
96
|
+
* start frame and drop refs on the floor). If the
|
|
96
97
|
* two signals ever disagree, one of them is lying about what the backend
|
|
97
98
|
* does — fail the build rather than advertise a dropped capability.
|
|
98
99
|
*/
|
|
@@ -137,6 +138,8 @@ describe("GVP_SUPPORTED_PROVIDERS", () => {
|
|
|
137
138
|
expect(isGvpSupportedProvider("wan-i2v")).toBe(false)
|
|
138
139
|
expect(isGvpSupportedProvider("hailuo-2.3-pro")).toBe(false)
|
|
139
140
|
expect(isGvpSupportedProvider("bytedance-pro")).toBe(false)
|
|
141
|
+
// Its Image References are in-between FRAMES (`keyframes`), like Kling 4.0
|
|
142
|
+
// Keyframes: a pro segment's cast references would land as frames.
|
|
140
143
|
expect(isGvpSupportedProvider("grok-imagine-video-1.5")).toBe(false)
|
|
141
144
|
// VEO 3.1 Quality joins them: i2v and segmentable, but no reference
|
|
142
145
|
// transport at KIE (Fast/Lite only), so the anchor wave has nowhere to
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest"
|
|
2
|
-
import { IMAGE_GEN_PROVIDERS } from "../model-constants.js"
|
|
2
|
+
import { I2I_MASK_SUPPORT, IMAGE_GEN_PROVIDERS, MODIFY_IMAGE_PROVIDERS } from "../model-constants.js"
|
|
3
3
|
import { IMAGE_MASK_MODE } from "../model-constants.js"
|
|
4
|
+
import { MODEL_CATALOG } from "../model-catalog.js"
|
|
4
5
|
|
|
5
6
|
describe("IMAGE_MASK_MODE", () => {
|
|
6
7
|
it("has an entry for every image-gen provider (completeness invariant)", () => {
|
|
@@ -14,3 +15,35 @@ describe("IMAGE_MASK_MODE", () => {
|
|
|
14
15
|
for (const v of values) expect(["prompt", "composite"]).toContain(v)
|
|
15
16
|
})
|
|
16
17
|
})
|
|
18
|
+
|
|
19
|
+
describe("I2I_MASK_SUPPORT (the image-to-image models that take a mask of their own)", () => {
|
|
20
|
+
it("lists GPT Image 2.6 Flare and Sunburst edits beside Ideogram Edit and FLUX Fill", () => {
|
|
21
|
+
expect([...I2I_MASK_SUPPORT].sort()).toEqual([
|
|
22
|
+
"flux-fill",
|
|
23
|
+
"gpt-image-2-6-flare-i2i",
|
|
24
|
+
"gpt-image-2-6-sunburst-i2i",
|
|
25
|
+
"ideogram-edit",
|
|
26
|
+
])
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it("leaves out the GPT Image edits that take no mask", () => {
|
|
30
|
+
for (const id of ["gpt-image-2-6-economy-i2i", "gpt-image-2-5-flare-i2i", "gpt-image-2-5-sunburst-i2i", "gpt-image-2-i2i"]) {
|
|
31
|
+
expect(I2I_MASK_SUPPORT.has(id)).toBe(false)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it("names only models /v1/image-to-image takes", () => {
|
|
36
|
+
expect([...I2I_MASK_SUPPORT].filter((id) => !(MODIFY_IMAGE_PROVIDERS as readonly string[]).includes(id))).toEqual([])
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// One way only: FLUX Fill takes a mask but has no catalog entry.
|
|
40
|
+
it("holds every catalog entry that lists the mask feature", () => {
|
|
41
|
+
const listed = Object.values(MODEL_CATALOG).filter((m) => m.features?.includes("mask")).map((m) => m.id)
|
|
42
|
+
expect(listed.filter((id) => !I2I_MASK_SUPPORT.has(id))).toEqual([])
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it("is listed with the mask feature by every catalog entry it names", () => {
|
|
46
|
+
const inCatalog = [...I2I_MASK_SUPPORT].filter((id) => MODEL_CATALOG[id] !== undefined)
|
|
47
|
+
expect(inCatalog.filter((id) => !MODEL_CATALOG[id]!.features?.includes("mask"))).toEqual([])
|
|
48
|
+
})
|
|
49
|
+
})
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { MODEL_CATALOG, maskEditMatchesSource, normalizeModelInput, resolutionNearestSource, sourceImageSizeNeeded } from "../model-catalog.js"
|
|
3
|
+
import { resolveNormalizedImageGen } from "../credit-identifiers.js"
|
|
4
|
+
import { I2I_MASK_SUPPORT } from "../model-constants.js"
|
|
5
|
+
import { nodeIsMasked, wiredImageSize } from "../wired-image-size.js"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A masked GPT Image 2.6 edit follows its photo: the result is pasted back onto
|
|
9
|
+
* the photo at the photo's own size, so the run keeps the photo's shape and is
|
|
10
|
+
* rendered, and priced, at the size nearest the photo.
|
|
11
|
+
*/
|
|
12
|
+
const FOLLOWING = ["gpt-image-2-6-flare-i2i", "gpt-image-2-6-sunburst-i2i"] as const
|
|
13
|
+
const PHOTO_1K_PORTRAIT = { width: 768, height: 1024 }
|
|
14
|
+
const PHOTO_4000_PORTRAIT = { width: 3000, height: 4000 }
|
|
15
|
+
|
|
16
|
+
describe("the catalog", () => {
|
|
17
|
+
it("only GPT Image 2.6 Flare's and Sunburst's edits follow their photo", () => {
|
|
18
|
+
const declared = Object.values(MODEL_CATALOG).filter((m) => m.maskEditMatchesSource).map((m) => m.id).sort()
|
|
19
|
+
expect(declared).toEqual([...FOLLOWING])
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("each such model takes a mask, and has a size for every ratio it lists at every size", () => {
|
|
23
|
+
for (const id of FOLLOWING) {
|
|
24
|
+
const m = MODEL_CATALOG[id]!
|
|
25
|
+
expect(I2I_MASK_SUPPORT.has(id)).toBe(true)
|
|
26
|
+
for (const ratio of m.aspectRatios!.filter((r) => r !== "auto")) {
|
|
27
|
+
for (const size of m.resolutions!) expect(m.outputSizes?.[ratio]?.[size], `${id} ${ratio} ${size}`).toBeDefined()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("the table is the provider's: 1:1 at 4K is 2880 square, 9:16 at 4K 2160x3840", () => {
|
|
33
|
+
const sizes = MODEL_CATALOG["gpt-image-2-6-flare-i2i"]!.outputSizes!
|
|
34
|
+
expect(sizes["1:1"]!["4K"]).toEqual([2880, 2880])
|
|
35
|
+
expect(sizes["9:16"]!["4K"]).toEqual([2160, 3840])
|
|
36
|
+
expect(sizes["3:4"]!["1K"]).toEqual([768, 1024])
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
describe("maskEditMatchesSource / sourceImageSizeNeeded", () => {
|
|
41
|
+
it("is true only with a mask, on a model that follows its photo", () => {
|
|
42
|
+
expect(maskEditMatchesSource("gpt-image-2-6-flare-i2i", true)).toBe(true)
|
|
43
|
+
expect(maskEditMatchesSource("gpt-image-2-6-flare-i2i", false)).toBe(false)
|
|
44
|
+
expect(maskEditMatchesSource("ideogram-edit", true)).toBe(false)
|
|
45
|
+
expect(maskEditMatchesSource("gpt-image-2-6-economy-i2i", true)).toBe(false)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it("a masked 2.6 edit needs the photo's size even when it names a ratio", () => {
|
|
49
|
+
expect(sourceImageSizeNeeded("gpt-image-2-6-flare-i2i", "16:9", true)).toBe(true)
|
|
50
|
+
expect(sourceImageSizeNeeded("gpt-image-2-6-flare-i2i", "16:9", false)).toBe(false)
|
|
51
|
+
expect(sourceImageSizeNeeded("gpt-image-2-6-flare-i2i", "auto", false)).toBe(true)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
describe("resolutionNearestSource", () => {
|
|
56
|
+
it("picks the size whose long side is nearest the photo's", () => {
|
|
57
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "3:4", PHOTO_1K_PORTRAIT)).toBe("1K")
|
|
58
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "3:4", PHOTO_4000_PORTRAIT)).toBe("4K")
|
|
59
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "3:4", { width: 1536, height: 2048 })).toBe("2K")
|
|
60
|
+
// Nearest by ratio: 1500 px is nearer 2048 than 1024.
|
|
61
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "1:1", { width: 1500, height: 1500 })).toBe("2K")
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it("is undefined with no size, an unknown ratio or a model without a table", () => {
|
|
65
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "3:4", undefined)).toBeUndefined()
|
|
66
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "auto", PHOTO_1K_PORTRAIT)).toBeUndefined()
|
|
67
|
+
expect(resolutionNearestSource("gpt-image-2-6-flare-i2i", "constructor", PHOTO_1K_PORTRAIT)).toBeUndefined()
|
|
68
|
+
expect(resolutionNearestSource("gpt-image-2-i2i", "3:4", PHOTO_1K_PORTRAIT)).toBeUndefined()
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
describe("normalizeModelInput: a masked edit that follows its photo", () => {
|
|
73
|
+
for (const id of FOLLOWING) {
|
|
74
|
+
it(`${id}: a 1K photo with a 4K request runs, and is priced, at 1K`, () => {
|
|
75
|
+
const n = normalizeModelInput(id, { aspectRatio: "auto", resolution: "4K" }, { sourceImage: PHOTO_1K_PORTRAIT, masked: true })
|
|
76
|
+
expect(n.aspectRatio).toBe("3:4")
|
|
77
|
+
expect(n.resolution).toBe("1K")
|
|
78
|
+
expect(n.adjustments).toContainEqual(expect.objectContaining({ field: "resolution", from: "4K", to: "1K" }))
|
|
79
|
+
const priced = resolveNormalizedImageGen({ provider: id, aspectRatio: "auto", resolution: "4K", refCount: 1, sourceImage: PHOTO_1K_PORTRAIT, masked: true })
|
|
80
|
+
expect(priced.identifier).toBe(`${id}:medium:1K:1ref`)
|
|
81
|
+
expect(priced.resolution).toBe("1K")
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it(`${id}: a 4000 px photo with a 1K request runs, and is priced, at 4K`, () => {
|
|
85
|
+
const priced = resolveNormalizedImageGen({ provider: id, aspectRatio: "auto", resolution: "1K", refCount: 1, sourceImage: PHOTO_4000_PORTRAIT, masked: true })
|
|
86
|
+
expect(priced.identifier).toBe(`${id}:medium:4K:1ref`)
|
|
87
|
+
expect(priced.adjustments).toContainEqual(expect.objectContaining({ field: "resolution", from: "1K", to: "4K" }))
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it(`${id}: a named 16:9 on a 3:4 photo runs 3:4, and says so`, () => {
|
|
91
|
+
const n = normalizeModelInput(id, { aspectRatio: "16:9", resolution: "1K" }, { sourceImage: PHOTO_1K_PORTRAIT, masked: true })
|
|
92
|
+
expect(n.aspectRatio).toBe("3:4")
|
|
93
|
+
expect(n.adjustments).toContainEqual(expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "3:4" }))
|
|
94
|
+
expect(n.adjustments.find((a) => a.field === "aspectRatio")!.reason).toContain("masked edit")
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it(`${id}: no ratio named also keeps the photo's shape`, () => {
|
|
98
|
+
const n = normalizeModelInput(id, { resolution: "2K" }, { sourceImage: { width: 2048, height: 1536 }, masked: true })
|
|
99
|
+
expect(n.aspectRatio).toBe("4:3")
|
|
100
|
+
expect(n.resolution).toBe("2K")
|
|
101
|
+
expect(n.adjustments).toEqual([])
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it(`${id}: with the photo's size unknown, the ratio is "auto" and the size asked is kept`, () => {
|
|
105
|
+
const n = normalizeModelInput(id, { aspectRatio: "16:9", resolution: "4K" }, { masked: true })
|
|
106
|
+
expect(n.aspectRatio).toBe("auto")
|
|
107
|
+
expect(n.resolution).toBe("4K")
|
|
108
|
+
expect(n.adjustments).toEqual([expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "auto" })])
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it(`${id}: without a mask, the ratio and the size asked are kept`, () => {
|
|
112
|
+
const n = normalizeModelInput(id, { aspectRatio: "16:9", resolution: "4K" }, { sourceImage: PHOTO_1K_PORTRAIT })
|
|
113
|
+
expect(n.aspectRatio).toBe("16:9")
|
|
114
|
+
expect(n.resolution).toBe("4K")
|
|
115
|
+
expect(n.adjustments).toEqual([])
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it(`${id}: a transparent background still renders at 1K`, () => {
|
|
119
|
+
const n = normalizeModelInput(id, { aspectRatio: "auto", resolution: "1K", background: "transparent" }, { sourceImage: PHOTO_4000_PORTRAIT, masked: true })
|
|
120
|
+
expect(n.resolution).toBe("1K")
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
it("another mask model keeps the ratio and the size it names", () => {
|
|
125
|
+
const n = normalizeModelInput("gpt-image-2-6-economy-i2i", { aspectRatio: "16:9" }, { sourceImage: PHOTO_1K_PORTRAIT, masked: true })
|
|
126
|
+
expect(n.aspectRatio).toBe("16:9")
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
describe("wiredImageSize / nodeIsMasked (what an estimate knows of the photo)", () => {
|
|
131
|
+
const nodes = [
|
|
132
|
+
{ id: "gen", data: { generatedResults: [{ width: 1024, height: 1024 }, { width: 768, height: 1024 }], activeResultIndex: 1 } },
|
|
133
|
+
{ id: "up", data: { width: 4000, height: 3000 } },
|
|
134
|
+
{ id: "none", data: {} },
|
|
135
|
+
{ id: "n", data: {} },
|
|
136
|
+
]
|
|
137
|
+
it("reads the shown result's size, else the node's own, from the node wired into `image`", () => {
|
|
138
|
+
expect(wiredImageSize("n", nodes, [{ source: "gen", target: "n", targetHandle: "image" }])).toEqual({ width: 768, height: 1024 })
|
|
139
|
+
expect(wiredImageSize("n", nodes, [{ source: "up", target: "n", targetHandle: "image" }])).toEqual({ width: 4000, height: 3000 })
|
|
140
|
+
expect(wiredImageSize("n", nodes, [{ source: "none", target: "n", targetHandle: "image" }])).toBeUndefined()
|
|
141
|
+
// A mask or another input is not the photo.
|
|
142
|
+
expect(wiredImageSize("n", nodes, [{ source: "up", target: "n", targetHandle: "mask" }])).toBeUndefined()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it("a node is masked by its own maskUrl or a wire into `mask`", () => {
|
|
146
|
+
expect(nodeIsMasked("n", { maskUrl: "https://m.png" }, [])).toBe(true)
|
|
147
|
+
expect(nodeIsMasked("n", {}, [{ source: "gm", target: "n", targetHandle: "mask" }])).toBe(true)
|
|
148
|
+
expect(nodeIsMasked("n", {}, [{ source: "x", target: "n", targetHandle: "image" }])).toBe(false)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { buildCreditModelIdentifier, resolveNormalizedImageGen } from "../credit-identifiers.js"
|
|
3
|
+
import { MODEL_CATALOG, defaultResolutionFor, normalizeModelInput } from "../model-catalog.js"
|
|
4
|
+
import {
|
|
5
|
+
MINIMAX_H3_IMAGE_I2I,
|
|
6
|
+
MINIMAX_H3_IMAGE_T2I,
|
|
7
|
+
isMinimaxH3Image,
|
|
8
|
+
minimaxH3ImageCreditId,
|
|
9
|
+
} from "../minimax-h3-image.js"
|
|
10
|
+
import { isPricedPerInputImage, pricedEstimatedImages, pricedSentImages } from "../input-image-pricing.js"
|
|
11
|
+
import {
|
|
12
|
+
IMAGE_GEN_PROVIDERS,
|
|
13
|
+
IMAGE_I2I_PROVIDERS,
|
|
14
|
+
MINIMAX_H3_PROVIDERS,
|
|
15
|
+
REF_IMAGE_MAX_LIMITS,
|
|
16
|
+
T2I_TO_I2I_VARIANT,
|
|
17
|
+
imageReferenceLimit,
|
|
18
|
+
isMinimaxH3Provider,
|
|
19
|
+
requestImageLimit,
|
|
20
|
+
} from "../model-constants.js"
|
|
21
|
+
|
|
22
|
+
const T2I = MINIMAX_H3_IMAGE_T2I
|
|
23
|
+
const I2I = MINIMAX_H3_IMAGE_I2I
|
|
24
|
+
|
|
25
|
+
describe("MiniMax H3 Image ids", () => {
|
|
26
|
+
it("is an image model on both lists, and never the H3 video model", () => {
|
|
27
|
+
expect(IMAGE_GEN_PROVIDERS).toContain(T2I)
|
|
28
|
+
expect(IMAGE_I2I_PROVIDERS).toContain(I2I)
|
|
29
|
+
for (const id of [T2I, I2I]) {
|
|
30
|
+
expect(MODEL_CATALOG[id]!.kind).toBe("image")
|
|
31
|
+
expect(MINIMAX_H3_PROVIDERS.has(id)).toBe(false)
|
|
32
|
+
expect(isMinimaxH3Provider(id)).toBe(false)
|
|
33
|
+
}
|
|
34
|
+
expect(isMinimaxH3Image("minimax-h3")).toBe(false)
|
|
35
|
+
expect(isPricedPerInputImage("minimax-h3")).toBe(false)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("references move a prompt to the edit id, up to sixteen of them", () => {
|
|
39
|
+
expect(T2I_TO_I2I_VARIANT[T2I]).toBe(I2I)
|
|
40
|
+
expect(REF_IMAGE_MAX_LIMITS[I2I]).toBe(16)
|
|
41
|
+
expect(imageReferenceLimit(T2I)).toBe(16)
|
|
42
|
+
expect(requestImageLimit(T2I)).toBe(16)
|
|
43
|
+
expect(requestImageLimit(I2I)).toBe(16)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
describe("MiniMax H3 Image catalog entries", () => {
|
|
48
|
+
it("offer ten ratios and auto, auto last so a first-listed fallback lands on a real ratio", () => {
|
|
49
|
+
for (const id of [T2I, I2I]) {
|
|
50
|
+
const ratios = MODEL_CATALOG[id]!.aspectRatios!
|
|
51
|
+
expect(ratios).toHaveLength(11)
|
|
52
|
+
expect(ratios[0]).not.toBe("auto")
|
|
53
|
+
expect(ratios[ratios.length - 1]).toBe("auto")
|
|
54
|
+
expect([...ratios].sort()).toEqual(["1:1", "16:9", "21:9", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "auto"].sort())
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it("render 1K, 2K and 4K at every ratio, 2K by default", () => {
|
|
59
|
+
for (const id of [T2I, I2I]) {
|
|
60
|
+
const entry = MODEL_CATALOG[id]!
|
|
61
|
+
expect(entry.resolutions).toEqual(["1K", "2K", "4K"])
|
|
62
|
+
expect(entry.resolutionsByAspectRatio).toBeUndefined()
|
|
63
|
+
expect(defaultResolutionFor(id)).toBe("2K")
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it("write PNG by default or JPEG, and nothing else", () => {
|
|
68
|
+
for (const id of [T2I, I2I]) {
|
|
69
|
+
expect(MODEL_CATALOG[id]!.outputFormats).toEqual(["png", "jpeg"])
|
|
70
|
+
expect(normalizeModelInput(id, { outputFormat: "webp" }).outputFormat).toBe("png")
|
|
71
|
+
expect(normalizeModelInput(id, { outputFormat: "jpeg" }).outputFormat).toBe("jpeg")
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("take a seed and no quality, background or mask", () => {
|
|
76
|
+
for (const id of [T2I, I2I]) {
|
|
77
|
+
const entry = MODEL_CATALOG[id]!
|
|
78
|
+
expect(entry.noSeed).toBeUndefined()
|
|
79
|
+
expect(entry.qualities).toBeUndefined()
|
|
80
|
+
expect(entry.backgrounds).toBeUndefined()
|
|
81
|
+
expect(entry.features ?? []).not.toContain("mask")
|
|
82
|
+
expect(entry.autoAspectFromSourceImage).toBeUndefined()
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
describe("MiniMax H3 Image price ids", () => {
|
|
88
|
+
it("a prompt is priced by its size, 2K when none or an unknown one is named", () => {
|
|
89
|
+
expect(buildCreditModelIdentifier(T2I)).toBe("minimax-h3-image:2K")
|
|
90
|
+
expect(buildCreditModelIdentifier(T2I, undefined, "1K")).toBe("minimax-h3-image:1K")
|
|
91
|
+
expect(buildCreditModelIdentifier(T2I, undefined, "4K")).toBe("minimax-h3-image:4K")
|
|
92
|
+
expect(buildCreditModelIdentifier(T2I, undefined, "4k")).toBe("minimax-h3-image:4K")
|
|
93
|
+
expect(buildCreditModelIdentifier(T2I, undefined, "2 MP")).toBe("minimax-h3-image:2K")
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it("a quality another model takes changes nothing", () => {
|
|
97
|
+
expect(buildCreditModelIdentifier(T2I, "high", "1K")).toBe("minimax-h3-image:1K")
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("an edit is priced by its size and its reference images, one to sixteen", () => {
|
|
101
|
+
expect(buildCreditModelIdentifier(I2I, undefined, "4K", undefined, undefined, 3)).toBe("minimax-h3-image-i2i:4K:3ref")
|
|
102
|
+
expect(buildCreditModelIdentifier(I2I, undefined, undefined, undefined, undefined, 0)).toBe("minimax-h3-image-i2i:2K:1ref")
|
|
103
|
+
expect(buildCreditModelIdentifier(I2I, undefined, "1K", undefined, undefined, 40)).toBe("minimax-h3-image-i2i:1K:16ref")
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it("the text-to-image id sent images is priced as the edit it runs as", () => {
|
|
107
|
+
expect(minimaxH3ImageCreditId(T2I, "1K", 2)).toBe("minimax-h3-image-i2i:1K:2ref")
|
|
108
|
+
expect(buildCreditModelIdentifier(T2I, undefined, "4K", undefined, undefined, 1)).toBe("minimax-h3-image-i2i:4K:1ref")
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("the route and workflow snap price the size they send, with the swap or without", () => {
|
|
112
|
+
const swapped = resolveNormalizedImageGen({ provider: T2I, resolution: "4K", aspectRatio: "16:9", refCount: 2, swapToI2i: true })
|
|
113
|
+
expect(swapped.modelId).toBe(I2I)
|
|
114
|
+
expect(swapped.identifier).toBe("minimax-h3-image-i2i:4K:2ref")
|
|
115
|
+
const entity = resolveNormalizedImageGen({ provider: T2I, refCount: 1, swapToI2i: false })
|
|
116
|
+
expect(entity.modelId).toBe(T2I)
|
|
117
|
+
expect(entity.identifier).toBe("minimax-h3-image-i2i:2K:1ref")
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe("MiniMax H3 Image: the images a run sends", () => {
|
|
122
|
+
const BASE = "https://cdn.example.com/base.png"
|
|
123
|
+
const REF = "https://cdn.example.com/ref.png"
|
|
124
|
+
|
|
125
|
+
it("counts the base of an edit, once", () => {
|
|
126
|
+
expect(pricedSentImages(T2I, [], BASE)).toBe(1)
|
|
127
|
+
expect(pricedSentImages(T2I, [REF], BASE)).toBe(2)
|
|
128
|
+
expect(pricedSentImages(T2I, [BASE, REF], BASE)).toBe(2)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
it("leaves every other model on its references alone", () => {
|
|
132
|
+
expect(pricedSentImages("seedream-5-flash", [REF], BASE)).toBe(1)
|
|
133
|
+
expect(pricedSentImages("minimax-h3", [REF], BASE)).toBe(1)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it("an estimate counts the node's images, the wired ones and an edit's own source", () => {
|
|
137
|
+
expect(pricedEstimatedImages(T2I, { referenceImageUrls: [REF] }, 2)).toBe(3)
|
|
138
|
+
expect(pricedEstimatedImages(I2I, {}, 0)).toBe(1)
|
|
139
|
+
})
|
|
140
|
+
})
|
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest"
|
|
2
|
-
import { MODEL_CATALOG, MODEL_MAKERS, isModelMakerId, modelMakerOf } from "../model-catalog.js"
|
|
2
|
+
import { MODEL_CATALOG, MODEL_MAKERS, isModelMakerId, modelMakerOf, type ModelCatalogEntry, type ModelCatalogEntryFields } from "../model-catalog.js"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Every catalog model names the company that made it (`maker`), served on
|
|
6
6
|
* `GET /v1/models` as `maker: { id, name }` and used to pick the maker's mark
|
|
7
|
-
* (`logoUrl`)
|
|
8
|
-
*
|
|
7
|
+
* (`logoUrl`) — unless it is marked `ownLabel: true` (offered under the
|
|
8
|
+
* deployment's own label, decided 2026-11-11), which names none and may carry
|
|
9
|
+
* none. `ModelCatalogEntry` requires exactly one of the two, so a new model
|
|
10
|
+
* without either does not compile; these cases also cover entries built at run
|
|
9
11
|
* time and keep the registry and the catalog in step.
|
|
10
12
|
*/
|
|
13
|
+
|
|
14
|
+
/** What is wrong with who each entry is offered under: no maker and no `ownLabel`, an unknown maker, or a maker on an own-label model. */
|
|
15
|
+
function offeredUnderProblems(entries: ReadonlyArray<{ id: string; maker?: unknown; ownLabel?: unknown }>): string[] {
|
|
16
|
+
return entries.flatMap((m) => {
|
|
17
|
+
if (m.ownLabel === true) return m.maker === undefined ? [] : [`${m.id}: marked ownLabel but names maker ${String(m.maker)}`]
|
|
18
|
+
if (m.ownLabel !== undefined) return [`${m.id}: ownLabel must be true or absent, not ${String(m.ownLabel)}`]
|
|
19
|
+
return isModelMakerId(m.maker) ? [] : [`${m.id}: names no maker from the registry (${String(m.maker)})`]
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
11
23
|
describe("model makers", () => {
|
|
12
|
-
it("every catalog model names a maker from the registry", () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
it("every catalog model names a maker from the registry, unless it is offered under the deployment's own label", () => {
|
|
25
|
+
expect(offeredUnderProblems(Object.values(MODEL_CATALOG))).toEqual([])
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it("the guard refuses a model with no maker that is not marked ownLabel", () => {
|
|
29
|
+
expect(offeredUnderProblems([{ id: "x" }])).toEqual(["x: names no maker from the registry (undefined)"])
|
|
30
|
+
expect(offeredUnderProblems([{ id: "x", maker: "acme" }])).toEqual(["x: names no maker from the registry (acme)"])
|
|
31
|
+
expect(offeredUnderProblems([{ id: "x", ownLabel: false }])).toEqual(["x: ownLabel must be true or absent, not false"])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it("the guard refuses a model marked ownLabel that names a maker", () => {
|
|
35
|
+
expect(offeredUnderProblems([{ id: "x", ownLabel: true, maker: "google" }])).toEqual(["x: marked ownLabel but names maker google"])
|
|
36
|
+
expect(offeredUnderProblems([{ id: "x", ownLabel: true }])).toEqual([])
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it("the type requires exactly one of maker and ownLabel", () => {
|
|
40
|
+
const fields = {} as ModelCatalogEntryFields
|
|
41
|
+
const withMaker: ModelCatalogEntry = { ...fields, maker: "google" }
|
|
42
|
+
const ownLabel: ModelCatalogEntry = { ...fields, ownLabel: true }
|
|
43
|
+
// @ts-expect-error — neither
|
|
44
|
+
const neither: ModelCatalogEntry = { ...fields }
|
|
45
|
+
// @ts-expect-error — both
|
|
46
|
+
const both: ModelCatalogEntry = { ...fields, ownLabel: true, maker: "google" }
|
|
47
|
+
expect([withMaker, ownLabel, neither, both]).toHaveLength(4)
|
|
17
48
|
})
|
|
18
49
|
|
|
19
50
|
// `series` is the product line ("Kling", "Flux") — required on every entry,
|
|
@@ -27,7 +58,7 @@ describe("model makers", () => {
|
|
|
27
58
|
})
|
|
28
59
|
|
|
29
60
|
it("every registered maker makes at least one catalog model", () => {
|
|
30
|
-
const used = new Set<string>(Object.values(MODEL_CATALOG).
|
|
61
|
+
const used = new Set<string>(Object.values(MODEL_CATALOG).flatMap((m) => (m.maker === undefined ? [] : [m.maker])))
|
|
31
62
|
expect(Object.keys(MODEL_MAKERS).filter((id) => !used.has(id))).toEqual([])
|
|
32
63
|
})
|
|
33
64
|
|
|
@@ -41,11 +72,12 @@ describe("model makers", () => {
|
|
|
41
72
|
it("all the models of one family come from one maker", () => {
|
|
42
73
|
// `family` is the vendor / lab grouping clients filter on; a family whose
|
|
43
74
|
// models name two makers is almost always a copied entry that kept the
|
|
44
|
-
// other company's maker.
|
|
75
|
+
// other company's maker. An own-label model counts as its own "maker", so
|
|
76
|
+
// a family is never half own-label.
|
|
45
77
|
const makersByFamily = new Map<string, Set<string>>()
|
|
46
78
|
for (const m of Object.values(MODEL_CATALOG)) {
|
|
47
79
|
const makers = makersByFamily.get(m.family) ?? new Set<string>()
|
|
48
|
-
makers.add(m.maker)
|
|
80
|
+
makers.add(m.maker ?? "(own label)")
|
|
49
81
|
makersByFamily.set(m.family, makers)
|
|
50
82
|
}
|
|
51
83
|
const split = [...makersByFamily]
|
|
@@ -69,6 +101,12 @@ describe("model makers", () => {
|
|
|
69
101
|
expect(modelMakerOf(MODEL_CATALOG["seedance-2"]!)).toEqual({ id: "bytedance", name: "ByteDance" })
|
|
70
102
|
})
|
|
71
103
|
|
|
104
|
+
it("modelMakerOf serves no maker for a model offered under the deployment's own label", () => {
|
|
105
|
+
expect(modelMakerOf({ ownLabel: true })).toBeUndefined()
|
|
106
|
+
// Even one built at run time (or by a JavaScript caller) that also names a maker.
|
|
107
|
+
expect(modelMakerOf({ ownLabel: true, maker: "google" } as unknown as Pick<ModelCatalogEntry, "maker" | "ownLabel">)).toBeUndefined()
|
|
108
|
+
})
|
|
109
|
+
|
|
72
110
|
it("modelMakerOf never throws: an entry built at run time without a known maker has none", () => {
|
|
73
111
|
expect(modelMakerOf({ maker: "acme" as never })).toBeUndefined()
|
|
74
112
|
expect(modelMakerOf({ maker: undefined as never })).toBeUndefined()
|