@nodaro/shared 3.63.0 → 3.64.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-AE3AAJ4O.js → chunk-36VWLB4J.js} +3 -3
- package/dist/{chunk-AE3AAJ4O.js.map → chunk-36VWLB4J.js.map} +1 -1
- package/dist/{chunk-HWQ2SYNA.js → chunk-3AYM47GW.js} +5 -5
- package/dist/{chunk-HWQ2SYNA.js.map → chunk-3AYM47GW.js.map} +1 -1
- package/dist/{chunk-CZ5IQB3L.js → chunk-3KTWYYCN.js} +8 -5
- package/dist/chunk-3KTWYYCN.js.map +1 -0
- package/dist/{chunk-4MMZD63H.js → chunk-4IUE2JB7.js} +3 -3
- package/dist/{chunk-4MMZD63H.js.map → chunk-4IUE2JB7.js.map} +1 -1
- package/dist/{chunk-M5OCFGHF.cjs → chunk-5OBTGNUQ.cjs} +296 -25
- package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
- package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-67CMMTLN.cjs} +4 -4
- package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
- package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
- package/dist/chunk-6BRWPJPP.cjs.map +1 -0
- package/dist/{chunk-HBXF6RUU.js → chunk-6YIV37V7.js} +4 -4
- package/dist/{chunk-HBXF6RUU.js.map → chunk-6YIV37V7.js.map} +1 -1
- package/dist/{chunk-F6WGGYQW.cjs → chunk-7AJGUI7L.cjs} +37 -15
- package/dist/chunk-7AJGUI7L.cjs.map +1 -0
- package/dist/{chunk-KCZHQH2O.js → chunk-7KQ6W5DS.js} +4 -4
- package/dist/{chunk-KCZHQH2O.js.map → chunk-7KQ6W5DS.js.map} +1 -1
- package/dist/{chunk-TM5JYSJF.cjs → chunk-ACZZHHFZ.cjs} +72 -33
- package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
- package/dist/{chunk-Y35JQPT6.cjs → chunk-AZNZ5WNZ.cjs} +42 -42
- package/dist/{chunk-Y35JQPT6.cjs.map → chunk-AZNZ5WNZ.cjs.map} +1 -1
- package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
- package/dist/chunk-BQYCZLMF.js.map +1 -0
- package/dist/{chunk-GMBDLNLD.cjs → chunk-CHS2SIP6.cjs} +183 -60
- package/dist/chunk-CHS2SIP6.cjs.map +1 -0
- package/dist/{chunk-77WU3V3J.cjs → chunk-CHTZZRAL.cjs} +6 -6
- package/dist/{chunk-77WU3V3J.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
- package/dist/{chunk-WZVIBAKN.cjs → chunk-D4KWNDPH.cjs} +12 -12
- package/dist/{chunk-WZVIBAKN.cjs.map → chunk-D4KWNDPH.cjs.map} +1 -1
- package/dist/{chunk-PSKZKLDG.js → chunk-DZ4IOP3Q.js} +288 -26
- package/dist/chunk-DZ4IOP3Q.js.map +1 -0
- package/dist/{chunk-XGVJGNZW.cjs → chunk-EXEVT6D2.cjs} +15 -5
- package/dist/chunk-EXEVT6D2.cjs.map +1 -0
- package/dist/{chunk-X5BAFW3Q.cjs → chunk-FHGRKQVZ.cjs} +8 -8
- package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
- package/dist/{chunk-GSKLPI3J.cjs → chunk-GTWUS6MQ.cjs} +118 -61
- package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
- package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
- package/dist/chunk-H5KHWTAE.js.map +1 -0
- package/dist/{chunk-V5EEQR2U.cjs → chunk-HDPJNNMF.cjs} +21 -21
- package/dist/{chunk-V5EEQR2U.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
- package/dist/{chunk-6M563QE6.js → chunk-IYSOVS7O.js} +55 -23
- package/dist/chunk-IYSOVS7O.js.map +1 -0
- package/dist/{chunk-XGGZWA4A.cjs → chunk-J6B7J73J.cjs} +52 -49
- package/dist/chunk-J6B7J73J.cjs.map +1 -0
- package/dist/{chunk-MD4XHED4.js → chunk-KB2SQAR3.js} +3 -3
- package/dist/{chunk-MD4XHED4.js.map → chunk-KB2SQAR3.js.map} +1 -1
- package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
- package/dist/chunk-KSHAAPQF.cjs.map +1 -0
- package/dist/{chunk-6TGB7ECA.cjs → chunk-O4RPXBDZ.cjs} +12 -8
- package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
- package/dist/{chunk-YUER7TJG.js → chunk-OBOOHG3N.js} +13 -4
- package/dist/chunk-OBOOHG3N.js.map +1 -0
- package/dist/{chunk-6BZC2ZHC.cjs → chunk-OOZW2MM6.cjs} +9 -9
- package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
- package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
- package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
- package/dist/{chunk-3K24DWOH.js → chunk-PJJAZQVZ.js} +3 -3
- package/dist/{chunk-3K24DWOH.js.map → chunk-PJJAZQVZ.js.map} +1 -1
- package/dist/{chunk-EPXGG27L.js → chunk-Q2Y4JHF7.js} +5 -5
- package/dist/{chunk-EPXGG27L.js.map → chunk-Q2Y4JHF7.js.map} +1 -1
- package/dist/{chunk-KMGCHV6O.js → chunk-QYU7J5EQ.js} +37 -15
- package/dist/chunk-QYU7J5EQ.js.map +1 -0
- package/dist/{chunk-IY3Y462W.js → chunk-S3UGLZSF.js} +3 -3
- package/dist/{chunk-IY3Y462W.js.map → chunk-S3UGLZSF.js.map} +1 -1
- package/dist/{chunk-34QLPTSA.js → chunk-SHH2T4CR.js} +3 -3
- package/dist/{chunk-34QLPTSA.js.map → chunk-SHH2T4CR.js.map} +1 -1
- package/dist/{chunk-L2TVY6XN.cjs → chunk-SPAHI7DY.cjs} +4 -4
- package/dist/{chunk-L2TVY6XN.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
- package/dist/{chunk-YX6TFX7H.js → chunk-SXHHLZ22.js} +66 -11
- package/dist/chunk-SXHHLZ22.js.map +1 -0
- package/dist/{chunk-LMAQUR55.cjs → chunk-T2OVDF2M.cjs} +6 -6
- package/dist/{chunk-LMAQUR55.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
- package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
- package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
- package/dist/{chunk-BMJVKYVB.js → chunk-TPQJKS7D.js} +109 -7
- package/dist/chunk-TPQJKS7D.js.map +1 -0
- package/dist/{chunk-63H4C56Q.cjs → chunk-TQW3R44P.cjs} +8 -8
- package/dist/{chunk-63H4C56Q.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
- package/dist/{chunk-4DVWXEB6.js → chunk-TTGZ2L3O.js} +3 -3
- package/dist/{chunk-4DVWXEB6.js.map → chunk-TTGZ2L3O.js.map} +1 -1
- package/dist/{chunk-XBTYGQ6Z.js → chunk-VPTA4Z7G.js} +8 -5
- package/dist/chunk-VPTA4Z7G.js.map +1 -0
- package/dist/{chunk-6XUG4L7X.cjs → chunk-VZ6TE23U.cjs} +6 -6
- package/dist/{chunk-6XUG4L7X.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
- package/dist/{chunk-LH72PQO2.cjs → chunk-W6VJAUGM.cjs} +114 -45
- package/dist/chunk-W6VJAUGM.cjs.map +1 -0
- package/dist/{chunk-OV3JTKBY.js → chunk-W7KHHNZR.js} +74 -17
- package/dist/chunk-W7KHHNZR.js.map +1 -0
- package/dist/{chunk-2PU3AGGS.cjs → chunk-YQV53HRR.cjs} +7 -7
- package/dist/{chunk-2PU3AGGS.cjs.map → chunk-YQV53HRR.cjs.map} +1 -1
- package/dist/{chunk-FXGNRYQQ.js → chunk-ZI3QDUHO.js} +3 -3
- package/dist/{chunk-FXGNRYQQ.js.map → chunk-ZI3QDUHO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.js +8 -7
- package/dist/entries/captions.cjs +38 -30
- package/dist/entries/captions.d.cts +47 -1
- package/dist/entries/captions.d.ts +47 -1
- package/dist/entries/captions.js +1 -1
- package/dist/entries/credits.cjs +303 -191
- package/dist/entries/credits.d.cts +219 -15
- package/dist/entries/credits.d.ts +219 -15
- package/dist/entries/credits.js +11 -11
- package/dist/entries/llm-models.cjs +62 -62
- package/dist/entries/llm-models.d.cts +29 -7
- package/dist/entries/llm-models.d.ts +29 -7
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/model-catalog.cjs +149 -109
- package/dist/entries/model-catalog.d.cts +64 -7
- package/dist/entries/model-catalog.d.ts +64 -7
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +394 -346
- package/dist/entries/models.d.cts +4 -4
- package/dist/entries/models.d.ts +4 -4
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +220 -211
- package/dist/entries/nodes.d.cts +46 -3
- package/dist/entries/nodes.d.ts +46 -3
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +156 -152
- package/dist/entries/pipeline.d.cts +13 -3
- package/dist/entries/pipeline.d.ts +13 -3
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +177 -177
- package/dist/entries/social.js +2 -2
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +145 -145
- package/dist/entries/video.js +6 -6
- package/dist/entries/workflow.cjs +150 -150
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +1879 -1659
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +25 -25
- package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-Cf9fkEUp.d.cts} +15 -2
- package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-Cf9fkEUp.d.ts} +15 -2
- package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BxjiWVQ9.d.ts} +89 -19
- package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-C_Nyft_i.d.cts} +89 -19
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
- package/src/__tests__/extend-providers.test.ts +266 -26
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
- package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
- package/src/__tests__/flux-3-klein.test.ts +203 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
- package/src/__tests__/llm-models.test.ts +7 -9
- package/src/__tests__/llm-price-key.test.ts +12 -0
- package/src/__tests__/model-makers.test.ts +3 -0
- package/src/__tests__/node-runtime-keys.test.ts +7 -0
- package/src/__tests__/normalize-node-params.test.ts +147 -1
- package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
- package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
- package/src/__tests__/sequence-execution.test.ts +22 -1
- package/src/__tests__/suno-credit-type.test.ts +21 -2
- package/src/__tests__/transcribe-capabilities.test.ts +4 -2
- package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
- package/src/__tests__/video-analysis-pricing.test.ts +10 -9
- package/src/caption-styles.ts +62 -0
- package/src/credit-estimators/add-captions-nemotron.ts +73 -0
- package/src/credit-estimators/index.ts +10 -0
- package/src/credit-identifiers.ts +249 -13
- package/src/entries/captions.ts +2 -0
- package/src/entries/credits.ts +25 -1
- package/src/entries/model-catalog.ts +13 -0
- package/src/entries/models.ts +15 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/pipeline.ts +1 -1
- package/src/flux-3-klein.ts +69 -0
- package/src/input-image-pricing.ts +23 -6
- package/src/llm-models.ts +60 -16
- package/src/model-catalog.ts +280 -25
- package/src/model-constants.ts +146 -17
- package/src/node-default-mappings.ts +3 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +123 -2
- package/src/seedance-extend-rate.ts +116 -0
- package/src/sequence-execution.ts +24 -0
- package/src/transcribe-preflight.ts +23 -0
- package/src/video-analysis-pricing.ts +28 -15
- package/dist/chunk-6M563QE6.js.map +0 -1
- package/dist/chunk-6TGB7ECA.cjs.map +0 -1
- package/dist/chunk-BLJUCPMV.cjs.map +0 -1
- package/dist/chunk-BMJVKYVB.js.map +0 -1
- package/dist/chunk-CZ5IQB3L.js.map +0 -1
- package/dist/chunk-F6WGGYQW.cjs.map +0 -1
- package/dist/chunk-GMBDLNLD.cjs.map +0 -1
- package/dist/chunk-GSKLPI3J.cjs.map +0 -1
- package/dist/chunk-HSHCCBIV.js.map +0 -1
- package/dist/chunk-KMGCHV6O.js.map +0 -1
- package/dist/chunk-LH72PQO2.cjs.map +0 -1
- package/dist/chunk-M5OCFGHF.cjs.map +0 -1
- package/dist/chunk-OV3JTKBY.js.map +0 -1
- package/dist/chunk-PSKZKLDG.js.map +0 -1
- package/dist/chunk-Q6IES3U2.js.map +0 -1
- package/dist/chunk-TM5JYSJF.cjs.map +0 -1
- package/dist/chunk-WRSWH7US.cjs.map +0 -1
- package/dist/chunk-XBTYGQ6Z.js.map +0 -1
- package/dist/chunk-XGGZWA4A.cjs.map +0 -1
- package/dist/chunk-XGVJGNZW.cjs.map +0 -1
- package/dist/chunk-YUER7TJG.js.map +0 -1
- package/dist/chunk-YX6TFX7H.js.map +0 -1
package/src/model-constants.ts
CHANGED
|
@@ -188,7 +188,9 @@ export const MAX_IMAGE_PROMPT_CHARS_BY_PROVIDER: Record<string, number> = {
|
|
|
188
188
|
// docs.kie.ai/market/minimax-h3/text-to-image + image-edit),
|
|
189
189
|
// seedream-5-5, seedream-5-5-i2i (both "5–5000 characters"; the minimum is
|
|
190
190
|
// MIN_IMAGE_PROMPT_CHARS_BY_PROVIDER below;
|
|
191
|
-
// docs.kie.ai/market/seedream/5-5-text-to-image + 5-5-image-to-image)
|
|
191
|
+
// docs.kie.ai/market/seedream/5-5-text-to-image + 5-5-image-to-image),
|
|
192
|
+
// flux-3-klein, flux-3-klein-i2i (both "1–5000 characters";
|
|
193
|
+
// docs.kie.ai/market/flux3/klein-text-to-image + klein-edit-image).
|
|
192
194
|
// grok-i2i: doc states 390000 (78× its t2i sibling) — treated as a KIE schema
|
|
193
195
|
// typo and left at the 5000 default per the sanity-cap decision.
|
|
194
196
|
// UNVERIFIED (no limit stated in schema) → 5000 default: flux-kontext(-max)
|
|
@@ -370,6 +372,9 @@ export const MAX_VIDEO_PROMPT_CHARS_BY_PROVIDER: Record<string, number> = {
|
|
|
370
372
|
// PixVerse V6 Max — 1-5000 chars on both endpoints
|
|
371
373
|
// (docs.kie.ai/market/pixverse/v6-max-text-to-video and /v6-max-image-to-video).
|
|
372
374
|
"pixverse-v6-max": 5000,
|
|
375
|
+
// PixVerse V6 Extend — 3-5000 chars (docs.kie.ai/market/pixverse/extend);
|
|
376
|
+
// its prompt is sent as written, so the whole cap is the user's.
|
|
377
|
+
"pixverse-v6-extend": 5000,
|
|
373
378
|
"bytedance-lite": 10000,
|
|
374
379
|
"bytedance-pro": 10000,
|
|
375
380
|
"bytedance-pro-fast": 10000,
|
|
@@ -663,6 +668,7 @@ export const MODELS_WITH_REFERENCE_IMAGE_SUPPORT = new Set([
|
|
|
663
668
|
"seedream-5-5",
|
|
664
669
|
"flux",
|
|
665
670
|
"flux-flex",
|
|
671
|
+
"flux-3-klein",
|
|
666
672
|
// Image editing / image-to-image (reference = source image)
|
|
667
673
|
"nano-banana-edit",
|
|
668
674
|
"gpt-image-i2i",
|
|
@@ -687,6 +693,7 @@ export const MODELS_WITH_REFERENCE_IMAGE_SUPPORT = new Set([
|
|
|
687
693
|
"seedream-5-flash-i2i",
|
|
688
694
|
"minimax-h3-image-i2i",
|
|
689
695
|
"seedream-5-5-i2i",
|
|
696
|
+
"flux-3-klein-i2i",
|
|
690
697
|
"grok-i2i",
|
|
691
698
|
// Upscale / background ops (source acts as the reference)
|
|
692
699
|
"recraft-remove-bg",
|
|
@@ -734,6 +741,9 @@ export const T2I_TO_I2I_VARIANT: Record<string, string> = {
|
|
|
734
741
|
"seedream-5-5": "seedream-5-5-i2i",
|
|
735
742
|
"flux": "flux-pro-i2i",
|
|
736
743
|
"flux-flex": "flux-i2i",
|
|
744
|
+
// FLUX 3 Klein's text-to-image endpoint takes no image at all: its edit
|
|
745
|
+
// endpoint reads them (the provider swaps too).
|
|
746
|
+
"flux-3-klein": "flux-3-klein-i2i",
|
|
737
747
|
}
|
|
738
748
|
|
|
739
749
|
/**
|
|
@@ -776,6 +786,8 @@ export const REF_IMAGE_MAX_LIMITS: Record<string, number> = {
|
|
|
776
786
|
"minimax-h3-image-i2i": 16,
|
|
777
787
|
// Seedream 5.5 takes 1–10 `image_urls` (docs.kie.ai/market/seedream/5-5-image-to-image).
|
|
778
788
|
"seedream-5-5-i2i": 10,
|
|
789
|
+
// FLUX 3 Klein's edit takes 1–10 `image_urls` (docs.kie.ai/market/flux3/klein-edit-image).
|
|
790
|
+
"flux-3-klein-i2i": 10,
|
|
779
791
|
// Single-source i2i (one input image)
|
|
780
792
|
"flux-kontext": 1,
|
|
781
793
|
"flux-kontext-max": 1,
|
|
@@ -839,8 +851,8 @@ export const DEFAULT_REQUEST_IMAGE_LIMIT = 14
|
|
|
839
851
|
* {@link DEFAULT_REQUEST_IMAGE_LIMIT}. Separate from
|
|
840
852
|
* {@link REF_IMAGE_MAX_LIMITS}, the cap the canvas and the assembler honour: the
|
|
841
853
|
* routes have their own ceiling, and it moves per model only here. GPT Image
|
|
842
|
-
* 2.6 takes more; a model
|
|
843
|
-
*
|
|
854
|
+
* 2.6 takes more; a model whose provider takes fewer (Seedream 5.5 and FLUX 3
|
|
855
|
+
* Klein: 10) is held to its own, so a request is refused before it is
|
|
844
856
|
* reserved instead of failing at the provider.
|
|
845
857
|
*/
|
|
846
858
|
const REQUEST_IMAGE_LIMITS: Record<string, number> = {
|
|
@@ -848,6 +860,7 @@ const REQUEST_IMAGE_LIMITS: Record<string, number> = {
|
|
|
848
860
|
"gpt-image-2-6-sunburst-i2i": 16,
|
|
849
861
|
"minimax-h3-image-i2i": 16,
|
|
850
862
|
"seedream-5-5-i2i": 10,
|
|
863
|
+
"flux-3-klein-i2i": 10,
|
|
851
864
|
}
|
|
852
865
|
|
|
853
866
|
/** The largest per-model limit: the outer bound of the routes' array schemas. */
|
|
@@ -896,6 +909,9 @@ export const VARIABLE_PRICING_MODELS: Record<string, "quality" | "resolution" |
|
|
|
896
909
|
// Also priced per reference image on an edit (`minimaxH3ImageCreditId`).
|
|
897
910
|
"minimax-h3-image": "resolution",
|
|
898
911
|
"minimax-h3-image-i2i": "resolution",
|
|
912
|
+
// By size alone, the same on both ids (`flux3KleinCreditId`).
|
|
913
|
+
"flux-3-klein": "resolution",
|
|
914
|
+
"flux-3-klein-i2i": "resolution",
|
|
899
915
|
}
|
|
900
916
|
|
|
901
917
|
|
|
@@ -962,6 +978,7 @@ export const IMAGE_GEN_PROVIDERS = [
|
|
|
962
978
|
"flux-flex",
|
|
963
979
|
"flux-kontext",
|
|
964
980
|
"flux-kontext-max",
|
|
981
|
+
"flux-3-klein",
|
|
965
982
|
"z-image",
|
|
966
983
|
"wan-2.7",
|
|
967
984
|
"wan-2.7-pro",
|
|
@@ -1001,6 +1018,7 @@ export const IMAGE_I2I_PROVIDERS = [
|
|
|
1001
1018
|
"seedream-5-5-i2i",
|
|
1002
1019
|
"flux-kontext",
|
|
1003
1020
|
"flux-kontext-max",
|
|
1021
|
+
"flux-3-klein-i2i",
|
|
1004
1022
|
// Replicate Open (uncensored) — multi-image Kontext via Replicate
|
|
1005
1023
|
"kontext-multi",
|
|
1006
1024
|
// BFL Flux 2 Pro — runs through Replicate
|
|
@@ -1529,6 +1547,14 @@ export const EXTEND_VIDEO_PROVIDERS = [
|
|
|
1529
1547
|
// Kling 4 extends ANY video the same way (3–30 s added, 720p / 1080p, its
|
|
1530
1548
|
// sound always on), generated on Kling 4.0 and priced on its own rows.
|
|
1531
1549
|
"kling-4-extend",
|
|
1550
|
+
// PixVerse V6 extends ANY video natively (1–15 s added, 360p–1080p, a sound
|
|
1551
|
+
// switch): the whole source goes in and comes back with the new seconds
|
|
1552
|
+
// joined on, of which only the new ones are kept. Priced on its own rows.
|
|
1553
|
+
"pixverse-v6-extend",
|
|
1554
|
+
// Grok extends only its OWN clips (a Grok Imagine text-to-video or
|
|
1555
|
+
// image-to-video run of the same user), named by their task: 6 or 10 s
|
|
1556
|
+
// added at the source's resolution, delivered as Grok returns it.
|
|
1557
|
+
"grok-extend",
|
|
1532
1558
|
] as const
|
|
1533
1559
|
export type ExtendVideoProvider = typeof EXTEND_VIDEO_PROVIDERS[number]
|
|
1534
1560
|
|
|
@@ -1565,6 +1591,71 @@ export function isTailExtendProvider(p: unknown): p is TailExtendProvider {
|
|
|
1565
1591
|
return typeof p === "string" && (TAIL_EXTEND_PROVIDERS as readonly string[]).includes(p)
|
|
1566
1592
|
}
|
|
1567
1593
|
|
|
1594
|
+
/**
|
|
1595
|
+
* PixVerse V6 Extend: a native extend, no tail recipe. The whole source goes
|
|
1596
|
+
* to PixVerse's own extend, which returns it with the new seconds joined on;
|
|
1597
|
+
* the run keeps the user's source and joins only the new seconds to it.
|
|
1598
|
+
*/
|
|
1599
|
+
export type PixverseExtendProvider = Extract<ExtendVideoProvider, "pixverse-v6-extend">
|
|
1600
|
+
export const PIXVERSE_V6_EXTEND_PROVIDER: PixverseExtendProvider = "pixverse-v6-extend"
|
|
1601
|
+
|
|
1602
|
+
/** Whether a value is {@link PIXVERSE_V6_EXTEND_PROVIDER}. */
|
|
1603
|
+
export function isPixverseExtendProvider(p: unknown): p is PixverseExtendProvider {
|
|
1604
|
+
return p === PIXVERSE_V6_EXTEND_PROVIDER
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* The Extend Video providers whose levers come from their own catalog entry —
|
|
1609
|
+
* the seconds added (`durations`, `defaultDuration`) and the resolution
|
|
1610
|
+
* (`resolutions`) — and which are priced one row per second added and
|
|
1611
|
+
* resolution (`catalogExtendCreditId`): the tail recipes
|
|
1612
|
+
* ({@link TailExtendProvider}) and PixVerse V6. Each extends any video by URL.
|
|
1613
|
+
* A retired id answers false: pass it through {@link canonicalVideoProvider} first.
|
|
1614
|
+
*/
|
|
1615
|
+
export type CatalogExtendProvider = TailExtendProvider | PixverseExtendProvider
|
|
1616
|
+
|
|
1617
|
+
/** Whether a value is a {@link CatalogExtendProvider}. */
|
|
1618
|
+
export function isCatalogExtendProvider(p: unknown): p is CatalogExtendProvider {
|
|
1619
|
+
return isTailExtendProvider(p) || isPixverseExtendProvider(p)
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* Whether an Extend Video provider has a sound switch (`generateAudio`, on
|
|
1624
|
+
* unless turned off): Seedance's, which continue the soundtrack, and PixVerse
|
|
1625
|
+
* V6's, whose sound is priced on its own rows. Kling 4's sound is always on.
|
|
1626
|
+
*/
|
|
1627
|
+
export function extendHasSoundSwitch(p: unknown): boolean {
|
|
1628
|
+
return isSeedanceExtendProvider(p) || isPixverseExtendProvider(p)
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Grok Extend: a native extend of Grok's OWN clips only — a completed Grok
|
|
1633
|
+
* Imagine text-to-video or image-to-video run of the same user, named by its
|
|
1634
|
+
* task (the upstream node hands it on, as VEO's extend takes its own). It adds
|
|
1635
|
+
* 6 or 10 s at the SOURCE's resolution, which is never a lever: so it is no
|
|
1636
|
+
* {@link CatalogExtendProvider}, and is priced by `grokExtendCreditId` on the
|
|
1637
|
+
* resolution the source check answers.
|
|
1638
|
+
*/
|
|
1639
|
+
export type GrokExtendProvider = Extract<ExtendVideoProvider, "grok-extend">
|
|
1640
|
+
export const GROK_EXTEND_PROVIDER: GrokExtendProvider = "grok-extend"
|
|
1641
|
+
|
|
1642
|
+
/** Whether a value is {@link GROK_EXTEND_PROVIDER}. */
|
|
1643
|
+
export function isGrokExtendProvider(p: unknown): p is GrokExtendProvider {
|
|
1644
|
+
return p === GROK_EXTEND_PROVIDER
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* The Grok Imagine video models whose clips Grok Extend can extend: text-to-
|
|
1649
|
+
* video's id and image-to-video's (not Grok Imagine Video 1.5, a different
|
|
1650
|
+
* model on the provider's side).
|
|
1651
|
+
*/
|
|
1652
|
+
export const GROK_EXTEND_SOURCE_MODELS = ["grok", "grok-i2v"] as const
|
|
1653
|
+
|
|
1654
|
+
/** Whether a model is one of {@link GROK_EXTEND_SOURCE_MODELS}. */
|
|
1655
|
+
export function isGrokExtendSourceModel(p: unknown): boolean {
|
|
1656
|
+
return typeof p === "string" && (GROK_EXTEND_SOURCE_MODELS as readonly string[]).includes(p)
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1568
1659
|
/** Lip sync providers */
|
|
1569
1660
|
export const LIP_SYNC_PROVIDERS = [
|
|
1570
1661
|
"kling-avatar",
|
|
@@ -1580,9 +1671,8 @@ export const LIP_SYNC_PROVIDERS = [
|
|
|
1580
1671
|
// (LIP_SYNC_AUDIO_RATES), never by bucket.
|
|
1581
1672
|
"omnihuman-2-0",
|
|
1582
1673
|
"latentsync",
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
"sadtalker",
|
|
1674
|
+
// (Wav2Lip, VideoReTalking and SadTalker were retired 2026-11-12:
|
|
1675
|
+
// RETIRED_LIP_SYNC_PROVIDERS below.)
|
|
1586
1676
|
// HeyGen Lipsync Precision + Sync Lipsync 2 Pro — Replicate-hosted, video-input
|
|
1587
1677
|
// dubbing models billed per second of output. Routed through replicateLipSync;
|
|
1588
1678
|
// priced per-second via buildLipSyncCreditId (see lip-sync-pricing.ts).
|
|
@@ -1614,6 +1704,34 @@ export const LIP_SYNC_PROVIDERS = [
|
|
|
1614
1704
|
] as const
|
|
1615
1705
|
export type LipSyncProvider = typeof LIP_SYNC_PROVIDERS[number]
|
|
1616
1706
|
|
|
1707
|
+
/**
|
|
1708
|
+
* Lip Sync models the platform no longer offers (retired 2026-11-12), with the
|
|
1709
|
+
* name each is shown by. They left every menu, the route's accepted values and
|
|
1710
|
+
* the MCP tool; a request, a saved or imported workflow node or an app run that
|
|
1711
|
+
* still names one is refused before anything is reserved, with
|
|
1712
|
+
* {@link retiredLipSyncProviderMessage} — never moved to another model, whose
|
|
1713
|
+
* inputs and price differ. The editor shows a saved node on one as retired and
|
|
1714
|
+
* leaves the choice of another model to the person.
|
|
1715
|
+
*/
|
|
1716
|
+
export const RETIRED_LIP_SYNC_PROVIDERS: Readonly<Record<string, string>> = {
|
|
1717
|
+
wav2lip: "Wav2Lip",
|
|
1718
|
+
"video-retalking": "VideoReTalking",
|
|
1719
|
+
sadtalker: "SadTalker",
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/** The name of a retired Lip Sync model, or undefined for any other value. Own keys only (the value is request input). */
|
|
1723
|
+
export function retiredLipSyncProviderName(provider: unknown): string | undefined {
|
|
1724
|
+
return typeof provider === "string" && Object.hasOwn(RETIRED_LIP_SYNC_PROVIDERS, provider)
|
|
1725
|
+
? RETIRED_LIP_SYNC_PROVIDERS[provider]
|
|
1726
|
+
: undefined
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
/** The refusal a run of a retired Lip Sync model gets, or undefined for any other value. */
|
|
1730
|
+
export function retiredLipSyncProviderMessage(provider: unknown): string | undefined {
|
|
1731
|
+
const name = retiredLipSyncProviderName(provider)
|
|
1732
|
+
return name === undefined ? undefined : `${name} is no longer available for Lip Sync. Pick another Lip Sync model.`
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1617
1735
|
/** Multimodal video models exposed via the lip-sync surface (Seedance 2 family
|
|
1618
1736
|
* + MiniMax Hailuo 3). They go through the i2v provider with the audio
|
|
1619
1737
|
* plumbed as `reference_audio_urls` rather than a dedicated lip-sync flow.
|
|
@@ -1626,12 +1744,10 @@ export const SEEDANCE_LIP_SYNC_PROVIDERS = new Set<string>([
|
|
|
1626
1744
|
"minimax-h3",
|
|
1627
1745
|
])
|
|
1628
1746
|
|
|
1629
|
-
/** Replicate-based lip-sync providers (video or image+audio via Replicate SDK)
|
|
1747
|
+
/** Replicate-based lip-sync providers (video or image+audio via Replicate SDK).
|
|
1748
|
+
* The retired ones ran there too (`RETIRED_LIP_SYNC_PROVIDERS`). */
|
|
1630
1749
|
export const REPLICATE_LIP_SYNC_PROVIDERS = new Set([
|
|
1631
1750
|
"latentsync",
|
|
1632
|
-
"wav2lip",
|
|
1633
|
-
"video-retalking",
|
|
1634
|
-
"sadtalker",
|
|
1635
1751
|
"heygen-lipsync-precision",
|
|
1636
1752
|
"lipsync-2-pro",
|
|
1637
1753
|
] as const)
|
|
@@ -1642,7 +1758,9 @@ export const FAL_LIP_SYNC_PROVIDERS = new Set([
|
|
|
1642
1758
|
"sync-lipsync-v3",
|
|
1643
1759
|
] as const)
|
|
1644
1760
|
|
|
1645
|
-
/** Lip-sync providers that require video input (not image)
|
|
1761
|
+
/** Lip-sync providers that require video input (not image). A retired id
|
|
1762
|
+
* stays in this set and the next: a saved node on it keeps the handles its
|
|
1763
|
+
* edges attach to until the person picks another model. */
|
|
1646
1764
|
export const VIDEO_INPUT_LIP_SYNC_PROVIDERS = new Set([
|
|
1647
1765
|
"latentsync",
|
|
1648
1766
|
"video-retalking",
|
|
@@ -1835,17 +1953,19 @@ void _TRANSCRIBE_PROVIDERS_ARE_LANES
|
|
|
1835
1953
|
|
|
1836
1954
|
/**
|
|
1837
1955
|
* The lanes Add Captions may transcribe on (its `transcribe_provider`, on the
|
|
1838
|
-
* route, MCP `add_captions` and the SDK's `media.addCaptions`).
|
|
1839
|
-
*
|
|
1840
|
-
*
|
|
1841
|
-
*
|
|
1842
|
-
*
|
|
1843
|
-
*
|
|
1956
|
+
* route, MCP `add_captions` and the SDK's `media.addCaptions`). Its flat render
|
|
1957
|
+
* price (`add-captions:kinetic`) covers the transcription on every lane but
|
|
1958
|
+
* Nemotron 3.5 Transcribe, which is priced by the video's length: a caption
|
|
1959
|
+
* run on it holds the render plus Nemotron's per-minute price as ONE charge
|
|
1960
|
+
* (`add-captions:kinetic:nemotron:<N>m`, decided 2026-11-13), always with word
|
|
1961
|
+
* timings and never a translation. A new lane here is a pricing decision, not
|
|
1962
|
+
* a sync.
|
|
1844
1963
|
*/
|
|
1845
1964
|
export const CAPTION_TRANSCRIBE_LANES = [
|
|
1846
1965
|
"whisper",
|
|
1847
1966
|
"incredibly-fast-whisper",
|
|
1848
1967
|
"elevenlabs-stt",
|
|
1968
|
+
"nemotron-3-5-transcribe",
|
|
1849
1969
|
] as const satisfies readonly TranscribeLane[]
|
|
1850
1970
|
export type CaptionTranscribeLane = typeof CAPTION_TRANSCRIBE_LANES[number]
|
|
1851
1971
|
|
|
@@ -2083,6 +2203,7 @@ export const IMAGE_MASK_MODE: Record<ImageGenProvider, ImageMaskMode> = {
|
|
|
2083
2203
|
"seedream-5-flash": "prompt",
|
|
2084
2204
|
"minimax-h3-image": "prompt",
|
|
2085
2205
|
"seedream-5-5": "prompt",
|
|
2206
|
+
"flux-3-klein": "prompt",
|
|
2086
2207
|
"qwen": "prompt",
|
|
2087
2208
|
"flux-kontext": "prompt",
|
|
2088
2209
|
"flux-kontext-max": "prompt",
|
|
@@ -2115,6 +2236,7 @@ export const SEED_SUPPORT = new Set([
|
|
|
2115
2236
|
"flux", "flux-flex", "flux-i2i", "flux-pro-i2i", "flux-kontext", "flux-kontext-max",
|
|
2116
2237
|
"flux-2-klein", "kontext-multi",
|
|
2117
2238
|
"minimax-h3-image", "minimax-h3-image-i2i",
|
|
2239
|
+
"flux-3-klein", "flux-3-klein-i2i",
|
|
2118
2240
|
])
|
|
2119
2241
|
|
|
2120
2242
|
/** Ideogram models that support rendering_speed selection (TURBO/BALANCED/QUALITY) */
|
|
@@ -4748,6 +4870,13 @@ export function preferredInputModeForModel(
|
|
|
4748
4870
|
|
|
4749
4871
|
export const DEFAULT_VIDEO_PROVIDER = "seedance-2-fast"
|
|
4750
4872
|
|
|
4873
|
+
/**
|
|
4874
|
+
* The model a legacy Image to Video / Text to Video node runs when it names
|
|
4875
|
+
* none: the workflow run's own default for those two (Generate Video's is
|
|
4876
|
+
* {@link DEFAULT_VIDEO_PROVIDER}, through {@link applyDefaultVideoSelection}).
|
|
4877
|
+
*/
|
|
4878
|
+
export const LEGACY_VIDEO_NODE_DEFAULT_PROVIDER = "kling"
|
|
4879
|
+
|
|
4751
4880
|
/**
|
|
4752
4881
|
* Duration paired with the default provider when BOTH provider and duration
|
|
4753
4882
|
* are omitted. Pins the nothing-specified request to the default model's
|
|
@@ -196,6 +196,9 @@ const QUALITY_MAP: Record<string, QualityMapping> = {
|
|
|
196
196
|
// low the cheapest, 1K (1.5K costs the same, and is the panel's to pick).
|
|
197
197
|
"seedream-5-5": { field: "resolution", values: { low: "1K", mid: SEEDREAM_5_5_DEFAULT_RESOLUTION, high: "2K" } },
|
|
198
198
|
"seedream-5-5-i2i": { field: "resolution", values: { low: "1K", mid: SEEDREAM_5_5_DEFAULT_RESOLUTION, high: "2K" } },
|
|
199
|
+
// FLUX 3 Klein: three sizes, 1K its default and cheapest (as GPT Image 2).
|
|
200
|
+
"flux-3-klein": { field: "resolution", values: { low: "1K", mid: "2K", high: "4K" } },
|
|
201
|
+
"flux-3-klein-i2i": { field: "resolution", values: { low: "1K", mid: "2K", high: "4K" } },
|
|
199
202
|
// Video gen — resolution-style (720p/1080p)
|
|
200
203
|
"veo3": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
|
201
204
|
"veo3.1": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
package/src/node-runtime-keys.ts
CHANGED
|
@@ -55,6 +55,9 @@ export const EXECUTION_DATA_KEYS: ReadonlySet<string> = new Set([
|
|
|
55
55
|
"generatedResults",
|
|
56
56
|
"activeResultIndex",
|
|
57
57
|
"sourceImageUrl",
|
|
58
|
+
// An Extend / Upscale Video node's own run's output task — what a VEO or
|
|
59
|
+
// Runway extend after it continues (its `kieTaskId` is the task it works on).
|
|
60
|
+
"outputKieTaskId",
|
|
58
61
|
"__listTotal",
|
|
59
62
|
"__listCompleted",
|
|
60
63
|
"__listResults",
|
|
@@ -18,11 +18,23 @@
|
|
|
18
18
|
* rejecting it, so the user sees a valid value on the canvas rather than a
|
|
19
19
|
* failed run. It reads exclusively from `MODEL_CATALOG`, so a model added later
|
|
20
20
|
* is covered without touching this file.
|
|
21
|
+
*
|
|
22
|
+
* Besides the image trio below, it holds three single levers: a Video Upscale
|
|
23
|
+
* node's `targetResolution`, a Motion Transfer node's `resolution`, and a
|
|
24
|
+
* video node's stored Seedance reference task type (`referenceTaskType`,
|
|
25
|
+
* removed where no model the node runs lists it).
|
|
21
26
|
*/
|
|
22
27
|
|
|
23
|
-
import { autoAspectNeedsSourceImage, normalizeModelInput, type ModelInputAdjustment } from "./model-catalog.js"
|
|
28
|
+
import { autoAspectNeedsSourceImage, MODEL_CATALOG, normalizeModelInput, type ModelInputAdjustment, type ModelInputAdjustmentField } from "./model-catalog.js"
|
|
24
29
|
import { imageGenAutoAspectNeedsSourceImage, motionTransferResolution } from "./credit-identifiers.js"
|
|
25
30
|
import { normalizeVideoUpscaleResolution, VIDEO_UPSCALE_RESOLUTIONS, videoUpscaleResolutionsFor } from "./video-upscale-params.js"
|
|
31
|
+
import {
|
|
32
|
+
applyDefaultVideoSelection,
|
|
33
|
+
DEFAULT_VIDEO_TO_VIDEO_PROVIDER,
|
|
34
|
+
LEGACY_VIDEO_NODE_DEFAULT_PROVIDER,
|
|
35
|
+
listedSeedanceTaskType,
|
|
36
|
+
resolveVideoProviderForMode,
|
|
37
|
+
} from "./model-constants.js"
|
|
26
38
|
|
|
27
39
|
/**
|
|
28
40
|
* Node types whose `data` carries catalog-governed model parameters under the
|
|
@@ -105,7 +117,9 @@ export function nodeAspectRatio(nodeType: string | undefined, aspectRatio: unkno
|
|
|
105
117
|
return nodeType !== undefined && PHOTO_AUTO_ASPECT_NODE_TYPES.has(nodeType) ? "auto" : undefined
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
export interface NodeParamAdjustment extends ModelInputAdjustment {
|
|
120
|
+
export interface NodeParamAdjustment extends Omit<ModelInputAdjustment, "field"> {
|
|
121
|
+
/** A catalog-governed parameter, or a video node's stored `referenceTaskType` (always removed: `to` is undefined). */
|
|
122
|
+
field: ModelInputAdjustmentField | "referenceTaskType"
|
|
109
123
|
nodeId: string
|
|
110
124
|
provider: string
|
|
111
125
|
}
|
|
@@ -143,6 +157,8 @@ export function normalizeNodeModelParams<T extends NodeLike>(
|
|
|
143
157
|
const type = typeof node.type === "string" ? node.type : ""
|
|
144
158
|
if (type === "video-upscale") return normalizeVideoUpscaleNode(node, adjustments)
|
|
145
159
|
if (type === "motion-transfer") return normalizeMotionTransferNode(node, adjustments)
|
|
160
|
+
// The stored reference task type: the one rule every workflow write runs.
|
|
161
|
+
if (REFERENCE_TASK_TYPE_NODE_MODES.has(type)) return withListedReferenceTaskTypes([node], adjustments)[0]!
|
|
146
162
|
if (!MODEL_PARAM_NODE_TYPES.has(type)) return node
|
|
147
163
|
|
|
148
164
|
const data = node.data
|
|
@@ -247,6 +263,111 @@ function normalizeMotionTransferNode<T extends NodeLike>(node: T, adjustments: N
|
|
|
247
263
|
return { ...node, data: { ...d, resolution: sized.resolution } }
|
|
248
264
|
}
|
|
249
265
|
|
|
266
|
+
/** A video run's mode: the twin of an aliased model it sends to (`resolveVideoProviderForMode`). */
|
|
267
|
+
type VideoRunMode = "image-to-video" | "text-to-video"
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* The video node types that store a Seedance reference task type
|
|
271
|
+
* (`referenceTaskType`, "Use the reference video as"), each with the modes its
|
|
272
|
+
* run sends a model in: Generate Video either (the wiring picks), Image to
|
|
273
|
+
* Video and Text to Video their own, Video to Video none (its model's own id;
|
|
274
|
+
* its run is an edit whatever is stored).
|
|
275
|
+
*/
|
|
276
|
+
const REFERENCE_TASK_TYPE_NODE_MODES: ReadonlyMap<string, readonly VideoRunMode[]> = new Map([
|
|
277
|
+
["generate-video", ["image-to-video", "text-to-video"]],
|
|
278
|
+
["image-to-video", ["image-to-video"]],
|
|
279
|
+
["text-to-video", ["text-to-video"]],
|
|
280
|
+
["video-to-video", []],
|
|
281
|
+
])
|
|
282
|
+
|
|
283
|
+
const namedModel = (v: unknown): string | undefined => (typeof v === "string" && v !== "" ? v : undefined)
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The models a video node's run uses: each entry of a Provider list
|
|
287
|
+
* (`data.providers`, two or more, each run on its own), else its one model —
|
|
288
|
+
* the run's own default when it names none (Generate Video's
|
|
289
|
+
* `applyDefaultVideoSelection`, the legacy Image / Text to Video default, Video
|
|
290
|
+
* to Video's).
|
|
291
|
+
*/
|
|
292
|
+
function videoRunModels(type: string, d: Record<string, unknown>): string[] {
|
|
293
|
+
const list = Array.isArray(d.providers) ? d.providers.flatMap((p) => namedModel(p) ?? []) : []
|
|
294
|
+
if (list.length >= 2) return list
|
|
295
|
+
const named = namedModel(d.provider)
|
|
296
|
+
if (type === "generate-video") return [applyDefaultVideoSelection({ provider: named }).provider]
|
|
297
|
+
return [named ?? (type === "video-to-video" ? DEFAULT_VIDEO_TO_VIDEO_PROVIDER : LEGACY_VIDEO_NODE_DEFAULT_PROVIDER)]
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* A video node's stored reference task type (decided 2026-11-13): kept, the
|
|
302
|
+
* node returned as it came, while a model its run sends to lists the value
|
|
303
|
+
* (`listedSeedanceTaskType`, the one membership test the run itself asks —
|
|
304
|
+
* matched exactly, read from `MODEL_CATALOG[id].referenceTaskTypes`);
|
|
305
|
+
* otherwise the key is REMOVED (absent is Auto, the setting's own meaning).
|
|
306
|
+
* A run already ignores such a value, so nothing a run sends or is charged
|
|
307
|
+
* changes; what changes is that it can no longer ride hidden on a model that
|
|
308
|
+
* ignores it and come back when the node is later switched to one that reads
|
|
309
|
+
* it. `auto`, a wrong case, a number and every value no model lists are
|
|
310
|
+
* removed on every model. A node storing no value is returned as it came.
|
|
311
|
+
*/
|
|
312
|
+
function normalizeReferenceTaskTypeNode<T extends NodeLike>(node: T, type: string, adjustments: NodeParamAdjustment[]): T {
|
|
313
|
+
const data = node.data
|
|
314
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return node
|
|
315
|
+
const d = data as Record<string, unknown>
|
|
316
|
+
const value = d.referenceTaskType
|
|
317
|
+
// Unset (absent, or an in-memory `undefined` the editor writes for Auto): nothing to judge.
|
|
318
|
+
if (value === undefined) return node
|
|
319
|
+
const modes = REFERENCE_TASK_TYPE_NODE_MODES.get(type) ?? []
|
|
320
|
+
const models = videoRunModels(type, d)
|
|
321
|
+
const sentTo = models.flatMap((m) => [m, ...modes.map((mode) => resolveVideoProviderForMode(m, mode))])
|
|
322
|
+
if (sentTo.some((m) => listedSeedanceTaskType(m, value) !== undefined)) return node
|
|
323
|
+
|
|
324
|
+
const listedAnywhere = Object.values(MODEL_CATALOG).some((m) => m.referenceTaskTypes?.some((t) => t === value))
|
|
325
|
+
const label = MODEL_CATALOG[models[0]!]?.label ?? models[0]!
|
|
326
|
+
const reason = listedAnywhere
|
|
327
|
+
? `${label} does not take the reference task type "${String(value)}": removed, so the run declares none (Auto).`
|
|
328
|
+
: `"${String(value)}" is not a reference task type a model takes (reference, edit or extend): removed — Auto is the setting left unset.`
|
|
329
|
+
const nodeId = typeof node.id === "string" ? node.id : "(unknown node)"
|
|
330
|
+
adjustments.push({ field: "referenceTaskType", from: typeof value === "number" ? value : String(value), to: undefined, reason, nodeId, provider: models[0]! })
|
|
331
|
+
const { referenceTaskType: _removed, ...rest } = d
|
|
332
|
+
return { ...node, data: rest }
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* A workflow graph's nodes with every stored Seedance reference task type held
|
|
337
|
+
* to the models its node runs (decided 2026-11-13) — the ONE rule for that
|
|
338
|
+
* field, which {@link normalizeNodeModelParams} runs too: on a Generate Video,
|
|
339
|
+
* Image to Video, Text to Video or Video to Video node, a `referenceTaskType`
|
|
340
|
+
* no model the node runs lists (and `auto`, or any value no model lists) is
|
|
341
|
+
* removed; nothing else on any node is touched.
|
|
342
|
+
*
|
|
343
|
+
* Every path that stores a workflow graph runs it: the editor's saves, the
|
|
344
|
+
* REST and MCP writes, imports, copies, template clones and the published
|
|
345
|
+
* snapshots. So a value can never sit unused on a model that ignores it and
|
|
346
|
+
* take effect when the node is later switched to one that reads it.
|
|
347
|
+
*
|
|
348
|
+
* Takes the stored value as it comes (`nodes` may be any JSON): anything that
|
|
349
|
+
* is not an array is returned as it came. The SAME array is returned when no
|
|
350
|
+
* node changes, and an unchanged node keeps its reference, so a graph without
|
|
351
|
+
* such a value is written byte for byte as before.
|
|
352
|
+
*
|
|
353
|
+
* @param adjustments told each removal (what `normalizeNodeModelParams` reports).
|
|
354
|
+
*/
|
|
355
|
+
export function withListedReferenceTaskTypes<N>(nodes: N, adjustments?: NodeParamAdjustment[]): N {
|
|
356
|
+
if (!Array.isArray(nodes)) return nodes
|
|
357
|
+
const sink = adjustments ?? []
|
|
358
|
+
let changed = false
|
|
359
|
+
const out = (nodes as unknown[]).map((node) => {
|
|
360
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return node
|
|
361
|
+
const n = node as NodeLike
|
|
362
|
+
const type = typeof n.type === "string" ? n.type : ""
|
|
363
|
+
if (!REFERENCE_TASK_TYPE_NODE_MODES.has(type)) return node
|
|
364
|
+
const next = normalizeReferenceTaskTypeNode(n, type, sink)
|
|
365
|
+
if (next !== n) changed = true
|
|
366
|
+
return next
|
|
367
|
+
})
|
|
368
|
+
return (changed ? out : nodes) as N
|
|
369
|
+
}
|
|
370
|
+
|
|
250
371
|
/** One-line-per-change summary, for surfacing back to an agent or a log. */
|
|
251
372
|
export function describeNodeAdjustments(adjustments: readonly NodeParamAdjustment[]): string[] {
|
|
252
373
|
return adjustments.map(
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seedance 2.5 Extend's price rows — part of the public credit-id contract:
|
|
3
|
+
* the rows a run is charged a multiple of, and so the ids a client names to
|
|
4
|
+
* ask what a run costs (`tailExtendCreditId`, `credit-identifiers.ts`).
|
|
5
|
+
*
|
|
6
|
+
* A Seedance 2.5 Extend run sends the source's last
|
|
7
|
+
* {@link SEEDANCE_EXTEND_CONTEXT_MAX_SEC} seconds (all of a shorter source)
|
|
8
|
+
* and is charged per second sent and added. A per-second price is not a
|
|
9
|
+
* whole credit, so each resolution's row is the price of
|
|
10
|
+
* {@link SEEDANCE_EXTEND_RATE_SECONDS} seconds, and a run is that row × (seconds
|
|
11
|
+
* sent + seconds added) ÷ 2, rounded up once.
|
|
12
|
+
*
|
|
13
|
+
* The seconds rule lives here too (decided 2026-11-13), so a client prices a
|
|
14
|
+
* run on a known source by the same rule the server charges it by
|
|
15
|
+
* (`seedanceExtendSourceCreditId`, credit-identifiers.ts): how many seconds of
|
|
16
|
+
* the source are sent ({@link seedanceExtendSentSec}, a picture's length read
|
|
17
|
+
* by the container-overhang rule), how many are added
|
|
18
|
+
* ({@link seedanceExtendAddedSec}) and the units of a rate row they make
|
|
19
|
+
* ({@link seedanceExtendUnits}). `@nodaro/render-rules`
|
|
20
|
+
* (`seedance-extend-pricing.ts`) and the backend read them from here.
|
|
21
|
+
*/
|
|
22
|
+
import { MODEL_CATALOG } from "./model-catalog.js"
|
|
23
|
+
import { pricedOutputDurationSec, SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC, type SeedanceExtendProvider, type TailExtendProvider } from "./model-constants.js"
|
|
24
|
+
import { CONTAINER_OVERHANG_SEC } from "./video-duration.js"
|
|
25
|
+
|
|
26
|
+
/** The Extend Video provider priced by the seconds it sends. */
|
|
27
|
+
export const SEEDANCE_EXTEND_SENT_PRICED_PROVIDER = "seedance-2-5-extend" satisfies SeedanceExtendProvider
|
|
28
|
+
|
|
29
|
+
/** The Extend Video provider priced by the seconds it sends. */
|
|
30
|
+
export type SentPricedSeedanceExtendProvider = typeof SEEDANCE_EXTEND_SENT_PRICED_PROVIDER
|
|
31
|
+
|
|
32
|
+
/** The most of the source's end a run sends as `@video_1`, in seconds. */
|
|
33
|
+
export const SEEDANCE_EXTEND_CONTEXT_MAX_SEC = 10
|
|
34
|
+
|
|
35
|
+
/** The seconds one rate row prices. */
|
|
36
|
+
export const SEEDANCE_EXTEND_RATE_SECONDS = 2
|
|
37
|
+
|
|
38
|
+
/** The rate row of each resolution: the price of {@link SEEDANCE_EXTEND_RATE_SECONDS} seconds. */
|
|
39
|
+
export const SEEDANCE_EXTEND_RATE_CREDIT_IDS: Readonly<Record<"480p" | "720p" | "1080p", string>> = {
|
|
40
|
+
"480p": "seedance-2-5-extend:480p:per-2s",
|
|
41
|
+
"720p": "seedance-2-5-extend:720p:per-2s",
|
|
42
|
+
"1080p": "seedance-2-5-extend:1080p:per-2s",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Is `provider` the Extend Video provider priced by the seconds it sends? A retired id answers false: pass it through `canonicalVideoProvider` first. */
|
|
46
|
+
export function isSeedanceExtendPricedBySecondsSent(provider: unknown): provider is SentPricedSeedanceExtendProvider {
|
|
47
|
+
return provider === SEEDANCE_EXTEND_SENT_PRICED_PROVIDER
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Is `id` one of the rate rows? */
|
|
51
|
+
export function isSeedanceExtendRateCreditId(id: unknown): boolean {
|
|
52
|
+
return typeof id === "string" && (Object.values(SEEDANCE_EXTEND_RATE_CREDIT_IDS) as string[]).includes(id)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The seconds a tail-recipe extend run (Seedance 2.5 / 2.0, Kling 4) adds for a requested `duration`: the
|
|
57
|
+
* seconds its price counts (`pricedOutputDurationSec`, the provider's catalog
|
|
58
|
+
* default when unset or unreadable), held in the provider's catalog window.
|
|
59
|
+
* The one reading of the length: the route queues it, the worker generates
|
|
60
|
+
* it, and every price and quote counts it.
|
|
61
|
+
*/
|
|
62
|
+
export function seedanceExtendAddedSec(provider: TailExtendProvider, duration: unknown): number {
|
|
63
|
+
const requested = typeof duration === "number" || typeof duration === "string" ? duration : undefined
|
|
64
|
+
const offered = MODEL_CATALOG[provider]?.durations ?? []
|
|
65
|
+
const min = offered.length > 0 ? Math.min(...offered) : 1
|
|
66
|
+
const max = offered.length > 0 ? Math.max(...offered) : Number.POSITIVE_INFINITY
|
|
67
|
+
return Math.min(max, Math.max(min, Math.round(pricedOutputDurationSec(provider, requested))))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A length the source gives, when it is one: finite and above 0. */
|
|
71
|
+
function knownSec(sec: number | null | undefined): number | undefined {
|
|
72
|
+
return typeof sec === "number" && Number.isFinite(sec) && sec > 0 ? sec : undefined
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A picture's measured length as the seconds it is charged as — the
|
|
77
|
+
* platform's container-overhang rule: at most `CONTAINER_OVERHANG_SEC` (a
|
|
78
|
+
* quarter second) past a whole second is that whole second (8.04 s is 8 s,
|
|
79
|
+
* 8.25 s is 8 s); anything else is exactly as measured (8.3 s is 8.3 s).
|
|
80
|
+
* Under a second there is no whole second to read it as.
|
|
81
|
+
*/
|
|
82
|
+
export function seedanceExtendSourceSec(pictureSec: number): number {
|
|
83
|
+
const whole = Math.floor(pictureSec)
|
|
84
|
+
return whole >= 1 && pictureSec - whole <= CONTAINER_OVERHANG_SEC ? whole : pictureSec
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The seconds of the source a run is charged for sending: its last
|
|
89
|
+
* {@link SEEDANCE_EXTEND_CONTEXT_MAX_SEC}, or all of a shorter source, its
|
|
90
|
+
* picture's length read by the container-overhang rule
|
|
91
|
+
* ({@link seedanceExtendSourceSec}). A source whose length is not known (a
|
|
92
|
+
* quote before the upstream video exists, or a length that is not a positive
|
|
93
|
+
* finite number) counts the whole window: the most a run sends.
|
|
94
|
+
*/
|
|
95
|
+
export function seedanceExtendSentSec(sourcePictureSec: number | null | undefined): number {
|
|
96
|
+
const known = knownSec(sourcePictureSec)
|
|
97
|
+
return known === undefined ? SEEDANCE_EXTEND_CONTEXT_MAX_SEC : Math.min(SEEDANCE_EXTEND_CONTEXT_MAX_SEC, seedanceExtendSourceSec(known))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Whether a Seedance Extend run refuses a source of this measured picture
|
|
102
|
+
* length: a known length (positive, finite) under the shortest source the
|
|
103
|
+
* extend takes, `SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC`, compared as measured, as
|
|
104
|
+
* the route refuses it before anything is reserved and the worker before it
|
|
105
|
+
* generates. A length that is not known is never refused here (the run
|
|
106
|
+
* measures the source itself).
|
|
107
|
+
*/
|
|
108
|
+
export function seedanceExtendRefusesSource(sourcePictureSec: number | null | undefined): boolean {
|
|
109
|
+
const known = knownSec(sourcePictureSec)
|
|
110
|
+
return known !== undefined && known < SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The units of a rate row a run that sends `sentSec` and adds `addedSec` is charged. */
|
|
114
|
+
export function seedanceExtendUnits(sentSec: number, addedSec: number): number {
|
|
115
|
+
return (sentSec + addedSec) / SEEDANCE_EXTEND_RATE_SECONDS
|
|
116
|
+
}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
/** Public workflow capability marker; creative planning stays in the Studio codec. */
|
|
2
2
|
export const STUDIO_DEPENDENT_FRAMES_CAPABILITY = "studio-dependent-frames-v1"
|
|
3
3
|
|
|
4
|
+
const record = (value: unknown): Record<string, unknown> =>
|
|
5
|
+
value && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : {}
|
|
6
|
+
const declaresDependentFrames = (data: Record<string, unknown>): boolean =>
|
|
7
|
+
Array.isArray(data.requiredCapabilities) && data.requiredCapabilities.includes(STUDIO_DEPENDENT_FRAMES_CAPABILITY)
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Whether a workflow document is one a server codec owns (Studio): the TS
|
|
11
|
+
* mirror of the database's `workflow_requires_compatible_writer`, whose write
|
|
12
|
+
* guard refuses any change to such a document by any writer but the codec's.
|
|
13
|
+
* Recognized even when a writer omitted the declaration: a Studio settings
|
|
14
|
+
* block holding keyframes, sequences or settled jobs, or declaring dependent
|
|
15
|
+
* frames, or any node carrying `keyframeId`, `sequenceBinding` or that
|
|
16
|
+
* declaration. The one predicate the server's routes and the editor ask.
|
|
17
|
+
*/
|
|
18
|
+
export function isCodecOwnedDocument(nodes: unknown, settings: unknown): boolean {
|
|
19
|
+
const studio = record(record(settings).studio)
|
|
20
|
+
return ["keyframes", "sequences", "settledJobIds"].some((key) => Object.hasOwn(studio, key))
|
|
21
|
+
|| declaresDependentFrames(studio)
|
|
22
|
+
|| (Array.isArray(nodes) && nodes.some((node) => {
|
|
23
|
+
const data = record(record(node).data)
|
|
24
|
+
return Object.hasOwn(data, "keyframeId") || Object.hasOwn(data, "sequenceBinding") || declaresDependentFrames(data)
|
|
25
|
+
}))
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
export class SequenceExecutionRequiredError extends Error {
|
|
5
29
|
readonly code = "sequence_execution_required"
|
|
6
30
|
readonly statusCode = 400
|