@nodaro/shared 3.31.0 → 3.33.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/README.md +17 -0
- package/dist/chunk-23FJQTEA.js +1604 -0
- package/dist/chunk-23FJQTEA.js.map +1 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2NQLSLSN.cjs +19 -0
- package/dist/chunk-2NQLSLSN.cjs.map +1 -0
- package/dist/chunk-2OJIVO7R.cjs +32 -0
- package/dist/chunk-2OJIVO7R.cjs.map +1 -0
- package/dist/chunk-2RF4Z7KG.cjs +803 -0
- package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
- package/dist/chunk-3RYKIUAE.js +86 -0
- package/dist/chunk-3RYKIUAE.js.map +1 -0
- package/dist/chunk-44I73CQS.cjs +194 -0
- package/dist/chunk-44I73CQS.cjs.map +1 -0
- package/dist/chunk-5PC6JBGJ.cjs +1419 -0
- package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
- package/dist/chunk-5RU2HCW2.js +30 -0
- package/dist/chunk-5RU2HCW2.js.map +1 -0
- package/dist/chunk-5RYLK3MQ.js +267 -0
- package/dist/chunk-5RYLK3MQ.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6WZ2VN7V.js +920 -0
- package/dist/chunk-6WZ2VN7V.js.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-7Z5LUTGU.js +1567 -0
- package/dist/chunk-7Z5LUTGU.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-BG5D5CZ6.js +1922 -0
- package/dist/chunk-BG5D5CZ6.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-CUH22J4D.js +17 -0
- package/dist/chunk-CUH22J4D.js.map +1 -0
- package/dist/chunk-D26ENTN2.cjs +1770 -0
- package/dist/chunk-D26ENTN2.cjs.map +1 -0
- package/dist/chunk-D6GNRSCV.cjs +2017 -0
- package/dist/chunk-D6GNRSCV.cjs.map +1 -0
- package/dist/chunk-FBV5DF6D.js +95 -0
- package/dist/chunk-FBV5DF6D.js.map +1 -0
- package/dist/chunk-FG4E7MTG.cjs +4 -0
- package/dist/chunk-FG4E7MTG.cjs.map +1 -0
- package/dist/chunk-FT5CF6IA.js +42 -0
- package/dist/chunk-FT5CF6IA.js.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HC7VKIV5.cjs +430 -0
- package/dist/chunk-HC7VKIV5.cjs.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HKFMXNVQ.cjs +1273 -0
- package/dist/chunk-HKFMXNVQ.cjs.map +1 -0
- package/dist/chunk-HRXEZ3SX.cjs +526 -0
- package/dist/chunk-HRXEZ3SX.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-HUR6ZJ7S.cjs +159 -0
- package/dist/chunk-HUR6ZJ7S.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JFS3NWZ5.cjs +1714 -0
- package/dist/chunk-JFS3NWZ5.cjs.map +1 -0
- package/dist/chunk-JL4C5VJ7.cjs +488 -0
- package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
- package/dist/chunk-JSGIEF6Z.cjs +1087 -0
- package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
- package/dist/chunk-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-K3LLGRK7.cjs +3545 -0
- package/dist/chunk-K3LLGRK7.cjs.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-M7GQBRZU.cjs +1963 -0
- package/dist/chunk-M7GQBRZU.cjs.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-OTATNBMD.js +141 -0
- package/dist/chunk-OTATNBMD.js.map +1 -0
- package/dist/chunk-OZSACQ2V.js +471 -0
- package/dist/chunk-OZSACQ2V.js.map +1 -0
- package/dist/chunk-PHZ23DP3.js +1782 -0
- package/dist/chunk-PHZ23DP3.js.map +1 -0
- package/dist/chunk-PQHS255G.js +1369 -0
- package/dist/chunk-PQHS255G.js.map +1 -0
- package/dist/chunk-PRYE7AZQ.cjs +1227 -0
- package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
- package/dist/chunk-PVJBAPYJ.js +404 -0
- package/dist/chunk-PVJBAPYJ.js.map +1 -0
- package/dist/chunk-PXFQVLBX.js +776 -0
- package/dist/chunk-PXFQVLBX.js.map +1 -0
- package/dist/chunk-QA3MVQ32.js +21 -0
- package/dist/chunk-QA3MVQ32.js.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-SAW5OK36.cjs +54 -0
- package/dist/chunk-SAW5OK36.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-SFW3UB2P.js +31 -0
- package/dist/chunk-SFW3UB2P.js.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TU33KYKW.cjs +25 -0
- package/dist/chunk-TU33KYKW.cjs.map +1 -0
- package/dist/chunk-TZBIY5C3.js +187 -0
- package/dist/chunk-TZBIY5C3.js.map +1 -0
- package/dist/chunk-TZE673G6.js +3 -0
- package/dist/chunk-TZE673G6.js.map +1 -0
- package/dist/chunk-UCFWI6D4.js +29 -0
- package/dist/chunk-UCFWI6D4.js.map +1 -0
- package/dist/chunk-UTQSSKSG.js +1164 -0
- package/dist/chunk-UTQSSKSG.js.map +1 -0
- package/dist/chunk-VA42637J.cjs +287 -0
- package/dist/chunk-VA42637J.cjs.map +1 -0
- package/dist/chunk-VNQRI2RO.cjs +1047 -0
- package/dist/chunk-VNQRI2RO.cjs.map +1 -0
- package/dist/chunk-VXPLKQWY.cjs +821 -0
- package/dist/chunk-VXPLKQWY.cjs.map +1 -0
- package/dist/chunk-WD6HJRBG.cjs +197 -0
- package/dist/chunk-WD6HJRBG.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WKOIGLQX.cjs +38 -0
- package/dist/chunk-WKOIGLQX.cjs.map +1 -0
- package/dist/chunk-WNVQ3SMB.cjs +96 -0
- package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
- package/dist/chunk-WRSWH7US.cjs +285 -0
- package/dist/chunk-WRSWH7US.cjs.map +1 -0
- package/dist/chunk-XGFTL5XY.js +181 -0
- package/dist/chunk-XGFTL5XY.js.map +1 -0
- package/dist/chunk-XNISPHTZ.js +1039 -0
- package/dist/chunk-XNISPHTZ.js.map +1 -0
- package/dist/chunk-Y2PM3FFL.js +3 -0
- package/dist/chunk-Y2PM3FFL.js.map +1 -0
- package/dist/chunk-YBPBK5KI.js +1030 -0
- package/dist/chunk-YBPBK5KI.js.map +1 -0
- package/dist/chunk-YWNYGYI7.cjs +31 -0
- package/dist/chunk-YWNYGYI7.cjs.map +1 -0
- package/dist/chunk-YYV35XOS.js +122 -0
- package/dist/chunk-YYV35XOS.js.map +1 -0
- package/dist/chunk-Z2OL5AJD.cjs +133 -0
- package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
- package/dist/chunk-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZL7UM6PU.cjs +34 -0
- package/dist/chunk-ZL7UM6PU.cjs.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZO5PBBFX.js +3497 -0
- package/dist/chunk-ZO5PBBFX.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +292 -0
- package/dist/entries/apps.d.ts +292 -0
- package/dist/entries/apps.js +10 -0
- package/dist/entries/apps.js.map +1 -0
- package/dist/entries/captions.cjs +124 -0
- package/dist/entries/captions.cjs.map +1 -0
- package/dist/entries/captions.d.cts +354 -0
- package/dist/entries/captions.d.ts +354 -0
- package/dist/entries/captions.js +3 -0
- package/dist/entries/captions.js.map +1 -0
- package/dist/entries/catalogs.cjs +165 -0
- package/dist/entries/catalogs.cjs.map +1 -0
- package/dist/entries/catalogs.d.cts +385 -0
- package/dist/entries/catalogs.d.ts +385 -0
- package/dist/entries/catalogs.js +4 -0
- package/dist/entries/catalogs.js.map +1 -0
- package/dist/entries/credits.cjs +596 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1460 -0
- package/dist/entries/credits.d.ts +1460 -0
- package/dist/entries/credits.js +11 -0
- package/dist/entries/credits.js.map +1 -0
- package/dist/entries/edl.cjs +409 -0
- package/dist/entries/edl.cjs.map +1 -0
- package/dist/entries/edl.d.cts +1199 -0
- package/dist/entries/edl.d.ts +1199 -0
- package/dist/entries/edl.js +4 -0
- package/dist/entries/edl.js.map +1 -0
- package/dist/entries/entities.cjs +530 -0
- package/dist/entries/entities.cjs.map +1 -0
- package/dist/entries/entities.d.cts +1371 -0
- package/dist/entries/entities.d.ts +1371 -0
- package/dist/entries/entities.js +5 -0
- package/dist/entries/entities.js.map +1 -0
- package/dist/entries/i18n.cjs +48 -0
- package/dist/entries/i18n.cjs.map +1 -0
- package/dist/entries/i18n.d.cts +69 -0
- package/dist/entries/i18n.d.ts +69 -0
- package/dist/entries/i18n.js +3 -0
- package/dist/entries/i18n.js.map +1 -0
- package/dist/entries/llm-models.cjs +177 -0
- package/dist/entries/llm-models.cjs.map +1 -0
- package/dist/entries/llm-models.d.cts +435 -0
- package/dist/entries/llm-models.d.ts +435 -0
- package/dist/entries/llm-models.js +4 -0
- package/dist/entries/llm-models.js.map +1 -0
- package/dist/entries/media.cjs +335 -0
- package/dist/entries/media.cjs.map +1 -0
- package/dist/entries/media.d.cts +518 -0
- package/dist/entries/media.d.ts +518 -0
- package/dist/entries/media.js +6 -0
- package/dist/entries/media.js.map +1 -0
- package/dist/entries/model-catalog.cjs +259 -0
- package/dist/entries/model-catalog.cjs.map +1 -0
- package/dist/entries/model-catalog.d.cts +202 -0
- package/dist/entries/model-catalog.d.ts +202 -0
- package/dist/entries/model-catalog.js +6 -0
- package/dist/entries/model-catalog.js.map +1 -0
- package/dist/entries/models.cjs +833 -0
- package/dist/entries/models.cjs.map +1 -0
- package/dist/entries/models.d.cts +287 -0
- package/dist/entries/models.d.ts +287 -0
- package/dist/entries/models.js +8 -0
- package/dist/entries/models.js.map +1 -0
- package/dist/entries/nodes.cjs +789 -0
- package/dist/entries/nodes.cjs.map +1 -0
- package/dist/entries/nodes.d.cts +1600 -0
- package/dist/entries/nodes.d.ts +1600 -0
- package/dist/entries/nodes.js +16 -0
- package/dist/entries/nodes.js.map +1 -0
- package/dist/entries/organizations.cjs +80 -0
- package/dist/entries/organizations.cjs.map +1 -0
- package/dist/entries/organizations.d.cts +466 -0
- package/dist/entries/organizations.d.ts +466 -0
- package/dist/entries/organizations.js +3 -0
- package/dist/entries/organizations.js.map +1 -0
- package/dist/entries/pipeline.cjs +594 -0
- package/dist/entries/pipeline.cjs.map +1 -0
- package/dist/entries/pipeline.d.cts +2617 -0
- package/dist/entries/pipeline.d.ts +2617 -0
- package/dist/entries/pipeline.js +5 -0
- package/dist/entries/pipeline.js.map +1 -0
- package/dist/entries/scene3d.cjs +704 -0
- package/dist/entries/scene3d.cjs.map +1 -0
- package/dist/entries/scene3d.d.cts +4284 -0
- package/dist/entries/scene3d.d.ts +4284 -0
- package/dist/entries/scene3d.js +3 -0
- package/dist/entries/scene3d.js.map +1 -0
- package/dist/entries/social.cjs +714 -0
- package/dist/entries/social.cjs.map +1 -0
- package/dist/entries/social.d.cts +1366 -0
- package/dist/entries/social.d.ts +1366 -0
- package/dist/entries/social.js +5 -0
- package/dist/entries/social.js.map +1 -0
- package/dist/entries/types.cjs +13 -0
- package/dist/entries/types.cjs.map +1 -0
- package/dist/entries/types.d.cts +162 -0
- package/dist/entries/types.d.ts +162 -0
- package/dist/entries/types.js +4 -0
- package/dist/entries/types.js.map +1 -0
- package/dist/entries/ugc.cjs +279 -0
- package/dist/entries/ugc.cjs.map +1 -0
- package/dist/entries/ugc.d.cts +575 -0
- package/dist/entries/ugc.d.ts +575 -0
- package/dist/entries/ugc.js +6 -0
- package/dist/entries/ugc.js.map +1 -0
- package/dist/entries/video.cjs +549 -0
- package/dist/entries/video.cjs.map +1 -0
- package/dist/entries/video.d.cts +1791 -0
- package/dist/entries/video.d.ts +1791 -0
- package/dist/entries/video.js +8 -0
- package/dist/entries/video.js.map +1 -0
- package/dist/entries/workflow.cjs +574 -0
- package/dist/entries/workflow.cjs.map +1 -0
- package/dist/entries/workflow.d.cts +1743 -0
- package/dist/entries/workflow.d.ts +1743 -0
- package/dist/entries/workflow.js +5 -0
- package/dist/entries/workflow.js.map +1 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
- package/dist/index.cjs +7747 -27084
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -24198
- package/dist/index.d.ts +32 -24198
- package/dist/index.js +40 -25220
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-V-ZNzRSd.d.cts +651 -0
- package/dist/model-catalog-V-ZNzRSd.d.ts +651 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-D0kxsWf9.d.cts +92 -0
- package/dist/presentation-utils-pZwlEAzo.d.ts +92 -0
- package/dist/scene-node-types-C3kl_zyK.d.cts +1949 -0
- package/dist/scene-node-types-C3kl_zyK.d.ts +1949 -0
- package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
- package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
- package/dist/types-BRlFPEru.d.cts +511 -0
- package/dist/types-BRlFPEru.d.ts +511 -0
- package/dist/types-DffyGSy5.d.cts +67 -0
- package/dist/types-DffyGSy5.d.ts +67 -0
- package/package.json +102 -1
- package/src/__tests__/add-captions-plan.test.ts +6 -2
- package/src/__tests__/caption-edge-dash.test.ts +23 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/model-makers.test.ts +76 -0
- package/src/__tests__/no-internal-imports.test.ts +1 -1
- package/src/__tests__/node-aspect-ratio.test.ts +25 -0
- package/src/__tests__/node-runtime-keys.test.ts +9 -0
- package/src/__tests__/package-entries.test.ts +50 -0
- package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
- package/src/__tests__/presentation-utils.test.ts +15 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/private-host.test.ts +53 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +9 -3
- package/src/__tests__/ugc-run-state.test.ts +5 -4
- package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
- package/src/__tests__/video-analysis-pricing.test.ts +6 -6
- package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
- package/src/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/component-types.ts +9 -0
- package/src/credit-estimators/index.ts +22 -1
- package/src/credit-estimators/pitch-tempo.ts +15 -1
- package/src/credit-estimators/speech.ts +72 -4
- package/src/credit-estimators/unit-quote.ts +52 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
- package/src/credit-identifiers.ts +62 -17
- package/src/entity-image-handle.ts +2 -0
- package/src/entries/apps.ts +63 -0
- package/src/entries/captions.ts +34 -0
- package/src/entries/catalogs.ts +65 -0
- package/src/entries/credits.ts +105 -0
- package/src/entries/edl.ts +42 -0
- package/src/entries/entities.ts +144 -0
- package/src/entries/i18n.ts +31 -0
- package/src/entries/llm-models.ts +63 -0
- package/src/entries/media.ts +36 -0
- package/src/entries/model-catalog.ts +95 -0
- package/src/entries/models.ts +266 -0
- package/src/entries/nodes.ts +245 -0
- package/src/entries/organizations.ts +9 -0
- package/src/entries/pipeline.ts +43 -0
- package/src/entries/scene3d.ts +27 -0
- package/src/entries/social.ts +297 -0
- package/src/entries/types.ts +26 -0
- package/src/entries/ugc.ts +14 -0
- package/src/entries/video.ts +59 -0
- package/src/entries/workflow.ts +172 -0
- package/src/fan-out-rows.ts +2 -0
- package/src/index.ts +25 -1845
- package/src/json-kinds.ts +4 -0
- package/src/model-catalog.ts +243 -34
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-run-routes.ts +2 -0
- package/src/node-runtime-keys.ts +8 -0
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +12 -0
- package/src/preview-gate.ts +92 -14
- package/src/private-host.ts +89 -59
- package/src/producer-types.ts +16 -2
- package/src/run-continuation.ts +21 -0
- package/src/site-capture-node.ts +82 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +37 -7
- package/src/ugc-run-state.ts +5 -3
- package/src/video-analysis-pricing.ts +31 -29
|
@@ -0,0 +1,1460 @@
|
|
|
1
|
+
import { e as ModelInputAdjustment, o as SourceImageSize } from '../model-catalog-V-ZNzRSd.js';
|
|
2
|
+
|
|
3
|
+
/** Milli-credits per credit — the intermediate rounding resolution. */
|
|
4
|
+
declare const CREDIT_ROUNDING_RESOLUTION = 1000;
|
|
5
|
+
/** A USD amount → whole credits at the current base. Rounds up. */
|
|
6
|
+
declare function usdToCredits(usd: number): number;
|
|
7
|
+
/** Whole credits → their USD value at the current base. Display/reporting only. */
|
|
8
|
+
declare function creditsToUsd(credits: number): number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Film cost ESTIMATION for the studio preview.
|
|
12
|
+
*
|
|
13
|
+
* This is display guidance only — it produces an approximate "this film will
|
|
14
|
+
* cost ≈ N credits" number so the user can see cost before committing to a
|
|
15
|
+
* length + model. The ACTUAL charge is still computed at generation time from
|
|
16
|
+
* `STATIC_CREDIT_COSTS` / the `model_pricing` table per job; this module never
|
|
17
|
+
* bills.
|
|
18
|
+
*
|
|
19
|
+
* Numbers are grounded in the KIE-calibrated per-clip credit costs in
|
|
20
|
+
* `backend/src/ee/billing/credits.ts` (each entry there is annotated with its
|
|
21
|
+
* KIE-credit + USD source). A backend test cross-checks `VIDEO_CLIP_CREDITS`
|
|
22
|
+
* against that source so the estimate can't silently drift from reality.
|
|
23
|
+
*
|
|
24
|
+
* Cost structure of a Story→Video film:
|
|
25
|
+
* total = BASE (duration-independent planning + assembly)
|
|
26
|
+
* + perShot × shotCount (the variable, model-driven bulk)
|
|
27
|
+
* where a shot = one keyframe image + one video clip + one video-critic pass,
|
|
28
|
+
* and shotCount ≈ ceil(duration / clipSeconds) for the chosen model.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Duration-independent overhead, in credits:
|
|
32
|
+
* script/showrunner LLM chain ~30 · music timeline 4 · editor LLM 3 ·
|
|
33
|
+
* final merge 3 · storyboard-cohesion critic 5 ≈ 45.
|
|
34
|
+
* Mirrors the fixed line items in `estimateUpfrontCredits`
|
|
35
|
+
* (backend/src/ee/pipelines/credits.ts).
|
|
36
|
+
*/
|
|
37
|
+
declare const FILM_BASE_CREDITS = 45;
|
|
38
|
+
/** Per-shot keyframe image (nano-banana class) — see STATIC_CREDIT_COSTS. */
|
|
39
|
+
declare const KEYFRAME_CREDITS_PER_SHOT = 2;
|
|
40
|
+
/** Per-shot Video Critic pass (first_last frame mode) — see credits.ts. */
|
|
41
|
+
declare const VIDEO_CRITIC_CREDITS_PER_SHOT = 2;
|
|
42
|
+
interface VideoClipCost {
|
|
43
|
+
/** Representative per-clip credit cost at the studio's default config
|
|
44
|
+
* (720p; for the Seedance 2 family this is the ref-image variant the
|
|
45
|
+
* studio uses for identity). Sourced from STATIC_CREDIT_COSTS. */
|
|
46
|
+
readonly credits: number;
|
|
47
|
+
/** Representative clip length in seconds for shot-count estimation. */
|
|
48
|
+
readonly clipSeconds: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Representative per-clip credit cost for each user-pinnable video model.
|
|
52
|
+
* Values are the KIE-calibrated credits from STATIC_CREDIT_COSTS at the
|
|
53
|
+
* studio's typical settings (720p; Seedance 2 = 8s 720p +ref). Keep in sync
|
|
54
|
+
* with that table — the backend cross-check test guards drift.
|
|
55
|
+
*/
|
|
56
|
+
declare const VIDEO_CLIP_CREDITS: Record<string, VideoClipCost>;
|
|
57
|
+
/**
|
|
58
|
+
* Fallback when no model is pinned (Auto — the Scene Director picks per scene)
|
|
59
|
+
* or the model isn't in the table. kling-turbo is the cheap, common default
|
|
60
|
+
* the engine gravitates to, so it's a reasonable "≈" anchor.
|
|
61
|
+
*/
|
|
62
|
+
declare const DEFAULT_VIDEO_CLIP_COST: VideoClipCost;
|
|
63
|
+
interface FilmCreditEstimate {
|
|
64
|
+
/** Total estimated credits for the whole film. */
|
|
65
|
+
readonly totalCredits: number;
|
|
66
|
+
/** Fixed base portion (planning + assembly). */
|
|
67
|
+
readonly baseCredits: number;
|
|
68
|
+
/** Variable portion (shots × per-shot). */
|
|
69
|
+
readonly variableCredits: number;
|
|
70
|
+
/** Estimated number of shots (clips) generated. */
|
|
71
|
+
readonly shotCount: number;
|
|
72
|
+
/** Average credits per second of film (totalCredits / duration). */
|
|
73
|
+
readonly creditsPerSecond: number;
|
|
74
|
+
/** Whether a known model drove the estimate (false = Auto/fallback). */
|
|
75
|
+
readonly modelKnown: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Estimate the credit cost of a Story→Video film of `durationSeconds` rendered
|
|
79
|
+
* with `videoModel`. Approximate, for the studio's cost preview only.
|
|
80
|
+
*/
|
|
81
|
+
declare function estimateFilmCredits(durationSeconds: number, videoModel?: string): FilmCreditEstimate;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Build composite credit model identifiers for variable pricing.
|
|
85
|
+
* Shared between frontend and backend.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Compute composite model identifier for variable credit pricing.
|
|
90
|
+
* Examples: "gpt-image:high", "flux:2K", "nano-banana-pro:4K", "ideogram:TURBO",
|
|
91
|
+
* "flux-2-pro:2MP", "flux-2-max:2MP:1ref" (Flux 2 — billed per megapixel).
|
|
92
|
+
*
|
|
93
|
+
* For image models, uses quality/resolution/renderingSpeed and (Flux 2) the output
|
|
94
|
+
* megapixel count plus (Flux 2 Max) the number of reference images attached at request time.
|
|
95
|
+
* For video models, uses duration/sound params when the model has variable pricing.
|
|
96
|
+
*/
|
|
97
|
+
declare function buildCreditModelIdentifier(provider: string, quality?: string, resolution?: string, renderingSpeed?: string, targetResolution?: string, referenceImageCount?: number): string;
|
|
98
|
+
/**
|
|
99
|
+
* An image request's catalog-snapped parameters PLUS the credit identifier
|
|
100
|
+
* priced off them.
|
|
101
|
+
*
|
|
102
|
+
* `adjustments` is the disclosure channel: every lever this changed, why, and
|
|
103
|
+
* to what. Routes return it in the 200 body so a caller learns their value was
|
|
104
|
+
* corrected instead of silently getting something else.
|
|
105
|
+
*/
|
|
106
|
+
interface NormalizedImageGen {
|
|
107
|
+
/** Credit identifier, priced off the SNAPPED `resolution` / `quality`. */
|
|
108
|
+
identifier: string;
|
|
109
|
+
/** The catalog model id the params were snapped against (post T2I→I2I swap). */
|
|
110
|
+
modelId: string;
|
|
111
|
+
aspectRatio?: string;
|
|
112
|
+
resolution?: string;
|
|
113
|
+
quality?: string;
|
|
114
|
+
/** Empty when the caller's values were already valid for `modelId`. */
|
|
115
|
+
adjustments: ModelInputAdjustment[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The catalog model `resolveNormalizedImageGen` snaps against: the provider
|
|
119
|
+
* (Nano Banana when none is named), or — with `swapToI2i` and references
|
|
120
|
+
* attached — its i2i sibling, the model the generate-image route and the
|
|
121
|
+
* workflow payload builder then send. That sibling has its OWN catalog entry
|
|
122
|
+
* and lever lists. Exported so a caller that has to decide something about
|
|
123
|
+
* those lists before the snap (whether a photo's size is worth reading) asks
|
|
124
|
+
* about the same model the snap will use.
|
|
125
|
+
*/
|
|
126
|
+
declare function normalizedImageGenModelId(opts: {
|
|
127
|
+
provider: unknown;
|
|
128
|
+
refCount: number;
|
|
129
|
+
swapToI2i?: boolean;
|
|
130
|
+
}): string;
|
|
131
|
+
/**
|
|
132
|
+
* Whether "auto" on a Generate Image request can need its photo's size: the
|
|
133
|
+
* model the snap runs against (`normalizedImageGenModelId` with the swap on)
|
|
134
|
+
* has no native auto. Given the ASSEMBLED reference count, it asks about exactly
|
|
135
|
+
* that model; without one — a write boundary, or a run before its references
|
|
136
|
+
* assemble — about both the provider and its i2i sibling, since references may
|
|
137
|
+
* yet attach.
|
|
138
|
+
*/
|
|
139
|
+
declare function imageGenAutoAspectNeedsSourceImage(opts: {
|
|
140
|
+
provider: unknown;
|
|
141
|
+
aspectRatio: unknown;
|
|
142
|
+
refCount?: number;
|
|
143
|
+
}): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Snap an image request's catalog-governed levers to a combination the model
|
|
146
|
+
* actually accepts, and price the credit identifier off the SNAPPED values.
|
|
147
|
+
*
|
|
148
|
+
* WHY THE SNAP LIVES HERE and not at the call site. Both image routes compute
|
|
149
|
+
* their credit identifier TWICE — once in the `creditGuard` preHandler (the
|
|
150
|
+
* CHECK) and once at the handler's `reserveCreditsForJob` (the DEBIT) — and a
|
|
151
|
+
* dedicated test asserts the two stay byte-identical (see
|
|
152
|
+
* `backend/src/routes/__tests__/generate-image.test.ts`, "CHECK === DEBIT").
|
|
153
|
+
* `resolution` and `quality` are pricing dimensions, so a snap applied at only
|
|
154
|
+
* one of those sites breaks that invariant, and `commit_credits` never collects
|
|
155
|
+
* an upward delta — the reserve IS the charge. Putting the snap inside the
|
|
156
|
+
* primitive makes CHECK, DEBIT and the workflow orchestrator agree by
|
|
157
|
+
* construction rather than by everyone remembering to call a normalizer.
|
|
158
|
+
*
|
|
159
|
+
* Inputs are typed `unknown` on purpose: the preHandler runs BEFORE Zod, so a
|
|
160
|
+
* caller can put a number or an object in `resolution`. Non-strings become
|
|
161
|
+
* `undefined` rather than reaching `normalizeModelInput` as a lie.
|
|
162
|
+
*
|
|
163
|
+
* Unknown model ids pass through untouched (same contract as
|
|
164
|
+
* `normalizeModelInput`) — the route's provider enum is the gate for those.
|
|
165
|
+
*
|
|
166
|
+
* `sourceImage` is the size of the photo the request transforms or is drawn
|
|
167
|
+
* from (an image-to-image / edit source, or Generate Image's first wired
|
|
168
|
+
* reference). It only decides "auto" on a model without a native auto, and the
|
|
169
|
+
* ratio is not a pricing dimension on any such model (pinned across the catalog
|
|
170
|
+
* by `auto-aspect-source.test.ts`), so a CHECK that runs before the size is
|
|
171
|
+
* known prices the same identifier as the DEBIT that knows it.
|
|
172
|
+
*/
|
|
173
|
+
declare function resolveNormalizedImageGen(opts: {
|
|
174
|
+
provider: string | undefined;
|
|
175
|
+
aspectRatio?: unknown;
|
|
176
|
+
quality?: unknown;
|
|
177
|
+
resolution?: unknown;
|
|
178
|
+
renderingSpeed?: unknown;
|
|
179
|
+
refCount: number;
|
|
180
|
+
swapToI2i?: boolean;
|
|
181
|
+
sourceImage?: SourceImageSize;
|
|
182
|
+
}): NormalizedImageGen;
|
|
183
|
+
/**
|
|
184
|
+
* Reference-aware image-generation credit identifier — the SINGLE source of
|
|
185
|
+
* truth shared by the single-node routes (`/v1/generate-image`,
|
|
186
|
+
* `/v1/image-to-image`) and the workflow orchestrator
|
|
187
|
+
* (`payload-builder.ts`). It centralises the two pricing dimensions that must
|
|
188
|
+
* match across both paths or a Flux 2 generation is billed the wrong tier
|
|
189
|
+
* (Flux 2 commits non-metered / has no upward true-up, so the reserved
|
|
190
|
+
* identifier IS the final charge):
|
|
191
|
+
* - `refCount`: the number of reference images sent to the provider (Flux 2
|
|
192
|
+
* bills per ref). generate-image passes the assembled count (0 for pure
|
|
193
|
+
* text-to-image); image-to-image passes 1 (the primary `imageUrl`) + extras.
|
|
194
|
+
* - `swapToI2i`: generate-image auto-swaps a bare T2I provider to its i2i
|
|
195
|
+
* sibling (`T2I_TO_I2I_VARIANT`) when refs are attached, so the credit id
|
|
196
|
+
* matches the variant actually invoked. image-to-image is already an i2i
|
|
197
|
+
* provider → pass `false`.
|
|
198
|
+
*
|
|
199
|
+
* The LoRA short-circuit (`flux-lora-character`) stays at the call site because
|
|
200
|
+
* the routing decision needs a DB lookup the routes/orchestrator own.
|
|
201
|
+
*/
|
|
202
|
+
declare function resolveImageGenCreditIdentifier(opts: {
|
|
203
|
+
provider: string | undefined;
|
|
204
|
+
quality?: string;
|
|
205
|
+
resolution?: string;
|
|
206
|
+
renderingSpeed?: string;
|
|
207
|
+
refCount: number;
|
|
208
|
+
swapToI2i?: boolean;
|
|
209
|
+
}): string;
|
|
210
|
+
declare function buildVideoCreditModelIdentifier(provider: string, duration?: number | string, sound?: boolean, nodeType?: "image-to-video" | "text-to-video", mode?: string, resolution?: string, hasVideoRef?: boolean): string;
|
|
211
|
+
/**
|
|
212
|
+
* The credit identifier a video GENERATION node is quoted at — Generate Video
|
|
213
|
+
* (and the legacy Image/Text to Video nodes) and the Video to Video Seedance
|
|
214
|
+
* edit lane, on every surface that quotes one: the node's cost pill, the
|
|
215
|
+
* editor's run estimate, the prompt modal and the backend pre-run estimator.
|
|
216
|
+
*
|
|
217
|
+
* It applies the request levers the run applies BEFORE it prices
|
|
218
|
+
* (payload-builder's `resolveVideoRequestNorm`): the model's UI resolution fill
|
|
219
|
+
* when the node names none (`uiResolutionFill` — what the run sends), then the
|
|
220
|
+
* catalog normalizer `normalizeVideoRequestParams`, which also owns the Seedance
|
|
221
|
+
* Draft rule (a draft is priced AND sent at 480p whatever resolution came with
|
|
222
|
+
* it). Without that, a node with no resolution was quoted at the identifier's
|
|
223
|
+
* own default band (720p on Seedance 2.5) while the run sent and reserved 480p.
|
|
224
|
+
*
|
|
225
|
+
* `hasVideoRef` must come from the GRAPH (a wired reference-video edge, e.g.
|
|
226
|
+
* `countRefModalityEdges(edges, id, "video") > 0`), never node data: nothing
|
|
227
|
+
* writes `referenceVideoUrls` into a video node, so reading it there always
|
|
228
|
+
* quoted the plain ladder for a run that reserves on the `-ref` one.
|
|
229
|
+
*/
|
|
230
|
+
declare function videoGenerationCreditId(args: {
|
|
231
|
+
provider: string;
|
|
232
|
+
duration?: number | string;
|
|
233
|
+
sound?: boolean;
|
|
234
|
+
nodeType?: "image-to-video" | "text-to-video";
|
|
235
|
+
mode?: string;
|
|
236
|
+
resolution?: string;
|
|
237
|
+
draft?: boolean;
|
|
238
|
+
hasVideoRef?: boolean;
|
|
239
|
+
}): string;
|
|
240
|
+
/**
|
|
241
|
+
* The credit identifier a Video to Video node's Seedance EDIT lane reserves
|
|
242
|
+
* under. Seedance has no v2v endpoint — the lane is a text-to-video job in edit
|
|
243
|
+
* shape with the source clip as reference video 1 — so it prices on the
|
|
244
|
+
* REFERENCE-VIDEO ladder at the model's LONGEST clip (Auto duration), and the
|
|
245
|
+
* measured settlement refunds down to what was actually delivered.
|
|
246
|
+
*
|
|
247
|
+
* A thin call into {@link videoGenerationCreditId}, so a Generate Video node
|
|
248
|
+
* making the same KIE call (Seedance, Auto, a wired reference video) is quoted
|
|
249
|
+
* the same id. FOUR surfaces must agree on it exactly: the orchestrator's
|
|
250
|
+
* reservation (payload-builder.ts), the backend pre-run estimator
|
|
251
|
+
* (ee/billing/credits.ts), the node's cost pill, and the frontend run-level
|
|
252
|
+
* estimate (config-panels/helpers.ts). A quote that disagrees with the reserve
|
|
253
|
+
* is the documented `price_not_configured` / blank-pill trap.
|
|
254
|
+
*
|
|
255
|
+
* `resolution` is the node's one `v2vResolution` field; when unset the model's
|
|
256
|
+
* own UI fill is priced, which is what the lane will send. `draft` is the
|
|
257
|
+
* node's Seedance Draft toggle (priced at 480p).
|
|
258
|
+
*/
|
|
259
|
+
declare function seedanceVideoEditCreditId(provider: string, resolution?: string, draft?: boolean): string;
|
|
260
|
+
/** What the video credit identifier PRICES for a request, for the levers whose
|
|
261
|
+
* priced value must also be the value we SEND. */
|
|
262
|
+
interface PricedVideoSelection {
|
|
263
|
+
/** The resolution band the reservation is priced at when the request omitted
|
|
264
|
+
* one — and only where the platform DECLARES that band as the provider's own
|
|
265
|
+
* default. `undefined` means "leave `resolution` exactly as the request had
|
|
266
|
+
* it": either the caller supplied one, or the provider's real default is not
|
|
267
|
+
* known to be the band the identifier assumes. */
|
|
268
|
+
resolution?: string;
|
|
269
|
+
/** The length the reservation is priced at and the wire carries, for a
|
|
270
|
+
* provider whose price follows the clip length (LTX's seeded tier, the KIE
|
|
271
|
+
* ladders, Gemini Omni). `undefined` for every other provider, and for Auto:
|
|
272
|
+
* their duration passes through. */
|
|
273
|
+
duration?: number;
|
|
274
|
+
/** Non-empty only for a lever the caller ASKED for and did not get (a 7s
|
|
275
|
+
* request snapped to the 6s tier). Filling an omitted lever is a disclosure of
|
|
276
|
+
* the price already being charged, not a correction, so it reports nothing. */
|
|
277
|
+
adjustments: ModelInputAdjustment[];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The other half of the video money path: `normalizeVideoRequestParams` snaps a
|
|
281
|
+
* value the CATALOG governs; this returns the value the PRICE ladder governs.
|
|
282
|
+
*
|
|
283
|
+
* Two defects it closes, both of the same shape — the identifier prices one
|
|
284
|
+
* thing and the wire carries another, and `commit_credits` (migration 176) only
|
|
285
|
+
* ever refunds a surplus, so the reservation is the final charge:
|
|
286
|
+
*
|
|
287
|
+
* 1. **Absent resolution.** `buildVideoCreditModelIdentifier` prices an omitted
|
|
288
|
+
* `resolution` as a concrete band (LTX → 1080p; a
|
|
289
|
+
* {@link PRICING_DEFAULT_RESOLUTION} member → its declared default). Leaving
|
|
290
|
+
* the key unset then lets the provider pick — documented for the KIE members
|
|
291
|
+
* (their `extraParams` pin the same band) but UNDOCUMENTED for LTX on
|
|
292
|
+
* Replicate. Sending the band we priced makes the two agree by construction.
|
|
293
|
+
*
|
|
294
|
+
* The fill is deliberately limited to providers with a DECLARED default.
|
|
295
|
+
* `buildVideoCreditModelIdentifier` also has un-declared fallbacks — the
|
|
296
|
+
* cheapest tier for a resolution-priced provider with no
|
|
297
|
+
* `PRICING_DEFAULT_RESOLUTION` row — and those are a HEDGE, not a verified
|
|
298
|
+
* provider default: seedance-2 / -fast / -mini pin `resolution: "720p"`
|
|
299
|
+
* KIE-side while the identifier prices 480p, so filling 480p would downgrade
|
|
300
|
+
* the render to match a price we already know is wrong. That mismatch is a
|
|
301
|
+
* pre-existing identifier bug and is fixed by seeding the row, not here.
|
|
302
|
+
*
|
|
303
|
+
* 2. **Duration.** Every provider whose price follows the clip length is
|
|
304
|
+
* charged at the length it RENDERS: its own default when the request named
|
|
305
|
+
* none (catalog `defaultDuration`), the nearest length it offers otherwise
|
|
306
|
+
* (`pricedOutputDurationSec` — the runners' own snap rule). The LTX ladder is
|
|
307
|
+
* seeded per (band × seconds), so a 7s request snaps onto the 6s tier;
|
|
308
|
+
* sending 7s would bill six and render seven. The same value is returned for
|
|
309
|
+
* the other length-priced providers (the KIE ladders, Gemini Omni), so what
|
|
310
|
+
* is priced is what is sent. Auto (-1) is the model's call and is untouched.
|
|
311
|
+
*
|
|
312
|
+
* Pure, and IDEMPOTENT against the identifier: feeding its output back in
|
|
313
|
+
* cannot move the reserved tier. `video-request-normalize.test.ts` proves that
|
|
314
|
+
* over every provider × resolution × duration.
|
|
315
|
+
*/
|
|
316
|
+
declare function pricedVideoSelection(opts: {
|
|
317
|
+
provider: string;
|
|
318
|
+
resolution?: string;
|
|
319
|
+
duration?: number | string;
|
|
320
|
+
}): PricedVideoSelection;
|
|
321
|
+
/**
|
|
322
|
+
* Compute composite model identifier for motion control with duration-tiered pricing.
|
|
323
|
+
* Examples: "kling-3.0-motion:10s", "kling-3.0-motion:1080p:15s", "motion-transfer:5s"
|
|
324
|
+
*
|
|
325
|
+
* Wan Animate providers use resolution-tiered pricing (not per-second):
|
|
326
|
+
* "wan-animate-move" (480p default), "wan-animate-move:580p", "wan-animate-move:720p"
|
|
327
|
+
*
|
|
328
|
+
* @param provider - Motion control provider key ("kling" for 2.6, "kling-3.0", "wan-animate-move", "wan-animate-replace")
|
|
329
|
+
* @param resolution - "720p" or "1080p" (Kling), "480p" or "580p" or "720p" (Wan Animate)
|
|
330
|
+
* @param videoDuration - Reference video duration in seconds (defaults to 10s, unused for Wan Animate)
|
|
331
|
+
*/
|
|
332
|
+
declare function buildMotionCreditModelIdentifier(provider: string, resolution: string, videoDuration?: number): string;
|
|
333
|
+
/**
|
|
334
|
+
* The Suno operations whose credit key depends on the model VERSION.
|
|
335
|
+
*
|
|
336
|
+
* `/v1/suno/generate`, `/cover` and `/extend` resolve their creditGuard
|
|
337
|
+
* identifier through `sunoCreditType(model, <operation>)` (routes/suno.ts
|
|
338
|
+
* :247-249, :335-337, :407-409). EVERY other Suno route charges a flat
|
|
339
|
+
* per-operation key and ignores the version the node carries — mashup (:648),
|
|
340
|
+
* add-instrumental (:852), add-vocals (:907), upload-extend (:1016),
|
|
341
|
+
* replace-section (:710), style-boost (:771), convert-wav (:962),
|
|
342
|
+
* lyrics (:482), music-video (:594), voice (:1218).
|
|
343
|
+
*
|
|
344
|
+
* Anything that QUOTES a Suno price — a dropdown row, a node badge, the
|
|
345
|
+
* workflow-credit estimator — must follow the same split, or it displays a
|
|
346
|
+
* credit key the route never charges.
|
|
347
|
+
*/
|
|
348
|
+
declare const SUNO_VERSION_PRICED_OPERATIONS: readonly ["suno-generate", "suno-cover", "suno-extend"];
|
|
349
|
+
/**
|
|
350
|
+
* The seven Suno operations that appear behind a select/dropdown UI (model
|
|
351
|
+
* pickers, node badges, the credit estimator) — the three version-priced
|
|
352
|
+
* operations above, plus the four flat-key operations exercised by
|
|
353
|
+
* `sunoCreditType`'s own test suite. A readonly tuple so later tasks (the
|
|
354
|
+
* model dropdowns, node badges) can iterate or count it without redeclaring
|
|
355
|
+
* the list and drifting from this one.
|
|
356
|
+
*/
|
|
357
|
+
declare const SUNO_SELECT_OPERATIONS: readonly ["suno-generate", "suno-cover", "suno-extend", "suno-mashup", "suno-add-instrumental", "suno-add-vocals", "suno-upload-extend"];
|
|
358
|
+
/**
|
|
359
|
+
* Adjust Speed's price id: motion-compensated ("smooth") interpolation is its
|
|
360
|
+
* own, dearer tier. The route, the workflow run, and the editor's badge and
|
|
361
|
+
* run estimate all price through this, so none of them can quote the fast tier
|
|
362
|
+
* for a smooth run.
|
|
363
|
+
*/
|
|
364
|
+
declare function speedRampCreditId(quality: unknown): "speed-ramp" | "speed-ramp:smooth";
|
|
365
|
+
/**
|
|
366
|
+
* Apply EDL's price id: a `proxy` render (the 720p preview) is its own,
|
|
367
|
+
* cheaper per-output-minute row; a `final` render keeps the bare id. One id per
|
|
368
|
+
* QUALITY, for a video and an audio output alike (decided 2026-10-04). Anything
|
|
369
|
+
* that is not exactly "proxy" is the final, as the route and the node default
|
|
370
|
+
* it. The route, the workflow run, and the editor's badge and run estimate all
|
|
371
|
+
* price through this; the job itself is always named `apply-edl`.
|
|
372
|
+
*/
|
|
373
|
+
declare function applyEdlCreditId(quality: unknown): "apply-edl" | "apply-edl:proxy";
|
|
374
|
+
/**
|
|
375
|
+
* Speaker View's price tiers (decided 2026-10-10, C4): a render is priced by
|
|
376
|
+
* how many speakers it composites at once. `standard` — at most two tiles on
|
|
377
|
+
* any segment and no zoom; `complex` — three to six tiles, or any zoom. Which
|
|
378
|
+
* tier a render is in is the render rule's to say (the app's
|
|
379
|
+
* `@nodaro/render-rules`), never this vocabulary's.
|
|
380
|
+
*/
|
|
381
|
+
declare const SPEAKER_VIEW_PRICE_TIERS: readonly ["standard", "complex"];
|
|
382
|
+
type SpeakerViewPriceTier = (typeof SPEAKER_VIEW_PRICE_TIERS)[number];
|
|
383
|
+
type SpeakerViewCreditId = "speaker-view" | "speaker-view:proxy" | "speaker-view:complex" | "speaker-view:complex:proxy";
|
|
384
|
+
/** Every id `speakerViewCreditId` can name. */
|
|
385
|
+
declare const SPEAKER_VIEW_CREDIT_IDS: readonly SpeakerViewCreditId[];
|
|
386
|
+
/**
|
|
387
|
+
* The credit id of a Speaker View render (F4, decided 2026-09-23; tiers
|
|
388
|
+
* decided 2026-10-10): a Preview (`quality` "proxy") reserves on its own row,
|
|
389
|
+
* anything else on the final's, and each in its price tier — `standard` on
|
|
390
|
+
* `speaker-view` / `speaker-view:proxy`, `complex` on `speaker-view:complex` /
|
|
391
|
+
* `speaker-view:complex:proxy`. A tier that is not exactly `standard` (absent
|
|
392
|
+
* included) names the `complex` row: a caller that cannot tell quotes high,
|
|
393
|
+
* never low. The job is always named `speaker-view`; only its credit id
|
|
394
|
+
* follows the quality and the tier.
|
|
395
|
+
*/
|
|
396
|
+
declare function speakerViewCreditId(quality: unknown, tier?: unknown): SpeakerViewCreditId;
|
|
397
|
+
/**
|
|
398
|
+
* OUR Nodaro credit key for a Suno operation, given the model version and the
|
|
399
|
+
* operation (which is also the node type and the BullMQ job name).
|
|
400
|
+
*
|
|
401
|
+
* This is the single source of truth for the Suno pricing contract, shared by
|
|
402
|
+
* the reservation path (routes/suno.ts creditGuard), the egress seam
|
|
403
|
+
* (workers/handlers/suno.ts `modelKey`, which must match what was reserved),
|
|
404
|
+
* both workflow-credit estimators (ee/billing/credits.ts and the frontend
|
|
405
|
+
* config-panels/helpers.ts), the seven Suno model dropdowns and the three Suno
|
|
406
|
+
* node badges. It is a billing key — NEVER a KIE provider id — which is what
|
|
407
|
+
* satisfies the B3 egress invariant.
|
|
408
|
+
*
|
|
409
|
+
* The version → key map is {@link SUNO_VERSION_CREDIT_KEYS}; a version with no
|
|
410
|
+
* entry (V4 / V4_5 / V4_5ALL / V4_5PLUS) falls back to the operation key, and a
|
|
411
|
+
* non-version-priced operation is returned unchanged.
|
|
412
|
+
*/
|
|
413
|
+
declare function sunoCreditType(model: string | undefined, operation: string): string;
|
|
414
|
+
/**
|
|
415
|
+
* Suno version → Nodaro credit key for the version-priced operations. One row
|
|
416
|
+
* per version that has its own `model_pricing` row / `STATIC_CREDIT_COSTS`
|
|
417
|
+
* entry / `MODEL_CATALOG` pricing row, so an admin can reprice one version
|
|
418
|
+
* without touching code. Every ACTIVE version MUST have a row here — guarded
|
|
419
|
+
* by `__tests__/suno-credit-type.test.ts` (a new active version with no key
|
|
420
|
+
* would silently bill at the operation key).
|
|
421
|
+
*/
|
|
422
|
+
declare const SUNO_VERSION_CREDIT_KEYS: Readonly<Record<string, string>>;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Pure credit estimators for video-utility nodes (loop-video, trim-video,
|
|
426
|
+
* combine-videos, assemble-narrated-video). Used by frontend (Run-button
|
|
427
|
+
* display + API call) AND backend (creditGuard reservation, the workflow
|
|
428
|
+
* run's reservation, the workflow estimate) so the displayed cost equals
|
|
429
|
+
* what gets debited.
|
|
430
|
+
*
|
|
431
|
+
* Every estimate counts pricing UNITS and returns units × CREDIT_UNIT base
|
|
432
|
+
* credits: a unit is 5 seconds of output, ~24 frames a smart loop cut
|
|
433
|
+
* searches, each combine input beyond two, and each step of Assemble Narrated
|
|
434
|
+
* Video (3 + 1 per 6 blocks).
|
|
435
|
+
*/
|
|
436
|
+
declare const VIDEO_UTIL_PRICING: {
|
|
437
|
+
/** Base credits per pricing unit. The node's own `model_pricing` row is one unit. */
|
|
438
|
+
readonly CREDIT_UNIT: 10;
|
|
439
|
+
/** Base credits per 5 seconds of output (one unit), ceiling. */
|
|
440
|
+
readonly CREDITS_PER_5_SEC: 10;
|
|
441
|
+
/** Smart-loop-cut work scales at one unit per ~24 frames searched. */
|
|
442
|
+
readonly FRAMES_PER_CREDIT: 24;
|
|
443
|
+
/** Used when an upstream node hasn't produced a measurable duration yet. */
|
|
444
|
+
readonly FALLBACK_DURATION_SECONDS: 8;
|
|
445
|
+
};
|
|
446
|
+
interface LoopVideoEstimatorInput {
|
|
447
|
+
mode?: "repeat" | "duration";
|
|
448
|
+
repeatCount?: number;
|
|
449
|
+
targetDuration?: number;
|
|
450
|
+
smartLoopCutBeforeRepeat?: boolean;
|
|
451
|
+
smartLoopCutLookback?: number;
|
|
452
|
+
}
|
|
453
|
+
interface TrimVideoEstimatorInput {
|
|
454
|
+
trimMode?: "time" | "seconds" | "keep-first-seconds" | "keep-last-seconds" | "frames" | "smart-loop-cut";
|
|
455
|
+
startTime?: number;
|
|
456
|
+
endTime?: number;
|
|
457
|
+
/** Seconds-mirror of frames mode: trim N seconds from start AND/OR end. */
|
|
458
|
+
trimStartSeconds?: number;
|
|
459
|
+
trimEndSeconds?: number;
|
|
460
|
+
/** Keep only the first/last N seconds (probes duration at runtime). */
|
|
461
|
+
keepFirstSeconds?: number;
|
|
462
|
+
keepLastSeconds?: number;
|
|
463
|
+
trimStartFrames?: number;
|
|
464
|
+
trimEndFrames?: number;
|
|
465
|
+
smartLoopCutLookback?: number;
|
|
466
|
+
}
|
|
467
|
+
interface CombineVideosEstimatorInput {
|
|
468
|
+
/** Any id from `COMBINE_TRANSITIONS`. The estimator only branches on
|
|
469
|
+
* `cut` vs non-cut, so accepting the full string keeps the catalog as
|
|
470
|
+
* the single source of truth. */
|
|
471
|
+
transition?: string;
|
|
472
|
+
transitionDuration?: number;
|
|
473
|
+
trimStartFrames?: number;
|
|
474
|
+
trimEndFrames?: number;
|
|
475
|
+
}
|
|
476
|
+
declare function estimateLoopVideoCredits(data: LoopVideoEstimatorInput, upstreamDuration?: number): number;
|
|
477
|
+
declare function estimateTrimVideoCredits(data: TrimVideoEstimatorInput, upstreamDuration?: number): number;
|
|
478
|
+
declare function estimateCombineVideosCredits(data: CombineVideosEstimatorInput, upstreamDurations: ReadonlyArray<number | undefined>): number;
|
|
479
|
+
interface LoopTrimEstimatorInput {
|
|
480
|
+
enabled?: boolean;
|
|
481
|
+
framesToTest?: number;
|
|
482
|
+
}
|
|
483
|
+
/** Add-on credits charged for the smart-loop-cut post-process applied to an
|
|
484
|
+
* image-to-video output. Returns 0 when loopTrim is undefined or disabled.
|
|
485
|
+
* Formula: CREDIT_UNIT × (ceil(duration / 5) + ceil(framesToTest / 24)) —
|
|
486
|
+
* the same units as Trim Video's smart loop cut, so 8 s at 16 frames → 30. */
|
|
487
|
+
declare function estimateLoopTrimAddonCredits(loopTrim: LoopTrimEstimatorInput | undefined, outputDurationSeconds: number): number;
|
|
488
|
+
/** BASE credits for assemble-narrated-video: 3 units flat + 1 per 6
|
|
489
|
+
* blocks. 6→40, 24→70, 60→130. Single source of truth shared by the backend
|
|
490
|
+
* route/creditGuard (`backend/src/providers/video/narrated-block-fit.ts`
|
|
491
|
+
* re-exports this), the workflow run's reservation and the frontend pre-run
|
|
492
|
+
* estimate (`frontend/src/hooks/use-estimated-credits.ts`). */
|
|
493
|
+
declare function assembleNarratedVideoCredits(blockCount: number): number;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Image Overlay pricing — one formula shared by the backend route
|
|
497
|
+
* (creditGuard computeCredits), the orchestrator's reservation override, the
|
|
498
|
+
* workflow estimator and the canvas Run button, so every surface quotes and
|
|
499
|
+
* charges the same number.
|
|
500
|
+
*
|
|
501
|
+
* credits = BASE + PER_VARIANT × (number of distinct, valid platform ids)
|
|
502
|
+
*
|
|
503
|
+
* The base covers the composite and its mask; every extra platform render is
|
|
504
|
+
* one more resize + encode + upload. Worked examples (pinned by the tests and
|
|
505
|
+
* repeated in docs/nodes/processing-video/image-overlay.md — keep them equal):
|
|
506
|
+
* 0 variants → 10, 2 → 14, 12 (every platform) → 34.
|
|
507
|
+
*/
|
|
508
|
+
declare const IMAGE_OVERLAY_BASE_CREDITS = 10;
|
|
509
|
+
declare const IMAGE_OVERLAY_VARIANT_CREDITS = 2;
|
|
510
|
+
/** Distinct platform ids the registry knows — the count the price is built from. */
|
|
511
|
+
declare function imageOverlayBillableVariants(variants: ReadonlyArray<unknown> | undefined): string[];
|
|
512
|
+
declare function imageOverlayCredits(variants: ReadonlyArray<unknown> | undefined): number;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Video SFX pricing — which price row a run is charged from, by the length of
|
|
516
|
+
* the input video. One mapping for every place that names the row: the route
|
|
517
|
+
* (`POST /v1/video-sfx`), the workflow run's reservation, the node's Run
|
|
518
|
+
* button and the workflow estimates.
|
|
519
|
+
*
|
|
520
|
+
* Each bucket is a `model_pricing` row (`replicate-mmaudio:<n>s`); the credit
|
|
521
|
+
* amounts live there, never here. Worked examples (repeated in
|
|
522
|
+
* docs/nodes/ai-video/video-sfx.md):
|
|
523
|
+
* 5 s → `:8s`, 12 s → `:15s`, 31 s → `:60s`, 180 s → `:300s`.
|
|
524
|
+
*/
|
|
525
|
+
declare const VIDEO_SFX_PRICING: {
|
|
526
|
+
/** The longest input video a run accepts, in seconds. */
|
|
527
|
+
readonly MAX_DURATION_SEC: 300;
|
|
528
|
+
/** The length priced (and generated) when the input video cannot be measured. */
|
|
529
|
+
readonly FALLBACK_DURATION_SEC: 8;
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* The price row for an input video of `durationSec` seconds. An unknown or
|
|
533
|
+
* non-positive length prices the fallback length; anything past the cap prices
|
|
534
|
+
* the last bucket (the route refuses such a video before it gets here).
|
|
535
|
+
*/
|
|
536
|
+
declare function videoSfxCreditId(durationSec: number | null | undefined): string;
|
|
537
|
+
/**
|
|
538
|
+
* The price row a QUOTE names for an input video of `durationSec` seconds —
|
|
539
|
+
* every estimate before a run (the node's Run button, the workflow estimate,
|
|
540
|
+
* the server's run estimate, a listing). A known length is the row its run is
|
|
541
|
+
* charged ({@link videoSfxCreditId}). An UNKNOWN length is the last row, 300
|
|
542
|
+
* seconds (decided 2026-10-13): a run measures the clip before it reserves and
|
|
543
|
+
* refuses one over 300 s, so that row is the most any run can be charged —
|
|
544
|
+
* the quote is never below the charge, as Video Mask and Video Depth quote an
|
|
545
|
+
* unknown clip at their highest row.
|
|
546
|
+
*/
|
|
547
|
+
declare function videoSfxQuoteCreditId(durationSec: number | null | undefined): string;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Text to Audio (sound effects) pricing — which price row a run is charged
|
|
551
|
+
* from, by the length of the clip it asks for. One mapping for every place
|
|
552
|
+
* that names the row: the route (`POST /v1/text-to-audio`), the workflow run's
|
|
553
|
+
* reservation, the node's Run button and the workflow estimates.
|
|
554
|
+
*
|
|
555
|
+
* `elevenlabs-sfx` is priced per second: one `model_pricing` row per whole
|
|
556
|
+
* second (`elevenlabs-sfx:1s` … `elevenlabs-sfx:30s`); the credit amounts live
|
|
557
|
+
* there, never here. The requested length is rounded UP to whole seconds, and
|
|
558
|
+
* a request that names no length is priced as 5 seconds. Worked examples
|
|
559
|
+
* (repeated in docs/nodes/ai-audio/text-to-audio.md):
|
|
560
|
+
* 0.5 s → `:1s`, 6 s → `:6s`, 22.3 s → `:23s`, no duration → `:5s`.
|
|
561
|
+
*/
|
|
562
|
+
declare const TEXT_TO_AUDIO_PRICING: {
|
|
563
|
+
/** The engine priced per second of requested audio. */
|
|
564
|
+
readonly PER_SECOND_PROVIDER: "elevenlabs-sfx";
|
|
565
|
+
/** The longest clip a request may ask for, in seconds. */
|
|
566
|
+
readonly MAX_DURATION_SEC: 30;
|
|
567
|
+
/** The length priced when a request names none (the model picks the length). */
|
|
568
|
+
readonly DEFAULT_BILLED_SEC: 5;
|
|
569
|
+
};
|
|
570
|
+
/** Every per-second price row, shortest first: `elevenlabs-sfx:1s` … `:30s`. */
|
|
571
|
+
declare const TEXT_TO_AUDIO_SFX_CREDIT_IDS: readonly string[];
|
|
572
|
+
/**
|
|
573
|
+
* The whole seconds a request of `duration` seconds is billed for: rounded up,
|
|
574
|
+
* at most the 30 s cap. No usable length (absent, empty, non-numeric, zero or
|
|
575
|
+
* negative) bills the 5 s default. A numeric string counts — a field mapping
|
|
576
|
+
* can deliver the length as text.
|
|
577
|
+
*/
|
|
578
|
+
declare function textToAudioBilledSeconds(duration: unknown): number;
|
|
579
|
+
/**
|
|
580
|
+
* The price row for a Text to Audio request. A request with no provider runs
|
|
581
|
+
* (and is priced as) the default engine. An engine that is not priced per
|
|
582
|
+
* second keeps its own flat row.
|
|
583
|
+
*/
|
|
584
|
+
declare function textToAudioCreditId(provider: string | null | undefined, duration: unknown): string;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* LTX 2.3 Pro Extend pricing — a per-second price row times the seconds added.
|
|
588
|
+
*
|
|
589
|
+
* `ltxExtendDurationSec` is the one reading of the requested length, and the
|
|
590
|
+
* value it returns is the one SENT to the model: the route, the workflow run
|
|
591
|
+
* and the worker all pass it on, so the seconds priced are the seconds
|
|
592
|
+
* rendered. An absent length is the model's own default (6 seconds).
|
|
593
|
+
*
|
|
594
|
+
* The per-second amount lives in the `model_pricing` row, never here. Worked
|
|
595
|
+
* examples at the row's listed price of 40 (repeated in
|
|
596
|
+
* docs/nodes/ai-video/extend-video.md):
|
|
597
|
+
* 2 s → 80, 6 s (or no length) → 240, 20 s → 800.
|
|
598
|
+
*/
|
|
599
|
+
declare const LTX_EXTEND_PER_SECOND_CREDIT_ID = "ltx-2.3-pro-extend:per-second";
|
|
600
|
+
declare const LTX_EXTEND_DURATION: {
|
|
601
|
+
readonly MIN_SEC: 1;
|
|
602
|
+
readonly MAX_SEC: 20;
|
|
603
|
+
readonly DEFAULT_SEC: 6;
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* The seconds an LTX extend adds: a whole number from 1 to 20, the default
|
|
607
|
+
* when none (or nothing readable) was given. Accepts a numeric string, which a
|
|
608
|
+
* workflow field mapping can deliver.
|
|
609
|
+
*/
|
|
610
|
+
declare function ltxExtendDurationSec(raw: unknown): number;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* LTX 2.3 Pro Retake pricing — a per-second price row times the seconds of
|
|
614
|
+
* the replaced window.
|
|
615
|
+
*
|
|
616
|
+
* `ltxRetakeDurationSec` is the one reading of the window's length, and the
|
|
617
|
+
* value it returns is the one SENT to the model: the route, the workflow run
|
|
618
|
+
* and the worker all pass it on. The window is at least 2 seconds (the
|
|
619
|
+
* route's own floor) and may be fractional — the editor's range picker sets
|
|
620
|
+
* it to the frame.
|
|
621
|
+
*
|
|
622
|
+
* The per-second amount lives in the `model_pricing` row, never here; a run
|
|
623
|
+
* is the row × these seconds, rounded up to a whole credit.
|
|
624
|
+
*/
|
|
625
|
+
declare const LTX_RETAKE_PER_SECOND_CREDIT_ID = "ltx-2.3-pro-retake:per-second";
|
|
626
|
+
/** The shortest window a retake replaces, in seconds. */
|
|
627
|
+
declare const LTX_RETAKE_MIN_DURATION_SEC = 2;
|
|
628
|
+
/**
|
|
629
|
+
* The seconds a retake replaces: the requested window, never below 2; 2 when
|
|
630
|
+
* none (or nothing readable) was given. Accepts a numeric string, which a
|
|
631
|
+
* workflow field mapping can deliver.
|
|
632
|
+
*/
|
|
633
|
+
declare function ltxRetakeDurationSec(raw: unknown): number;
|
|
634
|
+
|
|
635
|
+
/** Characters per price unit. */
|
|
636
|
+
declare const SPEECH_PRICE_UNIT_CHARS = 100;
|
|
637
|
+
/** The minimum units a request is priced at, however short its text. */
|
|
638
|
+
declare const SPEECH_FLOOR_UNITS = 8;
|
|
639
|
+
/** Appended to a speech model's id to name its per-unit price row. */
|
|
640
|
+
declare const SPEECH_UNIT_CREDIT_SUFFIX = ":per-100-chars";
|
|
641
|
+
/**
|
|
642
|
+
* The price-row id of one unit for the model a request runs as. The legacy
|
|
643
|
+
* `elevenlabs` alias prices on turbo's row, as it runs on turbo; any other id
|
|
644
|
+
* (including the dialogue model) is used as given.
|
|
645
|
+
*/
|
|
646
|
+
declare function speechUnitCreditId(modelId: string): string;
|
|
647
|
+
/**
|
|
648
|
+
* Units a text of `chars` characters is priced at: every started 100, and
|
|
649
|
+
* never fewer than the floor. A count that is not a finite non-negative
|
|
650
|
+
* number (node data written straight into workflow JSON) is the floor.
|
|
651
|
+
*/
|
|
652
|
+
declare function speechPriceUnits(chars: number): number;
|
|
653
|
+
/** Base credits for `chars` characters at `perUnitCredits` per unit (the model's `:per-100-chars` row). */
|
|
654
|
+
declare function speechCredits(chars: number, perUnitCredits: number): number;
|
|
655
|
+
/**
|
|
656
|
+
* The id of the exact charge of a whole request of `units` units on `modelId`:
|
|
657
|
+
* `<model>:per-100-chars:<N>u`. Never a row of its own — a price lookup prices
|
|
658
|
+
* it from the model's unit row × N as one whole, exactly as a request of that
|
|
659
|
+
* length is reserved. Served only while length pricing is on, like the unit
|
|
660
|
+
* row it is priced from.
|
|
661
|
+
*/
|
|
662
|
+
declare function speechQuoteCreditId(modelId: string, units: number): string;
|
|
663
|
+
/** A `<model>:per-100-chars:<N>u` id, read back. */
|
|
664
|
+
interface SpeechQuoteCreditIdParts {
|
|
665
|
+
/** The speech model (canonical id) the request runs as. */
|
|
666
|
+
model: string;
|
|
667
|
+
/** Its `<model>:per-100-chars` unit row. */
|
|
668
|
+
unitId: string;
|
|
669
|
+
/** Units priced: at least the floor, at most the model's per-request cap in started hundreds. */
|
|
670
|
+
units: number;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* The parts of a `<model>:per-100-chars:<N>u` id, or undefined for any other id
|
|
674
|
+
* — including a model that is not a speech model under its canonical id, and a
|
|
675
|
+
* unit count no request on that model can be priced at (below the floor, or
|
|
676
|
+
* above the model's cap in started hundreds).
|
|
677
|
+
*/
|
|
678
|
+
declare function parseSpeechQuoteCreditId(id: string): SpeechQuoteCreditIdParts | undefined;
|
|
679
|
+
/**
|
|
680
|
+
* Whether an id is a length price of speech — a `<model>:per-100-chars` unit
|
|
681
|
+
* row or a `<model>:per-100-chars:<N>u` request quote — by its shape alone.
|
|
682
|
+
* Both are served only while the server prices speech by length.
|
|
683
|
+
*/
|
|
684
|
+
declare function isSpeechLengthPriceId(id: string): boolean;
|
|
685
|
+
/**
|
|
686
|
+
* The speech model a length price id is priced for — the id a request of
|
|
687
|
+
* that model is reserved at, so the two are priced under the same id — or
|
|
688
|
+
* undefined for any other id.
|
|
689
|
+
*/
|
|
690
|
+
declare function speechLengthPriceModel(id: string): string | undefined;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* The price of a whole run priced per unit, as ONE id.
|
|
694
|
+
*
|
|
695
|
+
* Some runs are charged a multiple of a one-unit price row: minutes of an
|
|
696
|
+
* Apply EDL or Speaker View render, 5-second steps of a Trim / Loop / Combine
|
|
697
|
+
* / Mask Composite result, seconds of an LTX extend or retake, started
|
|
698
|
+
* hundreds of a speech text. The server prices such a run as a whole — the
|
|
699
|
+
* row's base × the units, marked up ONCE and rounded up once — so a client
|
|
700
|
+
* that multiplies the served one-unit price (already rounded up) by the units
|
|
701
|
+
* can quote more than the run is charged.
|
|
702
|
+
*
|
|
703
|
+
* `unitQuoteCreditId(rateId, units)` names that whole price:
|
|
704
|
+
* `<rateId>:<units>u`. `POST /v1/credits/model-costs` and
|
|
705
|
+
* `GET /v1/credits/model-cost` answer it with the figure the run is charged,
|
|
706
|
+
* for a rate the server charges per unit and a unit count a run can have;
|
|
707
|
+
* any other id lands in `missing`. A client quotes that answer rather than
|
|
708
|
+
* multiplying. (A speech request's id, `<model>:per-100-chars:<N>u`, is this
|
|
709
|
+
* id on the model's per-100-characters row.)
|
|
710
|
+
*
|
|
711
|
+
* Units may be fractional — a retake window is set to the frame — and are
|
|
712
|
+
* written exactly as JavaScript prints the number, so the server reads back
|
|
713
|
+
* the same value the client priced.
|
|
714
|
+
*/
|
|
715
|
+
/** `<rateId>:<units>u` — the id of the whole price of `units` of `rateId`. */
|
|
716
|
+
declare function unitQuoteCreditId(rateId: string, units: number): string;
|
|
717
|
+
/** A `<rateId>:<units>u` id, read back. */
|
|
718
|
+
interface UnitQuoteCreditIdParts {
|
|
719
|
+
/** The one-unit price row. */
|
|
720
|
+
rateId: string;
|
|
721
|
+
/** How many of it the run is priced at (a positive number, possibly fractional). */
|
|
722
|
+
units: number;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* The parts of a `<rateId>:<units>u` id by its shape alone, or undefined. Which
|
|
726
|
+
* rates the server prices this way, and at how many units, is the server's to
|
|
727
|
+
* say: an id it does not price lands in `missing`.
|
|
728
|
+
*/
|
|
729
|
+
declare function parseUnitQuoteCreditId(id: string): UnitQuoteCreditIdParts | undefined;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* The price of a whole Voice Changer Pro convert, as ONE id.
|
|
733
|
+
*
|
|
734
|
+
* A convert is charged as one whole: every changed speaker's slot is priced in
|
|
735
|
+
* base credits (a recast slot by the length of its stem, a Re-speak slot by
|
|
736
|
+
* its characters on its engine's row), the slots are summed, and the sum is
|
|
737
|
+
* marked up ONCE at `voice-changer-pro`. A client that prices each slot on the
|
|
738
|
+
* served (already marked-up, already rounded) rows and adds them up cannot
|
|
739
|
+
* reach that figure: the rounding happens in a different place.
|
|
740
|
+
*
|
|
741
|
+
* `voiceChangerProQuoteCreditId(slots)` names the whole price:
|
|
742
|
+
* `voice-changer-pro:<slot>,<slot>,…`, one slot per changed speaker, where a
|
|
743
|
+
* slot is
|
|
744
|
+
*
|
|
745
|
+
* - `sts-<seconds>` — a recast (speech-to-speech) slot whose stem is that
|
|
746
|
+
* many seconds long (the speaker's last utterance end); `sts` alone when
|
|
747
|
+
* the length is unknown (priced as one minute, as the convert reserves it);
|
|
748
|
+
* - `respeak-<chars>` — a Re-speak slot on the default engine (v3) that
|
|
749
|
+
* re-speaks that many characters; `respeak` alone when the count is unknown;
|
|
750
|
+
* - `respeak-v4-<chars>` — a Re-speak slot on the v4 engine (`respeak-v4`
|
|
751
|
+
* when the count is unknown); `respeak-v3-<chars>` names v3 explicitly
|
|
752
|
+
* and is the same price as `respeak-<chars>`;
|
|
753
|
+
* - `respeak-v4t-<chars>` — a v4 slot speaking a TRANSLATION of its
|
|
754
|
+
* `<chars>` transcript characters. The convert reserves such a slot for more
|
|
755
|
+
* speech than its transcript holds (a line may be re-rendered once,
|
|
756
|
+
* shorter); the server applies that allowance, so the client sends the
|
|
757
|
+
* transcript's own count and never the arithmetic. Only v4 speaks a
|
|
758
|
+
* translation, so there is no `v3t`.
|
|
759
|
+
*
|
|
760
|
+
* `POST /v1/credits/model-costs` and `GET /v1/credits/model-cost` answer it
|
|
761
|
+
* with the figure the convert reserves; an id the server does not price
|
|
762
|
+
* (a malformed slot, more slots than a convert takes, a count out of range)
|
|
763
|
+
* lands in `missing`. Numbers are written exactly as JavaScript prints them,
|
|
764
|
+
* so the server reads back the value the client priced.
|
|
765
|
+
*/
|
|
766
|
+
/** The id a convert is reserved (and marked up) at. */
|
|
767
|
+
declare const VOICE_CHANGER_PRO_QUOTE_RATE_ID = "voice-changer-pro";
|
|
768
|
+
/** A Re-speak engine, as the quote names it. */
|
|
769
|
+
type VoiceChangerProQuoteRespeakEngine = "v3" | "v4";
|
|
770
|
+
/** One changed speaker of a convert, as the quote prices it. */
|
|
771
|
+
type VoiceChangerProQuoteSlot =
|
|
772
|
+
/** A recast slot: the stem's length in seconds; `null` (or not a positive number) = unknown. */
|
|
773
|
+
{
|
|
774
|
+
readonly kind: "sts";
|
|
775
|
+
readonly seconds: number | null;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* A Re-speak slot: the characters of its transcript; `null` (or not a
|
|
779
|
+
* positive number) = unknown. `engine` absent = the default engine (v3).
|
|
780
|
+
* `translated` = the slot speaks the plan's target language — read only on
|
|
781
|
+
* v4, the one engine that speaks a translation (the convert route reads it
|
|
782
|
+
* the same way).
|
|
783
|
+
*/
|
|
784
|
+
| {
|
|
785
|
+
readonly kind: "respeak";
|
|
786
|
+
readonly chars: number | null;
|
|
787
|
+
readonly engine?: VoiceChangerProQuoteRespeakEngine;
|
|
788
|
+
readonly translated?: boolean;
|
|
789
|
+
};
|
|
790
|
+
/** A `voice-changer-pro:<slots>` id, read back into the convert's pricing inputs (slot order kept per kind). */
|
|
791
|
+
interface VoiceChangerProQuoteCreditIdParts {
|
|
792
|
+
/** Stem seconds per recast slot; `null` = unknown. */
|
|
793
|
+
readonly stsSlotSeconds: ReadonlyArray<number | null>;
|
|
794
|
+
/** Transcript characters per Re-speak slot; `null` = unknown. */
|
|
795
|
+
readonly respeakChars: ReadonlyArray<number | null>;
|
|
796
|
+
/** The engine of each Re-speak slot, index-aligned with `respeakChars`; `null` = not named (the default engine). */
|
|
797
|
+
readonly respeakEngines: ReadonlyArray<VoiceChangerProQuoteRespeakEngine | null>;
|
|
798
|
+
/** Whether each Re-speak slot speaks a translation, index-aligned with `respeakChars` (only ever true on v4). */
|
|
799
|
+
readonly respeakTranslated: ReadonlyArray<boolean>;
|
|
800
|
+
}
|
|
801
|
+
/** `voice-changer-pro:<slot>,…` — the id of the whole price of a convert with these changed speakers. */
|
|
802
|
+
declare function voiceChangerProQuoteCreditId(slots: ReadonlyArray<VoiceChangerProQuoteSlot>): string;
|
|
803
|
+
/**
|
|
804
|
+
* The parts of a `voice-changer-pro:<slots>` id by its shape alone, or
|
|
805
|
+
* undefined (not such an id, an empty or malformed slot). How many slots and
|
|
806
|
+
* what counts the server prices is the server's to say: an id it does not
|
|
807
|
+
* price lands in `missing`.
|
|
808
|
+
*/
|
|
809
|
+
declare function parseVoiceChangerProQuoteCreditId(id: string): VoiceChangerProQuoteCreditIdParts | undefined;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Pitch & Tempo pricing — per STARTED minute of the input media (decided
|
|
813
|
+
* 2026-10-12), at least one minute, at most 30.
|
|
814
|
+
*
|
|
815
|
+
* One `model_pricing` row, `pitch-tempo`, holds the credits per minute; a run
|
|
816
|
+
* reserves `pitch-tempo:<N>m` (N = started minutes), which billing prices as
|
|
817
|
+
* that row × N — never a row of its own, so a retune of the rate row moves the
|
|
818
|
+
* route, the workflow run, the node's Run button and every estimate together.
|
|
819
|
+
* The same id is built by the route (from the probed length), the workflow run
|
|
820
|
+
* (the same probe) and the editor (the upstream length it knows).
|
|
821
|
+
*
|
|
822
|
+
* Worked examples at the row's listed rate of 20 (repeated in
|
|
823
|
+
* docs/nodes/processing-audio/pitch-tempo.md):
|
|
824
|
+
* 0:45 → 20, 1:00 → 20, 1:01 → 40, 3:10 → 80, 30:00 → 600.
|
|
825
|
+
*/
|
|
826
|
+
declare const PITCH_TEMPO_PRICING: {
|
|
827
|
+
/** The rate row: credits per started minute. Never reserved by itself. */
|
|
828
|
+
readonly RATE_CREDIT_ID: "pitch-tempo";
|
|
829
|
+
/** The longest input a run accepts, in seconds (the route refuses longer). */
|
|
830
|
+
readonly MAX_DURATION_SEC: 1800;
|
|
831
|
+
/** The most minutes a `pitch-tempo:<N>m` id can carry. */
|
|
832
|
+
readonly MAX_MINUTES: 30;
|
|
833
|
+
/** The rate row's launch value (admin-retunable in /admin/models). */
|
|
834
|
+
readonly CREDITS_PER_MINUTE_DEFAULT: 20;
|
|
835
|
+
};
|
|
836
|
+
/** The control ranges every surface validates against. */
|
|
837
|
+
declare const PITCH_TEMPO_LIMITS: {
|
|
838
|
+
readonly SEMITONES_MIN: -12;
|
|
839
|
+
readonly SEMITONES_MAX: 12;
|
|
840
|
+
readonly TEMPO_MIN: 0.5;
|
|
841
|
+
readonly TEMPO_MAX: 2;
|
|
842
|
+
};
|
|
843
|
+
/**
|
|
844
|
+
* Started minutes of an input of `durationSec` seconds: ceil(sec / 60), at
|
|
845
|
+
* least 1, at most 30. An unknown or non-positive length counts as one minute
|
|
846
|
+
* here; a quote of an unknown length names 30 instead
|
|
847
|
+
* ({@link pitchTempoQuoteCreditId}), and a run always measures.
|
|
848
|
+
*/
|
|
849
|
+
declare function pitchTempoStartedMinutes(durationSec: number | null | undefined): number;
|
|
850
|
+
/** `pitch-tempo:<N>m` — the id a run on an input of `durationSec` seconds reserves. */
|
|
851
|
+
declare function pitchTempoCreditId(durationSec: number | null | undefined): string;
|
|
852
|
+
/**
|
|
853
|
+
* The id a QUOTE names for an input of `durationSec` seconds — every estimate
|
|
854
|
+
* before a run. A known length is the id its run reserves
|
|
855
|
+
* ({@link pitchTempoCreditId}). An UNKNOWN length is the 30-minute id
|
|
856
|
+
* (decided 2026-10-13): a run measures the file before it reserves and refuses
|
|
857
|
+
* one it cannot measure or one over 30 minutes, so 30 minutes is the most any
|
|
858
|
+
* run can be charged and the quote is never below the charge.
|
|
859
|
+
*/
|
|
860
|
+
declare function pitchTempoQuoteCreditId(durationSec: number | null | undefined): string;
|
|
861
|
+
/** The minutes of a `pitch-tempo:<N>m` id (1 ≤ N ≤ 30), or `undefined` for any other id. */
|
|
862
|
+
declare function parsePitchTempoCreditId(id: string): {
|
|
863
|
+
minutes: number;
|
|
864
|
+
} | undefined;
|
|
865
|
+
/** rate × minutes, rounded up, at least 1 credit — what a `pitch-tempo:<N>m` id costs. */
|
|
866
|
+
declare function pitchTempoBaseCredits(ratePerMinute: number, minutes: number): number;
|
|
867
|
+
/** The frequency ratio for a shift of `semitones` (12 = one octave up = ×2). */
|
|
868
|
+
declare function semitonesToPitchRatio(semitones: number): number;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Topaz image upscale — the single authority for "which lever did the user
|
|
872
|
+
* pull, what do we send, and what do we charge".
|
|
873
|
+
*
|
|
874
|
+
* KIE's `topaz/image-upscale` takes exactly ONE quality lever:
|
|
875
|
+
* upscale_factor: "1" | "2" | "4" (default "2")
|
|
876
|
+
* There is no target-resolution parameter (docs.kie.ai/market/topaz/image-upscale,
|
|
877
|
+
* verified 2026-09-02). The editor nevertheless shipped TWO controls — an
|
|
878
|
+
* `upscaleFactor` select AND a `targetResolution` select (2K/4K/8K) — and billed
|
|
879
|
+
* on the second one, which never reached the worker. Everyone who bought 4K or
|
|
880
|
+
* 8K got a 2x render at 2x/4x the price (app-reports triage 2026-09-01 §4.3).
|
|
881
|
+
*
|
|
882
|
+
* So: the FACTOR is the lever. `targetResolution` survives only as a legacy
|
|
883
|
+
* input (stored node data, old API/MCP callers) and is mapped forward here.
|
|
884
|
+
* The credit tier is derived from the SAME resolution, which is why callers
|
|
885
|
+
* must pass `creditTier` into `buildCreditModelIdentifier` rather than the raw
|
|
886
|
+
* request value — that is what makes CHECK = DEBIT = SENT.
|
|
887
|
+
*
|
|
888
|
+
* The composite `topaz-image-upscale:4K` is retained as the id of the 4x tier
|
|
889
|
+
* (migration 288 wrote that row; renaming it would need a pricing migration for
|
|
890
|
+
* zero user-visible gain). Read it as "the top Topaz tier", not as a promise of
|
|
891
|
+
* 4096 pixels. `topaz-image-upscale:8K` stays priced in STATIC_CREDIT_COSTS so
|
|
892
|
+
* historical usage_logs still resolve, but nothing can reserve it any more.
|
|
893
|
+
*
|
|
894
|
+
* Resolution order (fix round 1, 2026-09-02 review):
|
|
895
|
+
* 1. Resolve the WINNING factor first — a valid `upscaleFactor` always wins;
|
|
896
|
+
* an invalid one falls through to `targetResolution` exactly as if it had
|
|
897
|
+
* never been sent, rather than freezing the default before the legacy
|
|
898
|
+
* tier gets a chance to raise it (an invalid factor + a stored 4K/8K tier
|
|
899
|
+
* must still resolve — and bill — at the tier's factor, not the default).
|
|
900
|
+
* 2. Only THEN build `adjustments`, so every `to` reflects the resolved
|
|
901
|
+
* factor rather than an intermediate guess, and every `from` is the raw,
|
|
902
|
+
* untransformed input string (never the trimmed/uppercased copy used
|
|
903
|
+
* internally to match).
|
|
904
|
+
* 3. A valid `upscaleFactor` alongside a `targetResolution` it disagrees
|
|
905
|
+
* with emits an informational (not corrective) adjustment — the stored
|
|
906
|
+
* legacy choice is being overridden, not silently dropped — with
|
|
907
|
+
* `to: undefined` because nothing was actually sent for that field.
|
|
908
|
+
* Agreement (they resolve to the same factor) is reported as nothing:
|
|
909
|
+
* there is no override to disclose.
|
|
910
|
+
*/
|
|
911
|
+
type TopazUpscaleFactor = "1" | "2" | "4";
|
|
912
|
+
declare const TOPAZ_UPSCALE_FACTORS: readonly TopazUpscaleFactor[];
|
|
913
|
+
/** KIE's own default when `upscale_factor` is omitted (providers/kie/models.ts). */
|
|
914
|
+
declare const TOPAZ_DEFAULT_UPSCALE_FACTOR: TopazUpscaleFactor;
|
|
915
|
+
interface TopazUpscaleAdjustment {
|
|
916
|
+
field: "upscaleFactor" | "targetResolution";
|
|
917
|
+
/** The raw, untransformed value as received — never trimmed or case-normalized. */
|
|
918
|
+
from: string;
|
|
919
|
+
/**
|
|
920
|
+
* The resolved factor this adjustment corresponds to, or `undefined` for the
|
|
921
|
+
* informational "your stored targetResolution was overridden" notice, which
|
|
922
|
+
* names nothing to switch TO — `upscaleFactor` already won.
|
|
923
|
+
*/
|
|
924
|
+
to: string | undefined;
|
|
925
|
+
reason: string;
|
|
926
|
+
}
|
|
927
|
+
interface TopazUpscaleResolution {
|
|
928
|
+
/** Sent to KIE as `upscale_factor`. Always set — never rely on the model default. */
|
|
929
|
+
upscaleFactor: TopazUpscaleFactor;
|
|
930
|
+
/**
|
|
931
|
+
* Passed VERBATIM as `buildCreditModelIdentifier`'s `targetResolution` arg.
|
|
932
|
+
* `undefined` = the bare id (1x / 2x); `"4K"` = the 4x tier.
|
|
933
|
+
*/
|
|
934
|
+
creditTier: "4K" | undefined;
|
|
935
|
+
/** Non-empty when a legacy or out-of-enum value was coerced or overridden. */
|
|
936
|
+
adjustments: TopazUpscaleAdjustment[];
|
|
937
|
+
}
|
|
938
|
+
declare function resolveTopazUpscale(input: {
|
|
939
|
+
upscaleFactor?: string | null;
|
|
940
|
+
targetResolution?: string | null;
|
|
941
|
+
}): TopazUpscaleResolution;
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Calculate the creator's monetization markup on a base credit cost.
|
|
945
|
+
* Returns the markup amount (not the total).
|
|
946
|
+
*/
|
|
947
|
+
declare function calculateMonetizationMarkup(baseCost: number, flatFee: number, percent: number): number;
|
|
948
|
+
/**
|
|
949
|
+
* Calculate the total cost a runner pays (base + markup).
|
|
950
|
+
*/
|
|
951
|
+
declare function calculateMonetizedCost(baseCost: number, flatFee: number, percent: number): number;
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Lip-sync per-second pricing helpers.
|
|
955
|
+
*
|
|
956
|
+
* KIE.ai Kling AI Avatar 2.0 (May 2026) raised the max input audio from 15s
|
|
957
|
+
* to 5 minutes and bills per-second. We bucket the requested audio duration
|
|
958
|
+
* into discrete tiers and use composite credit identifiers
|
|
959
|
+
* (e.g. `kling-avatar:60s`) so credit reservation scales with input length.
|
|
960
|
+
*
|
|
961
|
+
* InfiniTalk still enforces a 15s upstream cap.
|
|
962
|
+
*/
|
|
963
|
+
declare const LIP_SYNC_DURATION_BUCKETS: readonly [15, 30, 60, 120, 300];
|
|
964
|
+
type LipSyncDurationBucket = typeof LIP_SYNC_DURATION_BUCKETS[number];
|
|
965
|
+
/** Round a measured audio duration up to the next supported bucket. */
|
|
966
|
+
declare function pickLipSyncBucket(seconds: number): LipSyncDurationBucket;
|
|
967
|
+
/**
|
|
968
|
+
* Upper audio-duration limit per lip-sync provider, in seconds.
|
|
969
|
+
* Anything longer must be trimmed (server-side) before sending upstream.
|
|
970
|
+
*/
|
|
971
|
+
declare const LIP_SYNC_MAX_AUDIO_SECONDS: Record<string, number>;
|
|
972
|
+
declare function getLipSyncMaxAudioSeconds(provider: string): number;
|
|
973
|
+
declare function isPerSecondLipSyncProvider(provider: string): boolean;
|
|
974
|
+
/**
|
|
975
|
+
* Build the credit identifier for a lip-sync request.
|
|
976
|
+
*
|
|
977
|
+
* For kling-avatar / kling-avatar-pro, returns `<provider>:<bucket>s`.
|
|
978
|
+
* For other providers, returns the bare provider name (caller appends
|
|
979
|
+
* any extra dimensions like resolution).
|
|
980
|
+
*
|
|
981
|
+
* If `audioDurationSec` is missing, defaults to the provider's max cap so
|
|
982
|
+
* credit reservation covers the worst case and any overage is refunded
|
|
983
|
+
* after the worker reconciles the actual KIE cost.
|
|
984
|
+
*/
|
|
985
|
+
declare function buildLipSyncCreditId(provider: string, audioDurationSec: number | undefined): string;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* AI Avatar (HeyGen) duration-bucketing + credit-identifier helpers.
|
|
989
|
+
* Single source of truth for the NON-monetary side of ai-avatar billing
|
|
990
|
+
* (duration estimation, bucket selection, composite credit-id construction) —
|
|
991
|
+
* imported by the frontend node UI (to build the id it hands to the
|
|
992
|
+
* `/v1/credits/model-cost` display lookup) AND the backend route/orchestrator
|
|
993
|
+
* (to resolve the credit-guard reservation id pre-Zod).
|
|
994
|
+
*
|
|
995
|
+
* The provider-$ rate table and the USD/credit cost FORMULAS derived from it
|
|
996
|
+
* live in `backend/src/lib/pricing/ai-avatar-cost.ts` (core, not ee/ — the
|
|
997
|
+
* HeyGen provider integration needs them regardless of edition). They were
|
|
998
|
+
* moved out of this package (published Apache-2.0 on npm — an irrevocable
|
|
999
|
+
* grant) per the 2026-07-06 public-flip IP audit, S5.
|
|
1000
|
+
*/
|
|
1001
|
+
type AiAvatarEngine = "avatar-v" | "avatar-iv";
|
|
1002
|
+
type AiAvatarResolution = "720p" | "1080p" | "4k";
|
|
1003
|
+
/**
|
|
1004
|
+
* Worst-case clip duration used as the credit-reserve ceiling.
|
|
1005
|
+
* A 5000-character script at voiceSpeed 0.5 ≈ 5000/12/0.5 ≈ 833s → top bucket 900s.
|
|
1006
|
+
*/
|
|
1007
|
+
declare const AI_AVATAR_MAX_DURATION_SEC = 900;
|
|
1008
|
+
/**
|
|
1009
|
+
* Duration buckets (seconds) used to pick a reserve ceiling at creditGuard
|
|
1010
|
+
* time, when the actual clip length is unknown (text-mode scripts) or only
|
|
1011
|
+
* known via a server-side ffprobe (audio mode).
|
|
1012
|
+
*
|
|
1013
|
+
* The low end is FINE-GRAINED (5/10/15/30/60s) so short clips — the common
|
|
1014
|
+
* case — don't over-reserve. A 15s clip lands in the 15s bucket, not the old
|
|
1015
|
+
* coarse 30s floor (which doubled the hold). The high end stays coarse because
|
|
1016
|
+
* long-form scripts are rare and the bucket-up is a one-time refundable surplus.
|
|
1017
|
+
*
|
|
1018
|
+
* Bucket selection:
|
|
1019
|
+
* - Text mode: bucket = pickAiAvatarBucket(ceil(scriptChars / 12 / voiceSpeed)).
|
|
1020
|
+
* - Audio mode: bucket = pickAiAvatarBucket(ceil(probedDurationSec)) when the
|
|
1021
|
+
* ffprobe preHandler stashed `__probedDurationSec` on the body; otherwise a
|
|
1022
|
+
* MODEST 120s default (NOT the 900s top bucket — that was the bug: it
|
|
1023
|
+
* reserved ~4000+ credits for a sub-minute clip).
|
|
1024
|
+
*
|
|
1025
|
+
* Worst-case derivation: 5000 chars at voiceSpeed=0.5 → ceil(5000/12/0.5) = 834s
|
|
1026
|
+
* → fits in 900s bucket. The 900s top bucket covers all legal text inputs.
|
|
1027
|
+
*
|
|
1028
|
+
* Note: audio >900s (no probe) would undercharge against the 120s default, but
|
|
1029
|
+
* the commit-time metered true-up CANNOT charge more than reserved — so a long
|
|
1030
|
+
* un-probed audio clip is a (small) revenue leak, not an over-charge. The probe
|
|
1031
|
+
* closes it for the normal path. The 900s bucket remains available for the
|
|
1032
|
+
* probed long-audio case.
|
|
1033
|
+
*/
|
|
1034
|
+
declare const AI_AVATAR_DURATION_BUCKETS: readonly [5, 10, 15, 30, 60, 120, 240, 360, 600, 900];
|
|
1035
|
+
/**
|
|
1036
|
+
* Hard cap (seconds) on AUDIO-mode clip length. HeyGen has no natural length
|
|
1037
|
+
* limit on an audio-driven avatar, so a long audio = an expensive / possibly
|
|
1038
|
+
* rejected generation and a bounded under-reserve window. We cap it here:
|
|
1039
|
+
* - The worker TRIMS incoming audio longer than this down to AI_AVATAR_MAX_AUDIO_SEC
|
|
1040
|
+
* (and warns the user, non-fatal).
|
|
1041
|
+
* - The credit RESERVE is capped at this bucket too: even a 30-min probed
|
|
1042
|
+
* audio buckets at 600s, never the 900s top bucket. Because the worker
|
|
1043
|
+
* trims the actual clip to ≤600s, the metered true-up can only refund.
|
|
1044
|
+
*
|
|
1045
|
+
* Text mode (5000-char script) and cinematic (4–15s) are bounded elsewhere and
|
|
1046
|
+
* are NOT affected by this cap.
|
|
1047
|
+
*/
|
|
1048
|
+
declare const AI_AVATAR_MAX_AUDIO_SEC = 600;
|
|
1049
|
+
type AiAvatarDurationBucket = (typeof AI_AVATAR_DURATION_BUCKETS)[number];
|
|
1050
|
+
/**
|
|
1051
|
+
* Estimate script duration in seconds from character count and voice speed.
|
|
1052
|
+
*
|
|
1053
|
+
* Uses ~12 chars/sec at normal speed (voiceSpeed=1) — deliberately generous
|
|
1054
|
+
* (biased high) so the credit hold covers TTS pacing variations. Slower speech
|
|
1055
|
+
* (voiceSpeed < 1) produces a longer clip and thus a higher estimate.
|
|
1056
|
+
* Minimum 1s.
|
|
1057
|
+
*
|
|
1058
|
+
* @param script Script text (undefined treated as empty).
|
|
1059
|
+
* @param voiceSpeed HeyGen voice speed parameter, range 0.5–1.5 (default 1).
|
|
1060
|
+
* Slower speed → more seconds → higher hold.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function estimateScriptDurationSec(script: string | undefined, voiceSpeed?: number): number;
|
|
1063
|
+
/**
|
|
1064
|
+
* Pick the smallest duration bucket that is ≥ sec.
|
|
1065
|
+
* Falls back to the maximum bucket (900s) when sec exceeds all buckets.
|
|
1066
|
+
*/
|
|
1067
|
+
declare function pickAiAvatarBucket(sec: number): AiAvatarDurationBucket;
|
|
1068
|
+
/**
|
|
1069
|
+
* Composite credit identifier for a duration-bucketed reserve.
|
|
1070
|
+
*
|
|
1071
|
+
* Format: `"heygen-<engine>:<resolution>:<bucketSec>s"`
|
|
1072
|
+
* e.g. `"heygen-avatar-iv:720p:60s"`.
|
|
1073
|
+
*/
|
|
1074
|
+
declare function aiAvatarReserveCreditId(engine: AiAvatarEngine, resolution: AiAvatarResolution, bucketSec: number): string;
|
|
1075
|
+
/**
|
|
1076
|
+
* Resolve the credit identifier from a raw request body BEFORE Zod validation.
|
|
1077
|
+
* Called at creditGuard preHandler time — mirrors how `resolveLipSyncIdentifier`
|
|
1078
|
+
* reads the raw body in `backend/src/routes/lip-sync.ts`.
|
|
1079
|
+
*
|
|
1080
|
+
* - `speechMode === "text"`: bucket by estimated script duration, accounting for
|
|
1081
|
+
* voiceSpeed (slower → longer clip → larger bucket). Surplus is refunded at commit.
|
|
1082
|
+
* - Any other speechMode (audio / missing): bucket by `__probedDurationSec` when
|
|
1083
|
+
* the ffprobe preHandler stashed it on the raw body; otherwise a MODEST 120s
|
|
1084
|
+
* default (AI_AVATAR_AUDIO_FALLBACK_SEC) — NOT the 900s top bucket. Reserving
|
|
1085
|
+
* the 900s ceiling for a sub-minute audio clip was the over-reservation bug
|
|
1086
|
+
* (~4000+ credits held for a clip that costs ~40). The commit-time metered
|
|
1087
|
+
* true-up is refund-only, so a modest reserve never over-charges. The effective
|
|
1088
|
+
* seconds are ALSO capped at AI_AVATAR_MAX_AUDIO_SEC (600s) — the worker trims
|
|
1089
|
+
* audio longer than that, so a 30-min audio reserves the 600s bucket, never 900s.
|
|
1090
|
+
*
|
|
1091
|
+
* - `avatarSource === "image"`: image-source mode is IV-class (HeyGen's own
|
|
1092
|
+
* engine, no avatar_id) — bill at the avatar-iv rate regardless of the
|
|
1093
|
+
* (ignored) `engine` field, reusing the existing heygen-avatar-iv:* ids.
|
|
1094
|
+
*
|
|
1095
|
+
* Falls back to ("avatar-iv", "720p", 120s) when fields are missing or invalid.
|
|
1096
|
+
*/
|
|
1097
|
+
declare function resolveAiAvatarCreditId(body: Record<string, unknown> | undefined): string;
|
|
1098
|
+
/**
|
|
1099
|
+
* All 60 reserve credit IDs — every (engine × resolution × bucket) combination.
|
|
1100
|
+
* 2 engines × 3 resolutions × 10 buckets (5/10/15/30/60/120/240/360/600/900s) = 60.
|
|
1101
|
+
* Seeded in STATIC_CREDIT_COSTS and the model_pricing migration so
|
|
1102
|
+
* getModelCreditBaseCost never hard-fails (503 price_not_configured) for any
|
|
1103
|
+
* legal creditGuard input.
|
|
1104
|
+
*/
|
|
1105
|
+
declare const AI_AVATAR_RESERVE_IDS: string[];
|
|
1106
|
+
|
|
1107
|
+
declare const SWITCHX_FRAME_TIERS: readonly [30, 60, 90, 120, 150, 180, 210, 240];
|
|
1108
|
+
/** Beeble's metering granularity: frames per billed block. */
|
|
1109
|
+
declare const SWITCHX_BLOCK_FRAMES = 30;
|
|
1110
|
+
declare function pickSwitchXFrameTier(frames?: number): number;
|
|
1111
|
+
declare function resolveSwitchXCreditId(body: Record<string, unknown>): string;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Cinematic Avatar (HeyGen `type:"cinematic_avatar"`) duration-clamping +
|
|
1115
|
+
* credit-identifier helpers. Single source of truth for the NON-monetary side
|
|
1116
|
+
* of cinematic-avatar billing — imported by the frontend node UI and the
|
|
1117
|
+
* backend route/orchestrator.
|
|
1118
|
+
*
|
|
1119
|
+
* The provider-$ rate table and the USD/credit cost FORMULAS derived from it
|
|
1120
|
+
* live in `backend/src/lib/pricing/cinematic-avatar-cost.ts` (core, not ee/ —
|
|
1121
|
+
* the HeyGen provider integration needs them regardless of edition). They
|
|
1122
|
+
* were moved out of this package (published Apache-2.0 on npm — an
|
|
1123
|
+
* irrevocable grant) per the 2026-07-06 public-flip IP audit, S5.
|
|
1124
|
+
*
|
|
1125
|
+
* ─── How this differs from ai-avatar pricing ────────────────────────────────
|
|
1126
|
+
* Cinematic Avatar is a generative clip (Seedance-style pipeline) driven by a
|
|
1127
|
+
* prompt + 1–3 avatar look ids. Crucially, `duration` is a USER PARAMETER
|
|
1128
|
+
* (4–15s, clamped) and is therefore KNOWN at submit time — unlike ai-avatar's
|
|
1129
|
+
* text/audio script whose clip length is only estimated. So the reserve here is
|
|
1130
|
+
* EXACT (no duration-bucket estimation): the credit id encodes the exact
|
|
1131
|
+
* requested duration, and the metered true-up at commit refunds nothing in the
|
|
1132
|
+
* common case (provider returns the requested duration).
|
|
1133
|
+
* ────────────────────────────────────────────────────────────────────────────
|
|
1134
|
+
*/
|
|
1135
|
+
type CinematicResolution = "720p" | "1080p";
|
|
1136
|
+
/** Minimum / maximum / default user-selectable duration (seconds). */
|
|
1137
|
+
declare const CINEMATIC_MIN_DURATION_SEC = 4;
|
|
1138
|
+
declare const CINEMATIC_MAX_DURATION_SEC = 15;
|
|
1139
|
+
declare const CINEMATIC_DEFAULT_DURATION_SEC = 10;
|
|
1140
|
+
declare const CINEMATIC_DEFAULT_RESOLUTION: CinematicResolution;
|
|
1141
|
+
/**
|
|
1142
|
+
* Clamp a (possibly invalid) duration to the legal 4–15s range, rounding to a
|
|
1143
|
+
* whole second. Falls back to the default (10s) for non-finite input.
|
|
1144
|
+
*/
|
|
1145
|
+
declare function clampCinematicDuration(durationSec: number | undefined): number;
|
|
1146
|
+
/**
|
|
1147
|
+
* Composite credit identifier for an EXACT-duration reserve.
|
|
1148
|
+
*
|
|
1149
|
+
* Format: `cinematic-avatar:<resolution>:<durationSec>s`
|
|
1150
|
+
* e.g. `cinematic-avatar:720p:10s`.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function cinematicCreditId(resolution: CinematicResolution, durationSec: number): string;
|
|
1153
|
+
/**
|
|
1154
|
+
* Resolve the credit identifier from a raw request body BEFORE Zod validation.
|
|
1155
|
+
* Called at creditGuard preHandler time — mirrors resolveAiAvatarCreditId.
|
|
1156
|
+
*
|
|
1157
|
+
* Reads `resolution` (default 720p) and `duration` (default 10, clamped 4–15)
|
|
1158
|
+
* straight off the raw body. Because duration is a user parameter known at
|
|
1159
|
+
* submit time, the reserve id is EXACT — no bucketing.
|
|
1160
|
+
*
|
|
1161
|
+
* ─── autoDuration → reserve at the MAX-duration ceiling ──────────────────────
|
|
1162
|
+
* When `autoDuration` is true, the provider DROPS `duration` and HeyGen picks
|
|
1163
|
+
* the clip length itself, so the actual metered length is UNKNOWN at submit
|
|
1164
|
+
* time and can exceed the requested/default `duration`. The metered true-up at
|
|
1165
|
+
* commit (commit_credits) can ONLY refund a surplus — it never charges more
|
|
1166
|
+
* when the actual exceeds the reserved hold. Reserving under the default-10s
|
|
1167
|
+
* hold therefore silently undercharges any auto clip longer than 10s (a revenue
|
|
1168
|
+
* leak). To preserve the refund-only invariant, reserve under the MAXIMUM
|
|
1169
|
+
* possible hold (`cinematic-avatar:<res>:15s`) so the true-up can only refund.
|
|
1170
|
+
*/
|
|
1171
|
+
declare function resolveCinematicCreditId(body: Record<string, unknown> | undefined): string;
|
|
1172
|
+
/**
|
|
1173
|
+
* All 24 reserve credit IDs — every (resolution × duration) combination.
|
|
1174
|
+
* 2 resolutions × 12 durations (4..15s) = 24.
|
|
1175
|
+
* Seeded in STATIC_CREDIT_COSTS and the model_pricing migration so
|
|
1176
|
+
* getModelCreditBaseCost never hard-fails (503 price_not_configured) for any
|
|
1177
|
+
* legal creditGuard input.
|
|
1178
|
+
*/
|
|
1179
|
+
declare const CINEMATIC_RESERVE_IDS: string[];
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Shared structural validators for the ai-avatar and cinematic-avatar payloads.
|
|
1183
|
+
*
|
|
1184
|
+
* ─── Why this exists ─────────────────────────────────────────────────────────
|
|
1185
|
+
* The route Zod schemas (`aiAvatarBody` / `cinematicAvatarBody`) only protect the
|
|
1186
|
+
* single-node Run path. Workflow runs, published-app runs, MCP run_workflow, and
|
|
1187
|
+
* imported/crafted workflow JSON all assemble a payload in
|
|
1188
|
+
* `payload-builder.ts` and forward it straight to the worker → provider →
|
|
1189
|
+
* HeyGen with NO Zod parse in between. That structural gap is the root cause of
|
|
1190
|
+
* the avatar edge-case findings: missing/over-count avatarLooks, reference caps,
|
|
1191
|
+
* source/speech-conditional requireds, and voice-param ranges all reach HeyGen
|
|
1192
|
+
* unvalidated on those paths.
|
|
1193
|
+
*
|
|
1194
|
+
* These validators reproduce the route Zod's invariants (minus the userId /
|
|
1195
|
+
* workflow wrapper and minus the URL-host allowlist — orchestrated URLs come
|
|
1196
|
+
* from trusted upstream R2 outputs). They run inside the `ai-avatar` /
|
|
1197
|
+
* `cinematic-avatar` cases of `payload-builder.ts` on the ASSEMBLED payload,
|
|
1198
|
+
* throwing `AvatarPayloadError` BEFORE credit reservation + enqueue. The
|
|
1199
|
+
* node-executor catches the throw and deletes the orphaned pending job, so both
|
|
1200
|
+
* entry points are correct-by-construction rather than relying on the route as
|
|
1201
|
+
* the only gate.
|
|
1202
|
+
*
|
|
1203
|
+
* Keep these in sync with `backend/src/routes/ai-avatar.ts` and
|
|
1204
|
+
* `backend/src/routes/cinematic-avatar.ts`.
|
|
1205
|
+
*/
|
|
1206
|
+
/** Thrown by the avatar payload validators on a structurally-invalid payload. */
|
|
1207
|
+
declare class AvatarPayloadError extends Error {
|
|
1208
|
+
constructor(message: string);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Validate an assembled ai-avatar payload (post-default-application).
|
|
1212
|
+
* Mirrors `aiAvatarBody` (`backend/src/routes/ai-avatar.ts`): enum bounds,
|
|
1213
|
+
* source/speech-conditional requireds, script length, and voice-param ranges.
|
|
1214
|
+
*
|
|
1215
|
+
* @throws AvatarPayloadError on any violation.
|
|
1216
|
+
*/
|
|
1217
|
+
declare function validateAiAvatarPayload(payload: Record<string, unknown>): void;
|
|
1218
|
+
declare const CINEMATIC_PROMPT_MAX = 10000;
|
|
1219
|
+
/** HeyGen combined reference caps: ≤3 videos and ≤9 images across avatar looks + references. */
|
|
1220
|
+
declare const CINEMATIC_MAX_REFERENCE_VIDEOS = 3;
|
|
1221
|
+
declare const CINEMATIC_MAX_REFERENCE_IMAGES = 9;
|
|
1222
|
+
declare const CINEMATIC_MIN_LOOKS = 1;
|
|
1223
|
+
declare const CINEMATIC_MAX_LOOKS = 3;
|
|
1224
|
+
/**
|
|
1225
|
+
* Validate an assembled cinematic-avatar payload.
|
|
1226
|
+
* Mirrors `cinematicAvatarBody` (`backend/src/routes/cinematic-avatar.ts`):
|
|
1227
|
+
* prompt presence/length, avatarLooks count (1–3), enum bounds, and the
|
|
1228
|
+
* combined reference caps (≤3 videos; avatarLooks + image refs ≤ 9).
|
|
1229
|
+
*
|
|
1230
|
+
* @throws AvatarPayloadError on any violation.
|
|
1231
|
+
*/
|
|
1232
|
+
declare function validateCinematicAvatarPayload(payload: Record<string, unknown>): void;
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Effective-tier resolution — the payg derivation.
|
|
1236
|
+
*
|
|
1237
|
+
* "payg" is a DERIVED tier, never stored: a user whose stored tier resolves
|
|
1238
|
+
* to "free" but who has NET lifetime top-up credits (granted − refunded,
|
|
1239
|
+
* clamped ≥ 0 by every SQL writer) is treated as "payg" by entitlement
|
|
1240
|
+
* checks. Stored tier stays untouched, so subscription webhooks never learn
|
|
1241
|
+
* about payg and a cancel→free transition re-derives it automatically.
|
|
1242
|
+
*
|
|
1243
|
+
* Lives in @nodaro/shared because the pipeline tier maps already do, and
|
|
1244
|
+
* both backend (credit gates, workers) and read surfaces need one source.
|
|
1245
|
+
*
|
|
1246
|
+
* The profile fields are REQUIRED (non-optional) on purpose: a call site
|
|
1247
|
+
* whose SELECT forgot to fetch `lifetime_topup_credits` becomes a compile
|
|
1248
|
+
* error instead of a silent `?? 0` that quietly deactivates payg — that is
|
|
1249
|
+
* the failure mode this shape exists to prevent.
|
|
1250
|
+
*/
|
|
1251
|
+
/** Stored-tier resolution — mirrors SQL COALESCE(tier, subscription_tier, 'free'). */
|
|
1252
|
+
declare function resolveStoredTier(p: {
|
|
1253
|
+
tier: string | null;
|
|
1254
|
+
subscription_tier: string | null;
|
|
1255
|
+
}): string;
|
|
1256
|
+
/**
|
|
1257
|
+
* Effective tier: stored "free" with NET lifetime top-ups > 0 derives "payg".
|
|
1258
|
+
* Every other stored tier passes through untouched.
|
|
1259
|
+
*/
|
|
1260
|
+
declare function resolveEffectiveTier(p: {
|
|
1261
|
+
tier: string | null;
|
|
1262
|
+
subscription_tier: string | null;
|
|
1263
|
+
lifetime_topup_credits: number;
|
|
1264
|
+
}): string;
|
|
1265
|
+
/** Media-retention activity window for payg users (design 2026-07-05 §4.6). */
|
|
1266
|
+
declare const PAYG_RETENTION_DAYS = 90;
|
|
1267
|
+
/**
|
|
1268
|
+
* Is this payg user inside their retention-activity window?
|
|
1269
|
+
*
|
|
1270
|
+
* Activity = credit SPEND (callers supply MAX(usage_logs.created_at) — never
|
|
1271
|
+
* `last_daily_reset`, which read-only balance polls bump) OR a top-up
|
|
1272
|
+
* PURCHASE (`last_topup_at`). Within PAYG_RETENTION_DAYS of either → the
|
|
1273
|
+
* nightly reaper leaves their media alone; past it, the standard free-tier
|
|
1274
|
+
* reaper rules apply. A user with no lifetime purchases is never
|
|
1275
|
+
* retention-active (they are not payg).
|
|
1276
|
+
*/
|
|
1277
|
+
declare function isPaygRetentionActive(p: {
|
|
1278
|
+
lifetimeTopupCredits: number;
|
|
1279
|
+
lastTopupAt: string | Date | null;
|
|
1280
|
+
lastSpendAt: string | Date | null;
|
|
1281
|
+
}, now: Date): boolean;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Video-analysis pricing — shared duration-bucket credit model.
|
|
1285
|
+
*
|
|
1286
|
+
* Single source of truth for the video-analysis node's NON-monetary credit
|
|
1287
|
+
* math: duration bucketing, the window-batching constants (also consumed by
|
|
1288
|
+
* the backend workers for real chunking, not just pricing), and the
|
|
1289
|
+
* composite credit-id builder. The route (charge at generate-time), the
|
|
1290
|
+
* worker (re-check + settle), and the frontend node UI (via
|
|
1291
|
+
* `buildVideoAnalysisCreditId` + `/v1/credits/model-cost`) all derive from
|
|
1292
|
+
* these.
|
|
1293
|
+
*
|
|
1294
|
+
* The rate constants and the formula that GENERATE these numbers live
|
|
1295
|
+
* PRIVATELY in the `@nodaroai/cloud-plugins` package — never in this public
|
|
1296
|
+
* repo. They were first moved out of this package (published Apache-2.0 on
|
|
1297
|
+
* npm), then out of the app repo entirely alongside the rest of the
|
|
1298
|
+
* video-analysis node. A cross-check test in that private package guards
|
|
1299
|
+
* this table so the public numbers can't silently drift from the formula.
|
|
1300
|
+
*
|
|
1301
|
+
* `VIDEO_ANALYSIS_BUCKET_CREDITS` below is the precomputed OUTPUT of that
|
|
1302
|
+
* private formula for every (model × bucket) combination — a plain credit
|
|
1303
|
+
* lookup table, not a formula, mirroring the same wire-contract pattern
|
|
1304
|
+
* `VIDEO_CLIP_CREDITS` uses in `film-pricing.ts`. It is what the frontend's
|
|
1305
|
+
* client-side cost preview (`estimateNodeCredits` in
|
|
1306
|
+
* workflow-editor/types.ts) reads instead of calling the formula directly.
|
|
1307
|
+
* The formula's own test in `@nodaroai/cloud-plugins` cross-checks this
|
|
1308
|
+
* table against it and fails on drift. There is deliberately NO app-side formula to
|
|
1309
|
+
* check against — it was moved private in 2026-07 and the old backend test
|
|
1310
|
+
* went with it.
|
|
1311
|
+
*
|
|
1312
|
+
* `VIDEO_AUDIT_BUCKET_CREDITS` further down is the sibling table for the
|
|
1313
|
+
* `video-audit` node ("AI Audit") — same module, same bucket ladder, same
|
|
1314
|
+
* generator-authoritative pattern, its own two credit families.
|
|
1315
|
+
*/
|
|
1316
|
+
declare const VIDEO_ANALYSIS_DURATION_BUCKETS: readonly [60, 180, 360, 600];
|
|
1317
|
+
/** Pricing grace: a clip at most this far past a bucket edge is priced at that
|
|
1318
|
+
* bucket. A part chosen as 1:00 in the Video URL chooser downloads at about
|
|
1319
|
+
* 1:03 (the cut lands on keyframes), and must cost a minute, not three. Read
|
|
1320
|
+
* by pickVideoAnalysisBucket — the ONE bucket picker every price reads (the
|
|
1321
|
+
* editor estimate, the orchestrator reserve, the cloud routes). */
|
|
1322
|
+
declare const VIDEO_ANALYSIS_BUCKET_GRACE_SEC = 3;
|
|
1323
|
+
/** Worker re-check grace: route metadata is integer-rounded, provider durations nominal;
|
|
1324
|
+
* ffprobe floats run 0.05–2 s over. Zero tolerance fails legit videos at 1:00/3:00/6:00/10:00.
|
|
1325
|
+
* It sits ON TOP of the pricing grace: a clip the grace priced into a bucket
|
|
1326
|
+
* (probe 63 s → 60 s) must still pass the worker gate (bucket + tolerance) at
|
|
1327
|
+
* its float length (63.4 s). The cloud plugin reads this constant from the
|
|
1328
|
+
* host app at run time, so its gate moves with it. */
|
|
1329
|
+
declare const VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC: number;
|
|
1330
|
+
declare const VIDEO_ANALYSIS_MAX_DURATION_SEC = 600;
|
|
1331
|
+
declare const VIDEO_ANALYSIS_WINDOW: {
|
|
1332
|
+
readonly LEN: 150;
|
|
1333
|
+
readonly STRIDE: 145;
|
|
1334
|
+
readonly OVERLAP: 5;
|
|
1335
|
+
readonly SINGLE_MAX: 180;
|
|
1336
|
+
};
|
|
1337
|
+
/**
|
|
1338
|
+
* Precomputed credit cost per (model, bucket) — the OUTPUT of the private
|
|
1339
|
+
* `videoAnalysisBucketCredits` formula (in `@nodaroai/cloud-plugins`), not a
|
|
1340
|
+
* formula itself. Regenerate by running that function for every
|
|
1341
|
+
* `VIDEO_ANALYSIS_LLM_MODELS` × duration bucket combination whenever the
|
|
1342
|
+
* underlying rate/token constants change (the plugin's cost test guards drift).
|
|
1343
|
+
* Keep in sync with
|
|
1344
|
+
* `docs/nodes/processing-video/video-analysis.md`.
|
|
1345
|
+
*/
|
|
1346
|
+
declare const VIDEO_ANALYSIS_BUCKET_CREDITS: Record<string, number>;
|
|
1347
|
+
/**
|
|
1348
|
+
* The credit-id MODEL SEGMENT for an engine identifier: both mixed-tier
|
|
1349
|
+
* sentinels share the `mixed` price family (same engine plan); everything
|
|
1350
|
+
* else prices under its own identifier. Single source of truth — used by
|
|
1351
|
+
* `buildVideoAnalysisCreditId` below, so route/orchestrator/UI callers can
|
|
1352
|
+
* never diverge on where a sentinel prices.
|
|
1353
|
+
*/
|
|
1354
|
+
declare function videoAnalysisCreditSegment(modelOrSentinel: string): string;
|
|
1355
|
+
declare function pickVideoAnalysisBucket(durationSec: number): number;
|
|
1356
|
+
declare function buildVideoAnalysisCreditId(model: string, durationSec?: number): string;
|
|
1357
|
+
declare function bucketSecondsFromCreditId(creditId: string): number | null;
|
|
1358
|
+
declare function videoAnalysisNumWindows(bucketSec: number): number;
|
|
1359
|
+
/**
|
|
1360
|
+
* Precomputed credit cost for the `video-audit` node ("AI Audit") — the same
|
|
1361
|
+
* pattern as `VIDEO_ANALYSIS_BUCKET_CREDITS` above: the OUTPUT of the private
|
|
1362
|
+
* `videoAuditBucketCredits` formula in `@nodaroai/cloud-plugins`
|
|
1363
|
+
* (in the plugin repo), a plain lookup table never a
|
|
1364
|
+
* formula, cross-checked against that package's own cost test. Shares the
|
|
1365
|
+
* SAME duration-bucket ladder as video-analysis (`VIDEO_ANALYSIS_DURATION_BUCKETS`
|
|
1366
|
+
* / `pickVideoAnalysisBucket`) — the audit re-watches the same clip, so it
|
|
1367
|
+
* buckets identically.
|
|
1368
|
+
*
|
|
1369
|
+
* Two credit families, selected by whether an analysis was wired into the
|
|
1370
|
+
* node (see `buildVideoAuditCreditId`):
|
|
1371
|
+
* - `video-audit:<bucket>s` — an analysis was provided; the audit re-watches
|
|
1372
|
+
* the clip against it directly (native watcher roll + reasoner pass, at a
|
|
1373
|
+
* safety margin — internals stay private in the plugin).
|
|
1374
|
+
* - `video-audit:auto:<bucket>s` — no analysis wired; the node auto-runs a
|
|
1375
|
+
* fast-tier analysis first. Exactly the base family's price PLUS the
|
|
1376
|
+
* `gemini-3-flash` (legacy fast tier) row from `VIDEO_ANALYSIS_BUCKET_CREDITS`
|
|
1377
|
+
* at the SAME bucket — summed in the plugin's generator/formula, never
|
|
1378
|
+
* hand-added here (see the single-source assertion in
|
|
1379
|
+
* video-analysis-pricing.test.ts).
|
|
1380
|
+
*
|
|
1381
|
+
* Bare ids (`video-audit`, `video-audit:auto` — they live in
|
|
1382
|
+
* `model-catalog.ts`'s pricing rows, not as keys in this table) equal their
|
|
1383
|
+
* family's 600s ceiling, the same "unknown duration → ceiling" convention
|
|
1384
|
+
* `VIDEO_ANALYSIS_BUCKET_CREDITS`'s bare per-model catalog rows use.
|
|
1385
|
+
* `buildVideoAuditCreditId` never returns a bare id itself — an
|
|
1386
|
+
* unknown/invalid duration resolves to the bucketed 600s id, matching
|
|
1387
|
+
* `buildVideoAnalysisCreditId`.
|
|
1388
|
+
*
|
|
1389
|
+
* Values pasted verbatim from the plugin generator's output
|
|
1390
|
+
* (the plugin repo's bucket generator) —
|
|
1391
|
+
* never hand computed. The plugin's cost test cross-checks every row.
|
|
1392
|
+
*/
|
|
1393
|
+
declare const VIDEO_AUDIT_BUCKET_CREDITS: Record<string, number>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Composite credit-id builder for `video-audit`. Mirrors
|
|
1396
|
+
* `buildVideoAnalysisCreditId`'s bucket selection and unknown/invalid-duration
|
|
1397
|
+
* ceiling fallback exactly (same ladder, same rounding — `durationSec <=
|
|
1398
|
+
* bucket`, clamped to the 600s max), but selects the FAMILY by whether an
|
|
1399
|
+
* analysis was already provided instead of by model: `analysisProvided:
|
|
1400
|
+
* true` prices under the cheaper `video-audit` family (re-audits an existing
|
|
1401
|
+
* analysis); `false` prices under `video-audit:auto` (the node auto-runs a
|
|
1402
|
+
* fast analysis first, hence that family's built-in fast-tier addition).
|
|
1403
|
+
*/
|
|
1404
|
+
declare function buildVideoAuditCreditId(args: {
|
|
1405
|
+
analysisProvided: boolean;
|
|
1406
|
+
durationSec?: number;
|
|
1407
|
+
}): string;
|
|
1408
|
+
/**
|
|
1409
|
+
* Table lookup for a resolved bucket + family. Snaps `bucketSec` onto the
|
|
1410
|
+
* ladder via `pickVideoAnalysisBucket` first, so a raw duration (not just an
|
|
1411
|
+
* exact 60/180/360/600) is safe to pass — mirrors `buildVideoAuditCreditId`'s
|
|
1412
|
+
* own rounding rather than requiring the caller to pre-round.
|
|
1413
|
+
*/
|
|
1414
|
+
declare function videoAuditCreditsForBucket(bucketSec: number, auto: boolean): number;
|
|
1415
|
+
/**
|
|
1416
|
+
* Parses a `video-audit:*` credit id back to its bucket seconds — both
|
|
1417
|
+
* families (`video-audit:<n>s` and `video-audit:auto:<n>s`); null on
|
|
1418
|
+
* anything else (a bare id with no bucket, a `video-analysis:*` id, or
|
|
1419
|
+
* garbage). Deliberately a SEPARATE parser from `bucketSecondsFromCreditId`
|
|
1420
|
+
* (anchored to the `video-analysis:` prefix and a mandatory model segment) —
|
|
1421
|
+
* mirrors the plugin-local audit parser so app code can never mis-parse an
|
|
1422
|
+
* audit id with the VA-anchored parser, or vice versa.
|
|
1423
|
+
*/
|
|
1424
|
+
declare function bucketSecondsFromAuditCreditId(id: string): number | null;
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Pricing vocabulary for the "steal the format" nodes — Content Recipe and
|
|
1428
|
+
* Content Ideas. Public prices only: the credit ids a run is billed under and
|
|
1429
|
+
* the count rule that picks between them. One copy for the editor's credit
|
|
1430
|
+
* badge, the workflow orchestrator's reservation and the pre-run estimate;
|
|
1431
|
+
* the cloud plugin that runs the nodes computes the same ids.
|
|
1432
|
+
*
|
|
1433
|
+
* Content Ideas is charged per batch of up to five ideas: a run of 1–5 ideas
|
|
1434
|
+
* bills `content-ideas[:economy|:premium|:premium-direct]`, a run of 6–10 bills
|
|
1435
|
+
* `content-ideas:10[:economy|:premium|:premium-direct]`, priced at two batches.
|
|
1436
|
+
*/
|
|
1437
|
+
declare const CONTENT_IDEAS_MAX_COUNT = 10;
|
|
1438
|
+
declare const CONTENT_IDEAS_DEFAULT_COUNT = 5;
|
|
1439
|
+
declare const CONTENT_IDEAS_PER_CHARGE = 5;
|
|
1440
|
+
/** Request limits the cloud routes enforce — the orchestrator trims to the
|
|
1441
|
+
* same bounds, since its payload never passes the route's validation. */
|
|
1442
|
+
declare const CONTENT_RECIPE_SOURCE_MAX = 300000;
|
|
1443
|
+
declare const CONTENT_IDEAS_MAX_RECIPE_INPUTS = 20;
|
|
1444
|
+
declare const CONTENT_IDEAS_BRAND_MAX = 6000;
|
|
1445
|
+
declare const CONTENT_IDEAS_LANGUAGE_MAX = 40;
|
|
1446
|
+
/** A whole number of ideas in 1..10; anything but a finite number is the
|
|
1447
|
+
* default. (The plugin reads `count` the same way — numbers only.) */
|
|
1448
|
+
declare function clampContentIdeasCount(raw: unknown): number;
|
|
1449
|
+
/** The billing feature for a run of `count` ideas. */
|
|
1450
|
+
declare function contentIdeasCreditFeature(count: number): "content-ideas" | "content-ideas:10";
|
|
1451
|
+
/** The model a node runs: its own pick when the registry can return
|
|
1452
|
+
* structured output, else the feature default. Billing uses THIS — a missing
|
|
1453
|
+
* model must never bill the bare (standard) id while running economy. */
|
|
1454
|
+
declare function effectiveContentModel(feature: "content-recipe" | "content-ideas", llmModel: unknown): string;
|
|
1455
|
+
declare function contentRecipeCreditId(llmModel?: unknown, reasoningEffort?: string): string;
|
|
1456
|
+
declare function contentIdeasCreditId(count: unknown, llmModel?: unknown, reasoningEffort?: string): string;
|
|
1457
|
+
/** Every credit id the two nodes can bill — for price tables and guards. */
|
|
1458
|
+
declare const CONTENT_RECIPE_IDEAS_CREDIT_IDS: readonly ["content-recipe:economy", "content-recipe", "content-recipe:premium", "content-recipe:premium-direct", "content-ideas:economy", "content-ideas", "content-ideas:premium", "content-ideas:premium-direct", "content-ideas:10:economy", "content-ideas:10", "content-ideas:10:premium", "content-ideas:10:premium-direct"];
|
|
1459
|
+
|
|
1460
|
+
export { AI_AVATAR_DURATION_BUCKETS, AI_AVATAR_MAX_AUDIO_SEC, AI_AVATAR_MAX_DURATION_SEC, AI_AVATAR_RESERVE_IDS, type AiAvatarDurationBucket, type AiAvatarEngine, type AiAvatarResolution, AvatarPayloadError, CINEMATIC_DEFAULT_DURATION_SEC, CINEMATIC_DEFAULT_RESOLUTION, CINEMATIC_MAX_DURATION_SEC, CINEMATIC_MAX_LOOKS, CINEMATIC_MAX_REFERENCE_IMAGES, CINEMATIC_MAX_REFERENCE_VIDEOS, CINEMATIC_MIN_DURATION_SEC, CINEMATIC_MIN_LOOKS, CINEMATIC_PROMPT_MAX, CINEMATIC_RESERVE_IDS, CONTENT_IDEAS_BRAND_MAX, CONTENT_IDEAS_DEFAULT_COUNT, CONTENT_IDEAS_LANGUAGE_MAX, CONTENT_IDEAS_MAX_COUNT, CONTENT_IDEAS_MAX_RECIPE_INPUTS, CONTENT_IDEAS_PER_CHARGE, CONTENT_RECIPE_IDEAS_CREDIT_IDS, CONTENT_RECIPE_SOURCE_MAX, CREDIT_ROUNDING_RESOLUTION, type CinematicResolution, type CombineVideosEstimatorInput, DEFAULT_VIDEO_CLIP_COST, FILM_BASE_CREDITS, type FilmCreditEstimate, IMAGE_OVERLAY_BASE_CREDITS, IMAGE_OVERLAY_VARIANT_CREDITS, KEYFRAME_CREDITS_PER_SHOT, LIP_SYNC_DURATION_BUCKETS, LIP_SYNC_MAX_AUDIO_SECONDS, LTX_EXTEND_DURATION, LTX_EXTEND_PER_SECOND_CREDIT_ID, LTX_RETAKE_MIN_DURATION_SEC, LTX_RETAKE_PER_SECOND_CREDIT_ID, type LipSyncDurationBucket, type LoopTrimEstimatorInput, type LoopVideoEstimatorInput, type NormalizedImageGen, PAYG_RETENTION_DAYS, PITCH_TEMPO_LIMITS, PITCH_TEMPO_PRICING, type PricedVideoSelection, SPEAKER_VIEW_CREDIT_IDS, SPEAKER_VIEW_PRICE_TIERS, SPEECH_FLOOR_UNITS, SPEECH_PRICE_UNIT_CHARS, SPEECH_UNIT_CREDIT_SUFFIX, SUNO_SELECT_OPERATIONS, SUNO_VERSION_CREDIT_KEYS, SUNO_VERSION_PRICED_OPERATIONS, SWITCHX_BLOCK_FRAMES, SWITCHX_FRAME_TIERS, type SpeakerViewCreditId, type SpeakerViewPriceTier, type SpeechQuoteCreditIdParts, TEXT_TO_AUDIO_PRICING, TEXT_TO_AUDIO_SFX_CREDIT_IDS, TOPAZ_DEFAULT_UPSCALE_FACTOR, TOPAZ_UPSCALE_FACTORS, type TopazUpscaleAdjustment, type TopazUpscaleFactor, type TopazUpscaleResolution, type TrimVideoEstimatorInput, type UnitQuoteCreditIdParts, VIDEO_ANALYSIS_BUCKET_CREDITS, VIDEO_ANALYSIS_BUCKET_GRACE_SEC, VIDEO_ANALYSIS_DURATION_BUCKETS, VIDEO_ANALYSIS_DURATION_TOLERANCE_SEC, VIDEO_ANALYSIS_MAX_DURATION_SEC, VIDEO_ANALYSIS_WINDOW, VIDEO_AUDIT_BUCKET_CREDITS, VIDEO_CLIP_CREDITS, VIDEO_CRITIC_CREDITS_PER_SHOT, VIDEO_SFX_PRICING, VIDEO_UTIL_PRICING, VOICE_CHANGER_PRO_QUOTE_RATE_ID, type VideoClipCost, type VoiceChangerProQuoteCreditIdParts, type VoiceChangerProQuoteRespeakEngine, type VoiceChangerProQuoteSlot, aiAvatarReserveCreditId, applyEdlCreditId, assembleNarratedVideoCredits, bucketSecondsFromAuditCreditId, bucketSecondsFromCreditId, buildCreditModelIdentifier, buildLipSyncCreditId, buildMotionCreditModelIdentifier, buildVideoAnalysisCreditId, buildVideoAuditCreditId, buildVideoCreditModelIdentifier, calculateMonetizationMarkup, calculateMonetizedCost, cinematicCreditId, clampCinematicDuration, clampContentIdeasCount, contentIdeasCreditFeature, contentIdeasCreditId, contentRecipeCreditId, creditsToUsd, effectiveContentModel, estimateCombineVideosCredits, estimateFilmCredits, estimateLoopTrimAddonCredits, estimateLoopVideoCredits, estimateScriptDurationSec, estimateTrimVideoCredits, getLipSyncMaxAudioSeconds, imageGenAutoAspectNeedsSourceImage, imageOverlayBillableVariants, imageOverlayCredits, isPaygRetentionActive, isPerSecondLipSyncProvider, isSpeechLengthPriceId, ltxExtendDurationSec, ltxRetakeDurationSec, normalizedImageGenModelId, parsePitchTempoCreditId, parseSpeechQuoteCreditId, parseUnitQuoteCreditId, parseVoiceChangerProQuoteCreditId, pickAiAvatarBucket, pickLipSyncBucket, pickSwitchXFrameTier, pickVideoAnalysisBucket, pitchTempoBaseCredits, pitchTempoCreditId, pitchTempoQuoteCreditId, pitchTempoStartedMinutes, pricedVideoSelection, resolveAiAvatarCreditId, resolveCinematicCreditId, resolveEffectiveTier, resolveImageGenCreditIdentifier, resolveNormalizedImageGen, resolveStoredTier, resolveSwitchXCreditId, resolveTopazUpscale, seedanceVideoEditCreditId, semitonesToPitchRatio, speakerViewCreditId, speechCredits, speechLengthPriceModel, speechPriceUnits, speechQuoteCreditId, speechUnitCreditId, speedRampCreditId, sunoCreditType, textToAudioBilledSeconds, textToAudioCreditId, unitQuoteCreditId, usdToCredits, validateAiAvatarPayload, validateCinematicAvatarPayload, videoAnalysisCreditSegment, videoAnalysisNumWindows, videoAuditCreditsForBucket, videoGenerationCreditId, videoSfxCreditId, videoSfxQuoteCreditId, voiceChangerProQuoteCreditId };
|