@nodaro/shared 3.57.0 → 3.59.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-3SH5ZUNJ.js → chunk-2S7YYCRT.js} +4 -4
- package/dist/{chunk-3SH5ZUNJ.js.map → chunk-2S7YYCRT.js.map} +1 -1
- package/dist/{chunk-IQS3WQXQ.js → chunk-2VQHPILW.js} +55 -24
- package/dist/chunk-2VQHPILW.js.map +1 -0
- package/dist/{chunk-D56ALOLY.js → chunk-3R2KVYXN.js} +3 -3
- package/dist/{chunk-D56ALOLY.js.map → chunk-3R2KVYXN.js.map} +1 -1
- package/dist/{chunk-OWNPYQSH.cjs → chunk-4GGLKRYI.cjs} +16 -3
- package/dist/chunk-4GGLKRYI.cjs.map +1 -0
- package/dist/{chunk-ALVO5Q36.cjs → chunk-62RC6K62.cjs} +4 -4
- package/dist/{chunk-ALVO5Q36.cjs.map → chunk-62RC6K62.cjs.map} +1 -1
- package/dist/chunk-6VXDW2U3.cjs +27 -0
- package/dist/{chunk-RKTWLAJO.cjs.map → chunk-6VXDW2U3.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-NJTLBZIP.cjs → chunk-D574HZ35.cjs} +43 -43
- package/dist/{chunk-NJTLBZIP.cjs.map → chunk-D574HZ35.cjs.map} +1 -1
- package/dist/{chunk-P5KH7GAI.cjs → chunk-DKZGLIFW.cjs} +4 -4
- package/dist/{chunk-P5KH7GAI.cjs.map → chunk-DKZGLIFW.cjs.map} +1 -1
- package/dist/{chunk-6NZWWMVY.js → chunk-EO4W4MA3.js} +4 -4
- package/dist/{chunk-6NZWWMVY.js.map → chunk-EO4W4MA3.js.map} +1 -1
- package/dist/{chunk-INGQNLY4.js → chunk-FHCMYGBV.js} +3 -3
- package/dist/{chunk-INGQNLY4.js.map → chunk-FHCMYGBV.js.map} +1 -1
- package/dist/{chunk-QTTVIQJP.js → chunk-FJCRWDU5.js} +4 -4
- package/dist/{chunk-QTTVIQJP.js.map → chunk-FJCRWDU5.js.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-ZPPFPQPO.js → chunk-IP7QOHWQ.js} +5 -5
- package/dist/{chunk-ZPPFPQPO.js.map → chunk-IP7QOHWQ.js.map} +1 -1
- package/dist/{chunk-2LWHRJPB.cjs → chunk-K4L4G76I.cjs} +21 -21
- package/dist/{chunk-2LWHRJPB.cjs.map → chunk-K4L4G76I.cjs.map} +1 -1
- package/dist/{chunk-C3E6UZS4.js → chunk-MTXVODG3.js} +3 -3
- package/dist/{chunk-C3E6UZS4.js.map → chunk-MTXVODG3.js.map} +1 -1
- package/dist/{chunk-5SXI7IYW.cjs → chunk-NHZWVKGV.cjs} +8 -8
- package/dist/{chunk-5SXI7IYW.cjs.map → chunk-NHZWVKGV.cjs.map} +1 -1
- package/dist/{chunk-D5J332XS.cjs → chunk-NSZTHJZJ.cjs} +39 -39
- package/dist/{chunk-D5J332XS.cjs.map → chunk-NSZTHJZJ.cjs.map} +1 -1
- package/dist/{chunk-BH2IDJVO.cjs → chunk-OFL4UH6L.cjs} +46 -46
- package/dist/{chunk-BH2IDJVO.cjs.map → chunk-OFL4UH6L.cjs.map} +1 -1
- package/dist/{chunk-UFB36LWU.js → chunk-ORJ5HQAB.js} +4 -4
- package/dist/{chunk-UFB36LWU.js.map → chunk-ORJ5HQAB.js.map} +1 -1
- package/dist/{chunk-ASSJKIZO.cjs → chunk-P7KSB5T6.cjs} +5 -5
- package/dist/{chunk-ASSJKIZO.cjs.map → chunk-P7KSB5T6.cjs.map} +1 -1
- package/dist/{chunk-R3OIZ2BM.cjs → chunk-PEATSEAD.cjs} +6 -6
- package/dist/{chunk-R3OIZ2BM.cjs.map → chunk-PEATSEAD.cjs.map} +1 -1
- package/dist/{chunk-QMP3W5GA.js → chunk-PIEMWFSJ.js} +3 -3
- package/dist/{chunk-QMP3W5GA.js.map → chunk-PIEMWFSJ.js.map} +1 -1
- package/dist/{chunk-MBKJ7IBS.js → chunk-PIX4OCCQ.js} +5 -5
- package/dist/{chunk-MBKJ7IBS.js.map → chunk-PIX4OCCQ.js.map} +1 -1
- package/dist/{chunk-O33WVAYQ.cjs → chunk-QE7W4YIK.cjs} +6 -6
- package/dist/{chunk-O33WVAYQ.cjs.map → chunk-QE7W4YIK.cjs.map} +1 -1
- package/dist/{chunk-FFW2HTR2.cjs → chunk-QLLR7GUY.cjs} +5 -5
- package/dist/{chunk-FFW2HTR2.cjs.map → chunk-QLLR7GUY.cjs.map} +1 -1
- package/dist/{chunk-2LRBQOKA.js → chunk-RGBNOCIO.js} +8 -8
- package/dist/{chunk-2LRBQOKA.js.map → chunk-RGBNOCIO.js.map} +1 -1
- package/dist/{chunk-OHQBQOGH.cjs → chunk-RSXQOFM7.cjs} +8 -8
- package/dist/{chunk-OHQBQOGH.cjs.map → chunk-RSXQOFM7.cjs.map} +1 -1
- package/dist/{chunk-SWPTF7QJ.js → chunk-TA7ODVYJ.js} +4 -4
- package/dist/{chunk-SWPTF7QJ.js.map → chunk-TA7ODVYJ.js.map} +1 -1
- package/dist/{chunk-ZSTL4JEJ.cjs → chunk-UPD7W2KJ.cjs} +12 -12
- package/dist/{chunk-ZSTL4JEJ.cjs.map → chunk-UPD7W2KJ.cjs.map} +1 -1
- package/dist/{chunk-JYNW4QK7.cjs → chunk-V3NONYLA.cjs} +56 -23
- package/dist/chunk-V3NONYLA.cjs.map +1 -0
- package/dist/{chunk-4KKFO6YR.cjs → chunk-VLQW4CVW.cjs} +25 -21
- package/dist/chunk-VLQW4CVW.cjs.map +1 -0
- package/dist/{chunk-EXCZD5ZY.js → chunk-VOZI5F7V.js} +3 -3
- package/dist/{chunk-EXCZD5ZY.js.map → chunk-VOZI5F7V.js.map} +1 -1
- package/dist/{chunk-ZLSPGMES.cjs → chunk-YE4EDT57.cjs} +11 -11
- package/dist/{chunk-ZLSPGMES.cjs.map → chunk-YE4EDT57.cjs.map} +1 -1
- package/dist/{chunk-BBMK5XNO.js → chunk-YSEJOJNQ.js} +3 -3
- package/dist/{chunk-BBMK5XNO.js.map → chunk-YSEJOJNQ.js.map} +1 -1
- package/dist/{chunk-R5GOPHYB.js → chunk-ZU56AMFK.js} +6 -4
- package/dist/chunk-ZU56AMFK.js.map +1 -0
- package/dist/{chunk-KZTXGMVH.js → chunk-ZVUVSD5X.js} +3 -3
- package/dist/{chunk-KZTXGMVH.js.map → chunk-ZVUVSD5X.js.map} +1 -1
- package/dist/entries/apps.cjs +42 -42
- package/dist/entries/apps.js +7 -7
- package/dist/entries/credits.cjs +150 -150
- package/dist/entries/credits.d.cts +1 -1
- package/dist/entries/credits.d.ts +1 -1
- package/dist/entries/credits.js +7 -7
- 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 +76 -68
- package/dist/entries/model-catalog.d.cts +2 -2
- package/dist/entries/model-catalog.d.ts +2 -2
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +295 -287
- 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 +206 -206
- package/dist/entries/nodes.d.cts +1 -1
- package/dist/entries/nodes.d.ts +1 -1
- package/dist/entries/nodes.js +8 -8
- 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/index.cjs +1180 -1156
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -19
- package/dist/{model-catalog-CwkG9xi-.d.cts → model-catalog-QJ_AO9l0.d.cts} +54 -12
- package/dist/{model-catalog-CwkG9xi-.d.ts → model-catalog-QJ_AO9l0.d.ts} +54 -12
- package/dist/{model-constants-BbsZSVTA.d.cts → model-constants-BwBdh6Rn.d.cts} +20 -2
- package/dist/{model-constants-BbsZSVTA.d.ts → model-constants-BwBdh6Rn.d.ts} +20 -2
- package/package.json +1 -1
- package/src/__tests__/auto-aspect-source.test.ts +93 -0
- 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-size-rules.test.ts +80 -0
- package/src/__tests__/normalize-model-input.test.ts +65 -11
- package/src/__tests__/resolutions-by-aspect-ratio.test.ts +134 -0
- package/src/__tests__/runtime-config.test.ts +28 -0
- package/src/__tests__/video-frame-slot.test.ts +5 -0
- package/src/camera-switch-contract.ts +13 -1
- package/src/entries/model-catalog.ts +2 -0
- package/src/entries/models.ts +2 -0
- package/src/entries/runtime-config.ts +1 -0
- package/src/model-catalog.ts +131 -39
- package/src/model-constants.ts +21 -1
- package/src/runtime-config/contract.ts +34 -0
- package/dist/chunk-4KKFO6YR.cjs.map +0 -1
- package/dist/chunk-FVKCNAEQ.js.map +0 -1
- package/dist/chunk-IQS3WQXQ.js.map +0 -1
- package/dist/chunk-JYNW4QK7.cjs.map +0 -1
- package/dist/chunk-OWNPYQSH.cjs.map +0 -1
- package/dist/chunk-R5GOPHYB.js.map +0 -1
- package/dist/chunk-RKTWLAJO.cjs +0 -27
- package/dist/chunk-S7FCFQ6X.js.map +0 -1
- package/dist/chunk-UJJUX6NW.cjs.map +0 -1
|
@@ -151,6 +151,18 @@ declare const PROMPT_HARD_CEILING = 30000;
|
|
|
151
151
|
* route's maxTokens.
|
|
152
152
|
*/
|
|
153
153
|
declare const LLM_TEXT_INPUT_MAX = 100000;
|
|
154
|
+
/**
|
|
155
|
+
* Ceiling for the `system` prompt of the structured-output routes
|
|
156
|
+
* (`POST /v1/llm/structured` and `POST /v1/llm/structured/jobs`). A client
|
|
157
|
+
* that has the model write in its own vocabulary sends that vocabulary as the
|
|
158
|
+
* system prompt, and it grows with the client's catalogs (Nodaro Studio's
|
|
159
|
+
* production format is close to 100,000 chars), so this is twice
|
|
160
|
+
* {@link LLM_TEXT_INPUT_MAX}. The routes' `input`, and every other LLM text
|
|
161
|
+
* field, stay at LLM_TEXT_INPUT_MAX. 200,000 chars is roughly 50,000 to
|
|
162
|
+
* 100,000 tokens, and a body at both ceilings still fits the API's 1 MB
|
|
163
|
+
* request limit.
|
|
164
|
+
*/
|
|
165
|
+
declare const LLM_STRUCTURED_SYSTEM_MAX = 200000;
|
|
154
166
|
/**
|
|
155
167
|
* Per-provider maximum VIDEO prompt length (chars), VERIFIED against each model's
|
|
156
168
|
* official docs.kie.ai schema (2026-06). Absent → {@link VIDEO_PROMPT_MAX} (8000)
|
|
@@ -462,7 +474,7 @@ declare function resolveVideoModeForInputs(provider: string | undefined, inputs:
|
|
|
462
474
|
readonly hasImageRefs: boolean;
|
|
463
475
|
}): "image-to-video" | "text-to-video";
|
|
464
476
|
/** The prompt syntax a video provider addresses its images in, by array order. */
|
|
465
|
-
type VideoReferenceSyntax = "@image_N" | "@image(n)" | "[Image N]";
|
|
477
|
+
type VideoReferenceSyntax = "@image_N" | "@image(n)" | "[Image N]" | "image N";
|
|
466
478
|
/**
|
|
467
479
|
* The syntax this video model's frame / identity binding sentences are written
|
|
468
480
|
* in — the catalog's `referenceSyntax`, else the platform's `@image_N`. One
|
|
@@ -539,6 +551,12 @@ declare function isSeedanceVideoEditProvider(provider: string | undefined): prov
|
|
|
539
551
|
* plus the Seedance edit models dispatched through the text-to-video lane. */
|
|
540
552
|
declare const VIDEO_TO_VIDEO_NODE_PROVIDERS: readonly ["wan", "wan-flash", "wan-videoedit", "luma-modify", "runway-aleph", "happyhorse-edit", "seedance-2-5"];
|
|
541
553
|
type VideoToVideoNodeProvider = typeof VIDEO_TO_VIDEO_NODE_PROVIDERS[number];
|
|
554
|
+
/**
|
|
555
|
+
* The model a Video to Video request or node that names none runs on: the
|
|
556
|
+
* route's and the worker's default, and what the node's model menu shows for an
|
|
557
|
+
* unset model. One constant, so the server and the editor cannot disagree.
|
|
558
|
+
*/
|
|
559
|
+
declare const DEFAULT_VIDEO_TO_VIDEO_PROVIDER: VideoToVideoNodeProvider;
|
|
542
560
|
/**
|
|
543
561
|
* The request shape Seedance edit mode requires, sent UP FRONT by the Video to
|
|
544
562
|
* Video node: the output takes the source clip's own ratio and length
|
|
@@ -1717,4 +1735,4 @@ declare function applyDefaultVideoSelection<D>(input: {
|
|
|
1717
1735
|
duration: D | number | undefined;
|
|
1718
1736
|
};
|
|
1719
1737
|
|
|
1720
|
-
export {
|
|
1738
|
+
export { IMAGE_I2I_PROVIDERS as $, AI_WRITER_PROVIDERS as A, FRAME_MODE_ADAPTIVE_ONLY_ASPECT as B, CHARACTER_MOTION_PROVIDERS as C, DEFAULT_DIALOGUE_PROVIDER as D, EXTEND_VIDEO_PROVIDERS as E, FACE_SWAP_PROVIDERS as F, type FaceSwapProvider as G, GEMINI_OMNI_12_MAX_SOURCE_SEC as H, GEMINI_OMNI_PER_SECOND_PROVIDERS as I, GEMINI_OMNI_PROVIDERS as J, GUIDANCE_SCALE_SUPPORT as K, GVP_ANCHOR_CHOICES as L, GVP_DEFAULT_PROVIDER as M, GVP_END_FRAME_PROVIDERS as N, GVP_EXTEND_PROVIDERS as O, GVP_SUPPORTED_PROVIDERS as P, type GvpAnchorChoice as Q, type GvpAnchorWireMode as R, HIGH_QUALITY_PROVIDERS as S, I2I_MASK_SUPPORT as T, I2I_STRENGTH_SUPPORT as U, IDEOGRAM_PROVIDERS as V, IMAGE_ASPECT_RATIO_VALUES as W, IMAGE_BACKGROUND_VALUES as X, IMAGE_EDIT_PROVIDERS as Y, IMAGE_EDIT_TARGET_RESOLUTION_VALUES as Z, IMAGE_GEN_PROVIDERS as _, ASPECT_RATIO_DIMENSIONS as a, SEEDANCE_2_5_REF_LIMITS as a$, IMAGE_MASK_MODE as a0, IMAGE_PROMPT_MAX as a1, IMAGE_QUALITY_VALUES as a2, IMAGE_RENDERING_SPEED_VALUES as a3, IMAGE_RESOLUTION_VALUES as a4, IMAGE_TO_VIDEO_PROVIDERS as a5, type ImageAspectRatio as a6, type ImageBackground as a7, type ImageEditProvider as a8, type ImageEditTargetResolution as a9, MUSIC_CREDIT_ID as aA, MUSIC_PROVIDERS as aB, MUSIC_PROVIDER_LABELS as aC, type ModelPromptingStyle as aD, type ModifyImageProvider as aE, type MotionTransferProviderType as aF, type MusicProvider as aG, NATIVE_ADAPTIVE_ASPECT as aH, NATIVE_NEGATIVE_PROMPT_MODELS as aI, NATIVE_NEGATIVE_VIDEO_PROVIDERS as aJ, NEGATIVE_PROMPT_MAX as aK, OBJECT_MOTION_PROVIDERS as aL, type ObjectMotionProvider as aM, PRICING_DEFAULT_DURATION_SEC as aN, PRICING_DEFAULT_RESOLUTION as aO, PROMPT_HARD_CEILING as aP, QA_CHECK_PROVIDERS as aQ, type QaCheckProvider as aR, REF_IMAGE_MAX_LIMITS as aS, RENDERING_SPEED_SUPPORT as aT, REPLICATE_LIP_SYNC_PROVIDERS as aU, RETIRED_VIDEO_PROVIDERS as aV, type RefAudioCheck as aW, type RefAudioProbe as aX, type RefAudioRule as aY, type RefVideoDurationLimit as aZ, SCRIPT_PROVIDERS as a_, type ImageGenProvider as aa, type ImageI2IProvider as ab, type ImageMaskMode as ac, type ImageQuality as ad, type ImageRenderingSpeed as ae, type ImageResolution as af, type ImageToVideoProvider as ag, KLING_4_DEFAULT_RESOLUTION as ah, KLING_4_MAX_MIDDLE_FRAMES as ai, KLING_4_PROVIDERS as aj, LIP_SYNC_PROVIDERS as ak, LLM_STRUCTURED_SYSTEM_MAX as al, LLM_TEXT_INPUT_MAX as am, LOCATION_ATMOSPHERE_PROVIDERS as an, type LipSyncProvider as ao, type LocationAtmosphereProvider as ap, MAX_IMAGE_PROMPT_CHARS_BY_PROVIDER as aq, MAX_NEGATIVE_PROMPT_CHARS_BY_PROVIDER as ar, MAX_REQUEST_IMAGE_LIMIT as as, MAX_TTS_CHARS_BY_PROVIDER as at, MAX_VIDEO_PROMPT_CHARS_BY_PROVIDER as au, MINIMAX_H3_DEFAULT_RESOLUTION as av, MINIMAX_H3_PROVIDERS as aw, MODELS_WITH_REFERENCE_IMAGE_SUPPORT as ax, MODIFY_IMAGE_PROVIDERS as ay, MOTION_TRANSFER_PROVIDERS as az, AUDIO_ADDON_PROVIDERS as b, VIDEO_TO_VIDEO_NODE_PROVIDERS as b$, SEEDANCE_2_CONTINUATION_REF_SEC as b0, SEEDANCE_2_EXTEND_STITCH as b1, SEEDANCE_2_PROVIDERS as b2, SEEDANCE_2_R2V_MAX_AUDIO_SEC_BY_PROVIDER as b3, SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC as b4, SEEDANCE_2_REF_LIMITS as b5, SEEDANCE_LIP_SYNC_PROVIDERS as b6, SEEDANCE_VIDEO_EDIT_PROVIDERS as b7, SEEDANCE_VIDEO_EDIT_SHAPE as b8, SEED_SUPPORT as b9, TWO_K_RESOLUTION_PROVIDERS as bA, type TaskChainedEditProvider as bB, type TextToAudioProvider as bC, type TextToVideoProvider as bD, type TranscribeLane as bE, type TranscribeProvider as bF, type TtsOutputFormat as bG, type TtsProvider as bH, UPSCALE_IMAGE_PROVIDERS as bI, type UpscaleImageProvider as bJ, VARIABLE_PRICING_MODELS as bK, VEO_PROVIDERS as bL, VIDEO_AUDIO_CAPABILITY as bM, VIDEO_DURATION_TIERS as bN, VIDEO_GEN_COLLAPSED_T2V_IDS as bO, VIDEO_GEN_PROVIDERS as bP, VIDEO_INPUT_LIP_SYNC_PROVIDERS as bQ, VIDEO_MODEL_CAPS as bR, VIDEO_MODE_ALIASES as bS, VIDEO_PROMPT_MAX as bT, VIDEO_PROVIDERS_REQUIRING_IMAGE as bU, VIDEO_PROVIDERS_WITHOUT_DISPATCH as bV, VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL as bW, VIDEO_REF_AUDIO_RULES as bX, VIDEO_REF_LIMITS_BY_PROVIDER as bY, VIDEO_REF_RATE_PROVIDERS as bZ, VIDEO_REF_VIDEO_DURATION_LIMITS as b_, SUNO_ACTIVE_MODELS as ba, SUNO_ADD_TRACK_MODELS as bb, SUNO_DURATION_MODELS as bc, SUNO_HARD_CEILING as bd, SUNO_LEGACY_MODELS as be, SUNO_MODELS as bf, SUNO_TEXT_MAX as bg, SUNO_TITLE_MAX as bh, type SceneInputMode as bi, SceneInputModeSchema as bj, type ScriptProvider as bk, type SeedanceVideoEditProvider as bl, type SunoAddTrackModel as bm, type SunoModel as bn, T2I_TO_I2I_VARIANT as bo, TASK_CHAINED_EDIT_PROVIDERS as bp, TASK_CHAINED_EDIT_PROVIDER_IDS as bq, TEXT_TO_AUDIO_PROVIDERS as br, TEXT_TO_VIDEO_PROVIDERS as bs, TRANSCRIBE_LANES as bt, TRANSCRIBE_PROVIDERS as bu, TRANSCRIBE_PROVIDER_CAPABILITIES as bv, TTS_OUTPUT_FORMATS as bw, TTS_OUTPUT_FORMAT_FILES as bx, TTS_PROVIDERS as by, TTS_TEXT_MAX as bz, type AiWriterProvider as c, resolveVideoProviderForMode as c$, VIDEO_TO_VIDEO_PROVIDERS as c0, VIDEO_UPSCALE_PROVIDERS as c1, VIDEO_VARIABLE_PRICING as c2, VIDU_Q4_DEFAULT_RESOLUTION as c3, VIDU_Q4_PROVIDERS as c4, VOICE_DESIGN_MODELS as c5, type VideoAudioCapability as c6, type VideoAudioMode as c7, type VideoGenProvider as c8, type VideoModeAlias as c9, isGeminiOmniPerSecondProvider as cA, isGeminiOmniProvider as cB, isGvpSupportedProvider as cC, isKling4Provider as cD, isLegacySunoModel as cE, isMinimaxH3Provider as cF, isSeedance2Provider as cG, isSeedanceVideoEditProvider as cH, isVeoProvider as cI, isViduQ4Provider as cJ, isWan3Provider as cK, kling4KeyframeFrameCap as cL, maxSegmentSecFor as cM, maxSegmentsFor as cN, maxVideoDurationSec as cO, minSegmentSecFor as cP, modelsForInputMode as cQ, normalizeKling4Resolution as cR, normalizeMinimaxH3Resolution as cS, normalizeViduQ4Resolution as cT, normalizeWan3Resolution as cU, preferredInputModeForModel as cV, pricedOutputDurationSec as cW, requestImageLimit as cX, resolveGvpAnchorWire as cY, resolveMusicProvider as cZ, resolveVideoModeForInputs as c_, type VideoModelCapabilities as ca, type VideoReferenceSyntax as cb, type VideoToVideoNodeProvider as cc, type VideoToVideoProvider as cd, type VideoUpscaleProvider as ce, type VoiceDesignModel as cf, WAN_3_DEFAULT_RESOLUTION as cg, WAN_3_PROVIDERS as ch, applyDefaultVideoSelection as ci, applyVideoAudioToggle as cj, applyVideoNegativePrompt as ck, billsReferenceVideoSeconds as cl, canonicalVideoProvider as cm, checkRefAudioRules as cn, checkRefVideoDurations as co, defaultVideoAspectRatio as cp, findSeedance2AudioOverLimit as cq, getMaxImagePromptChars as cr, getMaxNegativePromptChars as cs, getMaxSunoPromptChars as ct, getMaxSunoStyleChars as cu, getMaxTtsChars as cv, getMaxVideoPromptChars as cw, getVideoAudioCapability as cx, hasContiguousSegmentDurations as cy, imageReferenceLimit as cz, COMPOSER_PLAN_FIELDS as d, seedance2AudioLimitSec as d0, segmentDurationsFor as d1, snapToNearestDuration as d2, sunoModelHonoursDuration as d3, supportsAutoVideoDuration as d4, supportsEndAnchor as d5, supportsExtendRender as d6, transcribeLaneSupportsWordTimestamps as d7, transcribeProvidersWithWordTimestamps as d8, videoDefaultDurationSec as d9, videoModelCanSpeakDialogue as da, videoModelSupportsAudio as db, videoNegativeSuffix as dc, videoProviderAppendsFrames as dd, videoProviderFoldsLoneEndFrame as de, videoProviderRefModeFrameSeats as df, videoProviderReferenceSyntax as dg, videoProviderRequiresImage as dh, videoProviderRunsFromReferences as di, videoSourceTrimMaxSec as dj, COMPOSER_PLAN_MAP as e, CREDIT_BASE_USD as f, type CharacterMotionProvider as g, DEFAULT_MUSIC_PROVIDER as h, DEFAULT_REF_IMAGE_MAX as i, DEFAULT_REQUEST_IMAGE_LIMIT as j, DEFAULT_SUNO_MODEL as k, DEFAULT_TEXT_TO_AUDIO_PROVIDER as l, DEFAULT_TRANSCRIBE_NODE_PROVIDER as m, DEFAULT_TRANSCRIBE_PROVIDER as n, DEFAULT_TTS_OUTPUT_FORMAT as o, DEFAULT_TTS_PROVIDER as p, DEFAULT_VIDEO_DURATION_SEC as q, DEFAULT_VIDEO_PROVIDER as r, DEFAULT_VIDEO_TO_VIDEO_PROVIDER as s, DEFAULT_VOICE_DESIGN_MODEL as t, DIALOGUE_PROVIDERS as u, DURATION_PRICED_PROVIDERS as v, type DialogueProvider as w, type ExtendVideoProvider as x, FAL_LIP_SYNC_PROVIDERS as y, FLEXIBLE_INPUT_LIP_SYNC_PROVIDERS as z };
|
package/package.json
CHANGED
|
@@ -111,6 +111,99 @@ describe("autoAspectNeedsSourceImage", () => {
|
|
|
111
111
|
})
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* GPT Image 2.6's own "auto" renders a portrait photo square (a 768x1024
|
|
116
|
+
* source came back 1024x1024; GPT Image 2.5's auto kept it at 3:4). So every
|
|
117
|
+
* 2.6 entry keeps "auto" on offer but has it resolved from the photo, exactly
|
|
118
|
+
* as on a model without a native auto, while 2.5 keeps its native auto.
|
|
119
|
+
*/
|
|
120
|
+
describe("GPT Image 2.6 — 'auto' is resolved from the photo, never sent as the model's own", () => {
|
|
121
|
+
const GPT_IMAGE_2_6 = [
|
|
122
|
+
"gpt-image-2-6-flare", "gpt-image-2-6-flare-i2i",
|
|
123
|
+
"gpt-image-2-6-sunburst", "gpt-image-2-6-sunburst-i2i",
|
|
124
|
+
"gpt-image-2-6-economy", "gpt-image-2-6-economy-i2i",
|
|
125
|
+
]
|
|
126
|
+
const portrait = { width: 768, height: 1024 }
|
|
127
|
+
|
|
128
|
+
it("keeps 'auto' on offer in every 2.6 ratio list, so the menus are unchanged", () => {
|
|
129
|
+
for (const id of GPT_IMAGE_2_6) {
|
|
130
|
+
expect(MODEL_CATALOG[id]!.aspectRatios, id).toContain("auto")
|
|
131
|
+
expect(MODEL_CATALOG[id]!.autoAspectFromSourceImage, id).toBe(true)
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it("asks for the photo's size on every 2.6 id, and not on 2.5 or GPT Image 2", () => {
|
|
136
|
+
for (const id of GPT_IMAGE_2_6) expect(autoAspectNeedsSourceImage(id, "auto"), id).toBe(true)
|
|
137
|
+
for (const id of GPT_IMAGE_2_6) expect(autoAspectNeedsSourceImage(id, "3:4"), id).toBe(false)
|
|
138
|
+
for (const id of ["gpt-image-2-5-flare-i2i", "gpt-image-2-5-sunburst-i2i", "gpt-image-2-5-flare", "gpt-image-2-i2i"]) {
|
|
139
|
+
expect(autoAspectNeedsSourceImage(id, "auto"), id).toBe(false)
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it.each(["gpt-image-2-6-flare-i2i", "gpt-image-2-6-sunburst-i2i"])("%s: a 3:4 photo is sent 3:4, and says why", (id) => {
|
|
144
|
+
const out = normalizeModelInput(id, { aspectRatio: "auto" }, { sourceImage: portrait })
|
|
145
|
+
expect(out.aspectRatio).toBe("3:4")
|
|
146
|
+
expect(out.adjustments).toHaveLength(1)
|
|
147
|
+
expect(out.adjustments[0]).toMatchObject({ field: "aspectRatio", from: "auto", to: "3:4" })
|
|
148
|
+
expect(out.adjustments[0].reason).toContain(`own "auto" does not keep the photo's shape`)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
it("Economy picks from its own shorter list", () => {
|
|
152
|
+
// 3:4 is not on Economy's list; 2:3 is the nearest that is.
|
|
153
|
+
expect(normalizeModelInput("gpt-image-2-6-economy-i2i", { aspectRatio: "auto" }, { sourceImage: portrait }).aspectRatio).toBe("2:3")
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it("never picks a ratio 2.6 refuses (2.5's 27:16, 16:27, 9:8, 8:9)", () => {
|
|
157
|
+
const refused = new Set(["27:16", "16:27", "9:8", "8:9"])
|
|
158
|
+
for (const id of GPT_IMAGE_2_6) {
|
|
159
|
+
for (const sourceImage of [{ width: 2700, height: 1600 }, { width: 1600, height: 2700 }, { width: 1125, height: 1000 }, { width: 1000, height: 1125 }]) {
|
|
160
|
+
const out = normalizeModelInput(id, { aspectRatio: "auto" }, { sourceImage })
|
|
161
|
+
expect(refused.has(out.aspectRatio!), `${id} ${sourceImage.width}x${sourceImage.height} → ${out.aspectRatio}`).toBe(false)
|
|
162
|
+
expect(MODEL_CATALOG[id]!.aspectRatios).toContain(out.aspectRatio)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it("with no photo, or one that cannot be read, still sends the model's own 'auto', as before", () => {
|
|
168
|
+
for (const id of GPT_IMAGE_2_6) {
|
|
169
|
+
expect(normalizeModelInput(id, { aspectRatio: "auto" }).aspectRatio, id).toBe("auto")
|
|
170
|
+
expect(normalizeModelInput(id, { aspectRatio: "auto" }, { sourceImage: { width: 0, height: 0 } }).aspectRatio, id).toBe("auto")
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it("Generate Image with a reference on a 2.6 model resolves 'auto' from the photo; with none it sends 'auto'", () => {
|
|
175
|
+
const withRef = resolveNormalizedImageGen({ provider: "gpt-image-2-6-flare", aspectRatio: "auto", refCount: 1, swapToI2i: true, sourceImage: portrait })
|
|
176
|
+
expect(withRef.modelId).toBe("gpt-image-2-6-flare-i2i")
|
|
177
|
+
expect(withRef.aspectRatio).toBe("3:4")
|
|
178
|
+
expect(imageGenAutoAspectNeedsSourceImage({ provider: "gpt-image-2-6-flare", aspectRatio: "auto", refCount: 1 })).toBe(true)
|
|
179
|
+
const noRef = resolveNormalizedImageGen({ provider: "gpt-image-2-6-flare", aspectRatio: "auto", refCount: 0, swapToI2i: true })
|
|
180
|
+
expect(noRef.aspectRatio).toBe("auto")
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
it("2.5 keeps its native 'auto' even when the photo's size is known", () => {
|
|
184
|
+
const out = normalizeModelInput("gpt-image-2-5-flare-i2i", { aspectRatio: "auto" }, { sourceImage: portrait })
|
|
185
|
+
expect(out.aspectRatio).toBe("auto")
|
|
186
|
+
expect(out.adjustments).toEqual([])
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
it("the measured ratio never moves the price id", () => {
|
|
190
|
+
for (const provider of ["gpt-image-2-6-flare-i2i", "gpt-image-2-6-sunburst-i2i", "gpt-image-2-6-economy-i2i"]) {
|
|
191
|
+
for (const quality of [undefined, "low", "medium", "high", "xhigh", "max", "auto"]) {
|
|
192
|
+
for (const resolution of [undefined, "1K", "2K", "4K"]) {
|
|
193
|
+
for (const refCount of [1, 5, 16]) {
|
|
194
|
+
const base = { provider, quality, resolution, refCount, swapToI2i: false }
|
|
195
|
+
const unset = resolveNormalizedImageGen({ ...base }).identifier
|
|
196
|
+
const auto = resolveNormalizedImageGen({ ...base, aspectRatio: "auto" }).identifier
|
|
197
|
+
const measured = resolveNormalizedImageGen({ ...base, aspectRatio: "auto", sourceImage: portrait })
|
|
198
|
+
expect(measured.identifier).toBe(auto)
|
|
199
|
+
expect(auto).toBe(unset)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
|
|
114
207
|
describe("normalizeModelInput — 'auto' with a source image", () => {
|
|
115
208
|
const portrait = { width: 1104, height: 1472 }
|
|
116
209
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest"
|
|
2
2
|
import {
|
|
3
|
-
CAMERA_SWITCH_BOUNDS, CAMERA_SWITCH_DEFAULTS, CAMERA_SWITCH_NAME_MAX, cameraSwitchCameras, cameraSwitchEdlProblem,
|
|
3
|
+
CAMERA_SWITCH_BOUNDS, CAMERA_SWITCH_DEFAULTS, CAMERA_SWITCH_NAME_MAX, CAMERA_SWITCH_NODE_SETTINGS, cameraSwitchCameras, cameraSwitchEdlProblem,
|
|
4
4
|
cameraSwitchSettingsPayload, cameraSwitchSpeakerMap, clampCameraSwitchSetting, cleanSpeakerNames, defaultSpeakerMap, transcriptSpeakerLabels,
|
|
5
5
|
} from "../camera-switch-contract.js"
|
|
6
6
|
|
|
@@ -51,7 +51,7 @@ describe("defaultSpeakerMap — the table pre-filled by order (decided 2026-10-0
|
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
it("the defaults are the decided ones", () => {
|
|
54
|
-
expect(CAMERA_SWITCH_DEFAULTS).toEqual({ minShotMs: 2_500, leadMs: 200, maxShotMs: 20_000, wideEvery: 0, layoutHints: false })
|
|
54
|
+
expect(CAMERA_SWITCH_DEFAULTS).toEqual({ minShotMs: 2_500, leadMs: 200, lagMs: 0, maxShotMs: 20_000, wideEvery: 0, layoutHints: false })
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
// The Cloud route answers 400 outside these ranges — every caller clamps first
|
|
@@ -59,10 +59,19 @@ it("the defaults are the decided ones", () => {
|
|
|
59
59
|
describe("settings bounds", () => {
|
|
60
60
|
it("are the route's ranges", () => {
|
|
61
61
|
expect(CAMERA_SWITCH_BOUNDS).toEqual({
|
|
62
|
-
minShotMs: { min: 500, max: 60_000 }, leadMs: { min: 0, max: 5_000 }, maxShotMs: { min: 0, max: 600_000 }, wideEvery: { min: 0, max: 20 },
|
|
62
|
+
minShotMs: { min: 500, max: 60_000 }, leadMs: { min: 0, max: 5_000 }, lagMs: { min: 0, max: 5_000 }, maxShotMs: { min: 0, max: 600_000 }, wideEvery: { min: 0, max: 20 },
|
|
63
63
|
})
|
|
64
64
|
expect(CAMERA_SWITCH_NAME_MAX).toBe(80)
|
|
65
65
|
})
|
|
66
|
+
it("lagMs is a route setting only: a node's data never sends it (the node settings are the other four)", () => {
|
|
67
|
+
expect(CAMERA_SWITCH_NODE_SETTINGS).toEqual(["minShotMs", "leadMs", "maxShotMs", "wideEvery"])
|
|
68
|
+
expect(Object.keys(CAMERA_SWITCH_BOUNDS).filter((k) => !(CAMERA_SWITCH_NODE_SETTINGS as readonly string[]).includes(k))).toEqual(["lagMs"])
|
|
69
|
+
const edl = { version: 1, clock: "master", sources: [{ id: "a", url: "https://x/a.mp4", kind: "video" }], segments: [{ inMs: 0, outMs: 1000, video: "a" }] }
|
|
70
|
+
const transcript = { version: 1, words: [{ text: "hi", startMs: 0, endMs: 400, speaker: "s0" }] }
|
|
71
|
+
const sent = cameraSwitchSettingsPayload({ leadMs: 300, lagMs: 400 } as Parameters<typeof cameraSwitchSettingsPayload>[0], edl, transcript)
|
|
72
|
+
expect(sent).toMatchObject({ leadMs: 300 })
|
|
73
|
+
expect(sent).not.toHaveProperty("lagMs")
|
|
74
|
+
})
|
|
66
75
|
it("clamp into range as whole numbers; unset stays unset", () => {
|
|
67
76
|
expect(clampCameraSwitchSetting("minShotMs", 0)).toBe(500)
|
|
68
77
|
expect(clampCameraSwitchSetting("minShotMs", 2_499.6)).toBe(2_500)
|
|
@@ -941,24 +941,33 @@ describe("resolveNormalizedImageGen", () => {
|
|
|
941
941
|
refCount: 0,
|
|
942
942
|
swapToI2i: true,
|
|
943
943
|
})
|
|
944
|
-
// 3:2 is not in GPT_IMAGE_2_RATIOS -> allowed[0] ("auto"), which
|
|
945
|
-
//
|
|
944
|
+
// 3:2 is not in GPT_IMAGE_2_RATIOS -> allowed[0] ("auto"), which renders
|
|
945
|
+
// 4K too: the size, and so the price, stay as asked.
|
|
946
946
|
expect(out.aspectRatio).toBe("auto")
|
|
947
|
-
expect(out.resolution).toBe("
|
|
948
|
-
expect(out.identifier).toBe("gpt-image-2")
|
|
949
|
-
expect(out.adjustments.map((a) => a.field)).toEqual(["aspectRatio"
|
|
947
|
+
expect(out.resolution).toBe("4K")
|
|
948
|
+
expect(out.identifier).toBe("gpt-image-2:4K")
|
|
949
|
+
expect(out.adjustments.map((a) => a.field)).toEqual(["aspectRatio"])
|
|
950
950
|
})
|
|
951
951
|
|
|
952
|
-
it("prices the SNAPPED resolution —
|
|
952
|
+
it("prices the SNAPPED resolution — GPT Image 2.5 Flare at 9:8 + 2K reserves the 1K tier", () => {
|
|
953
953
|
const out = resolveNormalizedImageGen({
|
|
954
|
-
provider: "gpt-image-2",
|
|
955
|
-
aspectRatio: "
|
|
954
|
+
provider: "gpt-image-2-5-flare",
|
|
955
|
+
aspectRatio: "9:8",
|
|
956
956
|
resolution: "2K",
|
|
957
957
|
refCount: 0,
|
|
958
958
|
swapToI2i: true,
|
|
959
959
|
})
|
|
960
960
|
expect(out.resolution).toBe("1K")
|
|
961
|
-
expect(out.identifier).toBe("gpt-image-2")
|
|
961
|
+
expect(out.identifier).toBe("gpt-image-2-5-flare")
|
|
962
|
+
})
|
|
963
|
+
|
|
964
|
+
it("prices gpt-image-2 at auto and 1:1 at the size asked", () => {
|
|
965
|
+
for (const [aspectRatio, resolution, id] of [["auto", "2K", "gpt-image-2:2K"], ["auto", "4K", "gpt-image-2:4K"], ["1:1", "4K", "gpt-image-2:4K"]] as const) {
|
|
966
|
+
const out = resolveNormalizedImageGen({ provider: "gpt-image-2", aspectRatio, resolution, refCount: 0, swapToI2i: true })
|
|
967
|
+
expect(out.resolution).toBe(resolution)
|
|
968
|
+
expect(out.identifier).toBe(id)
|
|
969
|
+
expect(out.adjustments).toEqual([])
|
|
970
|
+
}
|
|
962
971
|
})
|
|
963
972
|
|
|
964
973
|
it("drops a lever the model does not have, and reports it", () => {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { MODEL_CATALOG, normalizeModelInput, resolutionAtAspectRatio, resolutionsAtAspectRatio } from "../model-catalog.js"
|
|
3
|
+
import { resolveNormalizedImageGen } from "../credit-identifiers.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* GPT Image 2 (`gpt-image-2`, `gpt-image-2-i2i`) renders every ratio it offers
|
|
7
|
+
* at every size it lists: "auto" and 1:1 included. It used to carry two size
|
|
8
|
+
* rules ("auto" at 1K only, 1:1 at 1K or 2K) taken from older provider docs;
|
|
9
|
+
* live runs on 2026-11-10 rendered 1:1 at 4K (2880x2880), "auto" at 2K
|
|
10
|
+
* (2048x2048) and an edit at "auto" and 2K (1536x2048 from a 768x1024 photo),
|
|
11
|
+
* each billed as its own size. So nothing is snapped by size, there is no
|
|
12
|
+
* adjustment, and a run is priced at the size it asks for.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const MODELS = ["gpt-image-2", "gpt-image-2-i2i"] as const
|
|
16
|
+
|
|
17
|
+
/** The price id's size suffix: 1K is the base id. */
|
|
18
|
+
const tier = (size: string | undefined) => (size === undefined || size === "1K" ? "" : `:${size}`)
|
|
19
|
+
|
|
20
|
+
describe.each(MODELS)("%s: every offered ratio renders every size", (model) => {
|
|
21
|
+
const entry = MODEL_CATALOG[model]!
|
|
22
|
+
const ratios = entry.aspectRatios!
|
|
23
|
+
const sizes = entry.resolutions!
|
|
24
|
+
|
|
25
|
+
it("offers auto, 1:1, 16:9, 9:16, 4:3 and 3:4 at 1K, 2K and 4K", () => {
|
|
26
|
+
expect(ratios).toEqual(["auto", "1:1", "16:9", "9:16", "4:3", "3:4"])
|
|
27
|
+
expect(sizes).toEqual(["1K", "2K", "4K"])
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it("declares no size rule per ratio", () => {
|
|
31
|
+
expect(entry.resolutionsByAspectRatio).toBeUndefined()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const cells = ratios.flatMap((ratio) => [undefined, ...sizes].map((size) => [ratio, size ?? null] as const))
|
|
35
|
+
|
|
36
|
+
it.each(cells)("ratio %s, size %s: sent as asked, no adjustment, priced at that size", (ratio, sizeOrNull) => {
|
|
37
|
+
const size = sizeOrNull ?? undefined
|
|
38
|
+
const out = normalizeModelInput(model, { aspectRatio: ratio, resolution: size })
|
|
39
|
+
expect(out.aspectRatio).toBe(ratio)
|
|
40
|
+
expect(out.resolution).toBe(size)
|
|
41
|
+
expect(out.adjustments).toEqual([])
|
|
42
|
+
|
|
43
|
+
// The price id the image routes reserve, with and without a reference
|
|
44
|
+
// photo (which swaps the text-to-image id to its edit).
|
|
45
|
+
const t2i = resolveNormalizedImageGen({ provider: model, aspectRatio: ratio, resolution: size, refCount: 0, swapToI2i: true })
|
|
46
|
+
expect(t2i.identifier).toBe(`${model}${tier(size)}`)
|
|
47
|
+
const withRef = resolveNormalizedImageGen({ provider: model, aspectRatio: ratio, resolution: size, refCount: 1, swapToI2i: true })
|
|
48
|
+
expect(withRef.identifier).toBe(`gpt-image-2-i2i${tier(size)}`)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it.each(ratios)("the sizes on offer at %s are all of them, and none moves", (ratio) => {
|
|
52
|
+
expect(resolutionsAtAspectRatio(model, ratio)).toEqual(sizes)
|
|
53
|
+
for (const size of sizes) expect(resolutionAtAspectRatio(model, ratio, size)).toBe(size)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it("every 2K and 4K price row exists in the catalog", () => {
|
|
57
|
+
const ids = entry.pricing.map((p) => p.identifier)
|
|
58
|
+
for (const size of sizes) expect(ids).toContain(`${model}${tier(size)}`)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// Off-list values are still the per-lever snaps, and only those: a ratio the
|
|
62
|
+
// model does not offer moves to its first ("auto") and keeps its size; a
|
|
63
|
+
// size it does not list moves to its first (1K). Spelling is canonicalised.
|
|
64
|
+
it.each([
|
|
65
|
+
["21:9", "4K", "auto", "4K", ["aspectRatio"]],
|
|
66
|
+
["21:9", "2K", "auto", "2K", ["aspectRatio"]],
|
|
67
|
+
["1x1", "4K", "auto", "4K", ["aspectRatio"]],
|
|
68
|
+
["1:1", "8K", "1:1", "1K", ["resolution"]],
|
|
69
|
+
["1:1", "4k", "1:1", "4K", []],
|
|
70
|
+
["auto", "2k", "auto", "2K", []],
|
|
71
|
+
["AUTO", "4K", "auto", "4K", []],
|
|
72
|
+
] as const)("%s at %s goes as %s at %s", (ratio, size, sentRatio, sentSize, adjusted) => {
|
|
73
|
+
const out = normalizeModelInput(model, { aspectRatio: ratio, resolution: size })
|
|
74
|
+
expect(out.aspectRatio).toBe(sentRatio)
|
|
75
|
+
expect(out.resolution).toBe(sentSize)
|
|
76
|
+
expect(out.adjustments.map((a) => a.field)).toEqual(adjusted)
|
|
77
|
+
const t2i = resolveNormalizedImageGen({ provider: model, aspectRatio: ratio, resolution: size, refCount: 0, swapToI2i: true })
|
|
78
|
+
expect(t2i.identifier).toBe(`${model}${tier(sentSize)}`)
|
|
79
|
+
})
|
|
80
|
+
})
|
|
@@ -71,23 +71,24 @@ describe("normalizeModelInput", () => {
|
|
|
71
71
|
expect(out.resolution).toBe("2 MP")
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
it("
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
it("keeps gpt-image-2's size at auto and 1:1: it renders every size there", () => {
|
|
75
|
+
for (const aspectRatio of ["auto", "1:1"]) {
|
|
76
|
+
const out = normalizeModelInput("gpt-image-2", { aspectRatio, resolution: "4K" })
|
|
77
|
+
expect(out.resolution).toBe("4K")
|
|
78
|
+
expect(out.adjustments).toEqual([])
|
|
79
|
+
}
|
|
77
80
|
})
|
|
78
81
|
|
|
79
|
-
// GPT Image 2.5
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
// to 1K. If GPT Image 2.5 ever documents such a limit, add it deliberately
|
|
84
|
-
// and change this test in the same commit.
|
|
85
|
-
it.each([
|
|
82
|
+
// GPT Image 2.5's docs (docs.kie.ai/market/gpt/gpt-image-2-5-*) limit four
|
|
83
|
+
// ratios to 1K and nothing else, so auto and 1:1 keep 4K. The four ratios are
|
|
84
|
+
// the catalog's `resolutionsByAspectRatio`, tested below.
|
|
85
|
+
const GPT_IMAGE_2_5_IDS = [
|
|
86
86
|
"gpt-image-2-5-flare",
|
|
87
87
|
"gpt-image-2-5-flare-i2i",
|
|
88
88
|
"gpt-image-2-5-sunburst",
|
|
89
89
|
"gpt-image-2-5-sunburst-i2i",
|
|
90
|
-
]
|
|
90
|
+
]
|
|
91
|
+
it.each(GPT_IMAGE_2_5_IDS)("%s keeps 4K at auto and at 1:1", (modelId) => {
|
|
91
92
|
const auto4k = normalizeModelInput(modelId, { aspectRatio: "auto", resolution: "4K" })
|
|
92
93
|
expect(auto4k.resolution).toBe("4K")
|
|
93
94
|
expect(auto4k.adjustments).toEqual([])
|
|
@@ -97,6 +98,59 @@ describe("normalizeModelInput", () => {
|
|
|
97
98
|
expect(square4k.adjustments).toEqual([])
|
|
98
99
|
})
|
|
99
100
|
|
|
101
|
+
const ONE_K_ONLY_RATIOS = ["27:16", "16:27", "9:8", "8:9"]
|
|
102
|
+
describe.each(GPT_IMAGE_2_5_IDS)("%s renders 27:16, 16:27, 9:8 and 8:9 at 1K only", (modelId) => {
|
|
103
|
+
it.each(ONE_K_ONLY_RATIOS.flatMap((ratio) => ["2K", "4K"].map((size) => [ratio, size] as const)))(
|
|
104
|
+
"%s at %s moves to 1K and says so",
|
|
105
|
+
(ratio, size) => {
|
|
106
|
+
const out = normalizeModelInput(modelId, { aspectRatio: ratio, resolution: size })
|
|
107
|
+
expect(out.aspectRatio).toBe(ratio)
|
|
108
|
+
expect(out.resolution).toBe("1K")
|
|
109
|
+
expect(out.adjustments).toEqual([{
|
|
110
|
+
field: "resolution",
|
|
111
|
+
from: size,
|
|
112
|
+
to: "1K",
|
|
113
|
+
reason: `${MODEL_CATALOG[modelId].label} only renders 1K at the "${ratio}" aspect ratio.`,
|
|
114
|
+
}])
|
|
115
|
+
},
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
it.each(ONE_K_ONLY_RATIOS)("%s at 1K, or with no size, is left as it is", (ratio) => {
|
|
119
|
+
expect(normalizeModelInput(modelId, { aspectRatio: ratio, resolution: "1K" }).adjustments).toEqual([])
|
|
120
|
+
const unset = normalizeModelInput(modelId, { aspectRatio: ratio })
|
|
121
|
+
expect(unset.resolution).toBeUndefined()
|
|
122
|
+
expect(unset.adjustments).toEqual([])
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it.each(["auto", "1:1", "3:2", "2:3", "4:3", "3:4", "16:9", "9:16", "21:9"])("%s keeps 2K and 4K", (ratio) => {
|
|
126
|
+
for (const size of ["2K", "4K"]) {
|
|
127
|
+
const out = normalizeModelInput(modelId, { aspectRatio: ratio, resolution: size })
|
|
128
|
+
expect(out.resolution).toBe(size)
|
|
129
|
+
expect(out.adjustments).toEqual([])
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it("an opaque background at 27:16 and 2K keeps its setting, as the size it renders is 1K", () => {
|
|
134
|
+
const out = normalizeModelInput(modelId, { aspectRatio: "27:16", resolution: "2K", background: "opaque" })
|
|
135
|
+
expect(out.resolution).toBe("1K")
|
|
136
|
+
expect(out.background).toBe("opaque")
|
|
137
|
+
expect(out.adjustments.map((a) => a.field)).toEqual(["resolution"])
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it("a transparent background at 9:8 and 4K is one move to 1K", () => {
|
|
141
|
+
const out = normalizeModelInput(modelId, { aspectRatio: "9:8", resolution: "4K", background: "transparent" })
|
|
142
|
+
expect(out.resolution).toBe("1K")
|
|
143
|
+
expect(out.background).toBe("transparent")
|
|
144
|
+
expect(out.adjustments).toHaveLength(1)
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
it("GPT Image 2.6 offers none of the four ratios, so the rule never reaches it", () => {
|
|
149
|
+
for (const id of Object.keys(MODEL_CATALOG).filter((m) => m.startsWith("gpt-image-2-6"))) {
|
|
150
|
+
expect(MODEL_CATALOG[id].resolutionsByAspectRatio, id).toBeUndefined()
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
100
154
|
// The four ratios 2.5 introduced are new to the platform vocabulary; the snap
|
|
101
155
|
// must accept them rather than rewrite them to a neighbour.
|
|
102
156
|
it.each(["27:16", "16:27", "9:8", "8:9", "21:9", "3:2"])(
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
MODEL_CATALOG,
|
|
4
|
+
defaultResolutionFor,
|
|
5
|
+
resolutionAtAspectRatio,
|
|
6
|
+
resolutionsAtAspectRatio,
|
|
7
|
+
} from "../model-catalog.js"
|
|
8
|
+
import { buildCreditModelIdentifier, resolveNormalizedImageGen } from "../credit-identifiers.js"
|
|
9
|
+
import { normalizeNodeModelParams } from "../normalize-node-params.js"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `resolutionsByAspectRatio`: the ratios at which a model renders fewer sizes
|
|
13
|
+
* than it lists. GPT Image 2.5 renders 27:16, 16:27, 9:8 and 8:9 at 1K only, so
|
|
14
|
+
* a 2K or 4K request there is sent, and priced, as 1K.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const GPT_IMAGE_2_5 = [
|
|
18
|
+
"gpt-image-2-5-flare",
|
|
19
|
+
"gpt-image-2-5-flare-i2i",
|
|
20
|
+
"gpt-image-2-5-sunburst",
|
|
21
|
+
"gpt-image-2-5-sunburst-i2i",
|
|
22
|
+
] as const
|
|
23
|
+
const ONE_K_ONLY = ["27:16", "16:27", "9:8", "8:9"] as const
|
|
24
|
+
|
|
25
|
+
describe("the catalog's resolutionsByAspectRatio", () => {
|
|
26
|
+
it("is declared on the four GPT Image 2.5 ids, 1K at each of the four ratios", () => {
|
|
27
|
+
for (const id of GPT_IMAGE_2_5) {
|
|
28
|
+
expect(MODEL_CATALOG[id].resolutionsByAspectRatio, id).toEqual({
|
|
29
|
+
"27:16": ["1K"], "16:27": ["1K"], "9:8": ["1K"], "8:9": ["1K"],
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it("INVARIANT: every declaration names the model's own ratios and sizes, and its default size renders everywhere", () => {
|
|
35
|
+
const failures: string[] = []
|
|
36
|
+
for (const [id, m] of Object.entries(MODEL_CATALOG)) {
|
|
37
|
+
if (!m.resolutionsByAspectRatio) continue
|
|
38
|
+
// The size an unset request is priced at must render at every listed
|
|
39
|
+
// ratio, or a request naming no size would be priced above what it renders.
|
|
40
|
+
const unsetSize = defaultResolutionFor(id) ?? m.resolutions?.[0]
|
|
41
|
+
for (const [ratio, sizes] of Object.entries(m.resolutionsByAspectRatio)) {
|
|
42
|
+
if (!m.aspectRatios?.includes(ratio)) failures.push(`${id}: ${ratio} is not one of its ratios`)
|
|
43
|
+
if (sizes.length === 0) failures.push(`${id}: ${ratio} renders no size`)
|
|
44
|
+
for (const size of sizes) {
|
|
45
|
+
if (!m.resolutions?.includes(size)) failures.push(`${id}: ${ratio} names ${size}, not one of its sizes`)
|
|
46
|
+
}
|
|
47
|
+
if (unsetSize !== undefined && !sizes.includes(unsetSize)) {
|
|
48
|
+
failures.push(`${id}: its default size ${unsetSize} does not render at ${ratio}`)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
expect(failures).toEqual([])
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
describe("resolutionsAtAspectRatio", () => {
|
|
57
|
+
it("narrows the sizes at a limited ratio, in the catalog's order", () => {
|
|
58
|
+
for (const id of GPT_IMAGE_2_5) {
|
|
59
|
+
for (const ratio of ONE_K_ONLY) expect(resolutionsAtAspectRatio(id, ratio)).toEqual(["1K"])
|
|
60
|
+
expect(resolutionsAtAspectRatio(id, "16:9")).toEqual(["1K", "2K", "4K"])
|
|
61
|
+
expect(resolutionsAtAspectRatio(id, "auto")).toEqual(["1K", "2K", "4K"])
|
|
62
|
+
expect(resolutionsAtAspectRatio(id, undefined)).toEqual(["1K", "2K", "4K"])
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it("reads a padded ratio, and never the object's prototype", () => {
|
|
67
|
+
expect(resolutionsAtAspectRatio("gpt-image-2-5-flare", " 9:8 ")).toEqual(["1K"])
|
|
68
|
+
expect(resolutionsAtAspectRatio("gpt-image-2-5-flare", "constructor")).toEqual(["1K", "2K", "4K"])
|
|
69
|
+
expect(resolutionsAtAspectRatio("gpt-image-2-5-flare", "__proto__")).toEqual(["1K", "2K", "4K"])
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it("is the model's own list where nothing is limited, and undefined with no size setting", () => {
|
|
73
|
+
expect(resolutionsAtAspectRatio("gpt-image-2-6-flare", "16:9")).toEqual(MODEL_CATALOG["gpt-image-2-6-flare"].resolutions)
|
|
74
|
+
expect(resolutionsAtAspectRatio("nano-banana", "16:9")).toBeUndefined()
|
|
75
|
+
expect(resolutionsAtAspectRatio("not-a-model", "27:16")).toBeUndefined()
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
describe("resolutionAtAspectRatio", () => {
|
|
80
|
+
it("moves a size the ratio does not render to the largest it does at or below it", () => {
|
|
81
|
+
for (const ratio of ONE_K_ONLY) {
|
|
82
|
+
expect(resolutionAtAspectRatio("gpt-image-2-5-sunburst", ratio, "4K")).toBe("1K")
|
|
83
|
+
expect(resolutionAtAspectRatio("gpt-image-2-5-sunburst", ratio, "2K")).toBe("1K")
|
|
84
|
+
expect(resolutionAtAspectRatio("gpt-image-2-5-sunburst", ratio, "1K")).toBe("1K")
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it("leaves everything else as it is", () => {
|
|
89
|
+
expect(resolutionAtAspectRatio("gpt-image-2-5-flare", "16:9", "4K")).toBe("4K")
|
|
90
|
+
expect(resolutionAtAspectRatio("gpt-image-2-5-flare", "27:16", undefined)).toBeUndefined()
|
|
91
|
+
// A size the model does not list is the lever snap's to correct, not this one's.
|
|
92
|
+
expect(resolutionAtAspectRatio("gpt-image-2-5-flare", "27:16", "8K")).toBe("8K")
|
|
93
|
+
expect(resolutionAtAspectRatio("gpt-image-2-6-flare", "21:9", "4K")).toBe("4K")
|
|
94
|
+
expect(resolutionAtAspectRatio("not-a-model", "27:16", "4K")).toBe("4K")
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
describe("the price follows the size that renders (quote = charge)", () => {
|
|
99
|
+
it.each(GPT_IMAGE_2_5.flatMap((id) => ONE_K_ONLY.map((ratio) => [id, ratio] as const)))(
|
|
100
|
+
"%s at %s: a 2K or 4K request is priced as 1K",
|
|
101
|
+
(id, ratio) => {
|
|
102
|
+
for (const resolution of ["2K", "4K"]) {
|
|
103
|
+
// Image-to-image / edit pricing (no swap) and Generate Image pricing.
|
|
104
|
+
const direct = resolveNormalizedImageGen({ provider: id, aspectRatio: ratio, resolution, refCount: 1, swapToI2i: false })
|
|
105
|
+
expect(direct.resolution).toBe("1K")
|
|
106
|
+
expect(direct.identifier).toBe(buildCreditModelIdentifier(id, undefined, "1K"))
|
|
107
|
+
expect(direct.identifier).toBe(id)
|
|
108
|
+
expect(direct.adjustments.some((a) => a.field === "resolution" && a.to === "1K")).toBe(true)
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
it("a text-to-image id swapped onto its edit sibling by references is priced as that sibling's 1K", () => {
|
|
114
|
+
const out = resolveNormalizedImageGen({ provider: "gpt-image-2-5-flare", aspectRatio: "16:27", resolution: "4K", refCount: 2, swapToI2i: true })
|
|
115
|
+
expect(out.modelId).toBe("gpt-image-2-5-flare-i2i")
|
|
116
|
+
expect(out.resolution).toBe("1K")
|
|
117
|
+
expect(out.identifier).toBe("gpt-image-2-5-flare-i2i")
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it("other ratios keep their 2K and 4K prices", () => {
|
|
121
|
+
expect(resolveNormalizedImageGen({ provider: "gpt-image-2-5-flare", aspectRatio: "21:9", resolution: "2K", refCount: 0 }).identifier)
|
|
122
|
+
.toBe("gpt-image-2-5-flare:2K")
|
|
123
|
+
expect(resolveNormalizedImageGen({ provider: "gpt-image-2-5-sunburst-i2i", aspectRatio: "auto", resolution: "4K", refCount: 1 }).identifier)
|
|
124
|
+
.toBe("gpt-image-2-5-sunburst-i2i:4K")
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it("a workflow written by an agent stores the size that renders (normalizeNodeModelParams)", () => {
|
|
128
|
+
const { nodes, adjustments } = normalizeNodeModelParams([
|
|
129
|
+
{ id: "n1", type: "generate-image", data: { provider: "gpt-image-2-5-sunburst", aspectRatio: "9:8", resolution: "4K" } },
|
|
130
|
+
])
|
|
131
|
+
expect((nodes[0]!.data as Record<string, unknown>).resolution).toBe("1K")
|
|
132
|
+
expect(adjustments).toMatchObject([{ nodeId: "n1", field: "resolution", from: "4K", to: "1K" }])
|
|
133
|
+
})
|
|
134
|
+
})
|
|
@@ -173,6 +173,24 @@ describe("parseRuntimeConfig — typed, lenient, never throws", () => {
|
|
|
173
173
|
expect(parseRuntimeConfig(raw)).toEqual({})
|
|
174
174
|
})
|
|
175
175
|
|
|
176
|
+
it("keeps legacyUiHosts as the host names it lists, and nothing else", () => {
|
|
177
|
+
expect(parseRuntimeConfig({ legacyUiHosts: ["app.example.com", "", 7, "Bad Host", "next.app.example.com"] })).toEqual({ legacyUiHosts: ["app.example.com", "next.app.example.com"] })
|
|
178
|
+
expect("legacyUiHosts" in parseRuntimeConfig({ legacyUiHosts: [] })).toBe(false)
|
|
179
|
+
expect("legacyUiHosts" in parseRuntimeConfig({ legacyUiHosts: "app.example.com" })).toBe(false)
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
it("keeps flowUiOrigin and linkOrigin only when each is an https origin", () => {
|
|
183
|
+
expect(parseRuntimeConfig({ apiUrl: "/", flowUiOrigin: "https://flow.example.com", linkOrigin: "https://app.example.com" })).toEqual({
|
|
184
|
+
apiUrl: "/",
|
|
185
|
+
flowUiOrigin: "https://flow.example.com",
|
|
186
|
+
linkOrigin: "https://app.example.com",
|
|
187
|
+
})
|
|
188
|
+
for (const malformed of ["http://flow.example.com", "https://flow.example.com/", "nope", ""]) {
|
|
189
|
+
expect(parseRuntimeConfig({ flowUiOrigin: malformed, linkOrigin: malformed })).toEqual({})
|
|
190
|
+
}
|
|
191
|
+
expect("flowUiOrigin" in parseRuntimeConfig({ apiUrl: "/" })).toBe(false)
|
|
192
|
+
})
|
|
193
|
+
|
|
176
194
|
it("keeps mediaOrigin only when it is an https origin", () => {
|
|
177
195
|
expect(parseRuntimeConfig({ apiUrl: "/", mediaOrigin: "https://media.example.com" })).toEqual({ apiUrl: "/", mediaOrigin: "https://media.example.com" })
|
|
178
196
|
for (const malformed of ["http://media.example.com", "https://media.example.com/", "https://media.example.com/bucket", "media.example.com", "", " ", 7, null, ["https://media.example.com"]]) {
|
|
@@ -396,3 +414,13 @@ describe("the UI-string key manifest", () => {
|
|
|
396
414
|
expect(JSON.stringify(manifest)).not.toContain("left of")
|
|
397
415
|
})
|
|
398
416
|
})
|
|
417
|
+
|
|
418
|
+
describe("isLegacyUiHost: the one rule for a host the app's pages move away from", () => {
|
|
419
|
+
it("is a bare host name, lower case, nothing around it", async () => {
|
|
420
|
+
const { isLegacyUiHost } = await import("../runtime-config/contract.js")
|
|
421
|
+
for (const host of ["app.example.com", "next.app.example.com", "localhost"]) expect(isLegacyUiHost(host), host).toBe(true)
|
|
422
|
+
for (const bad of ["app.example.com\n", "https://app.example.com", "app.example.com:443", "app.example.com/", "a.test\tb.test", "App.example.com", "", " app.example.com", 42, null]) {
|
|
423
|
+
expect(isLegacyUiHost(bad), JSON.stringify(bad)).toBe(false)
|
|
424
|
+
}
|
|
425
|
+
})
|
|
426
|
+
})
|