@nodaro/shared 3.62.0 → 3.63.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.
Files changed (212) hide show
  1. package/dist/{chunk-6CSXMWL4.cjs → chunk-2PU3AGGS.cjs} +27 -4
  2. package/dist/chunk-2PU3AGGS.cjs.map +1 -0
  3. package/dist/{chunk-CC4V2B7S.js → chunk-34QLPTSA.js} +3 -3
  4. package/dist/{chunk-CC4V2B7S.js.map → chunk-34QLPTSA.js.map} +1 -1
  5. package/dist/{chunk-G4U3HW6W.js → chunk-3K24DWOH.js} +3 -3
  6. package/dist/{chunk-G4U3HW6W.js.map → chunk-3K24DWOH.js.map} +1 -1
  7. package/dist/{chunk-GSFB537T.js → chunk-4DVWXEB6.js} +23 -4
  8. package/dist/chunk-4DVWXEB6.js.map +1 -0
  9. package/dist/{chunk-ZES6EZC4.js → chunk-4MMZD63H.js} +3 -3
  10. package/dist/{chunk-ZES6EZC4.js.map → chunk-4MMZD63H.js.map} +1 -1
  11. package/dist/{chunk-N7OUQK7E.cjs → chunk-63H4C56Q.cjs} +8 -8
  12. package/dist/{chunk-N7OUQK7E.cjs.map → chunk-63H4C56Q.cjs.map} +1 -1
  13. package/dist/{chunk-2D5LQFV4.cjs → chunk-6BZC2ZHC.cjs} +9 -9
  14. package/dist/{chunk-2D5LQFV4.cjs.map → chunk-6BZC2ZHC.cjs.map} +1 -1
  15. package/dist/{chunk-3OYO3XCC.js → chunk-6M563QE6.js} +71 -9
  16. package/dist/chunk-6M563QE6.js.map +1 -0
  17. package/dist/{chunk-IDTKF5EX.cjs → chunk-6TGB7ECA.cjs} +7 -7
  18. package/dist/{chunk-IDTKF5EX.cjs.map → chunk-6TGB7ECA.cjs.map} +1 -1
  19. package/dist/{chunk-2HZGDZZN.cjs → chunk-6XUG4L7X.cjs} +6 -6
  20. package/dist/{chunk-2HZGDZZN.cjs.map → chunk-6XUG4L7X.cjs.map} +1 -1
  21. package/dist/{chunk-CIPPPT7E.cjs → chunk-77WU3V3J.cjs} +6 -6
  22. package/dist/{chunk-CIPPPT7E.cjs.map → chunk-77WU3V3J.cjs.map} +1 -1
  23. package/dist/{chunk-C7POAYFE.js → chunk-AE3AAJ4O.js} +3 -3
  24. package/dist/{chunk-C7POAYFE.js.map → chunk-AE3AAJ4O.js.map} +1 -1
  25. package/dist/{chunk-NGKKNSK6.js → chunk-BMJVKYVB.js} +36 -15
  26. package/dist/chunk-BMJVKYVB.js.map +1 -0
  27. package/dist/{chunk-YCXRSWCQ.js → chunk-CZ5IQB3L.js} +3 -3
  28. package/dist/{chunk-YCXRSWCQ.js.map → chunk-CZ5IQB3L.js.map} +1 -1
  29. package/dist/{chunk-E2HZTGYX.js → chunk-EPXGG27L.js} +7 -7
  30. package/dist/chunk-EPXGG27L.js.map +1 -0
  31. package/dist/{chunk-3M4BNKFJ.cjs → chunk-F6WGGYQW.cjs} +167 -3
  32. package/dist/chunk-F6WGGYQW.cjs.map +1 -0
  33. package/dist/{chunk-7FCTCWHD.js → chunk-FXGNRYQQ.js} +3 -3
  34. package/dist/{chunk-7FCTCWHD.js.map → chunk-FXGNRYQQ.js.map} +1 -1
  35. package/dist/{chunk-QWYFHQYK.cjs → chunk-GMBDLNLD.cjs} +86 -62
  36. package/dist/chunk-GMBDLNLD.cjs.map +1 -0
  37. package/dist/{chunk-KJSRPHJ2.cjs → chunk-GSKLPI3J.cjs} +100 -46
  38. package/dist/chunk-GSKLPI3J.cjs.map +1 -0
  39. package/dist/{chunk-S5TMRJMX.js → chunk-HBXF6RUU.js} +4 -4
  40. package/dist/{chunk-S5TMRJMX.js.map → chunk-HBXF6RUU.js.map} +1 -1
  41. package/dist/{chunk-S24ZBUB4.js → chunk-HWQ2SYNA.js} +6 -32
  42. package/dist/chunk-HWQ2SYNA.js.map +1 -0
  43. package/dist/{chunk-JJNNM23P.js → chunk-IY3Y462W.js} +3 -3
  44. package/dist/{chunk-JJNNM23P.js.map → chunk-IY3Y462W.js.map} +1 -1
  45. package/dist/{chunk-JZGZ26YB.js → chunk-KCZHQH2O.js} +4 -4
  46. package/dist/{chunk-JZGZ26YB.js.map → chunk-KCZHQH2O.js.map} +1 -1
  47. package/dist/{chunk-FVII3KHN.js → chunk-KMGCHV6O.js} +163 -4
  48. package/dist/chunk-KMGCHV6O.js.map +1 -0
  49. package/dist/{chunk-4ZEFP2FQ.cjs → chunk-L2TVY6XN.cjs} +4 -4
  50. package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-L2TVY6XN.cjs.map} +1 -1
  51. package/dist/{chunk-TRVWMKNE.cjs → chunk-LH72PQO2.cjs} +204 -52
  52. package/dist/chunk-LH72PQO2.cjs.map +1 -0
  53. package/dist/{chunk-HRY7KGAE.cjs → chunk-LMAQUR55.cjs} +6 -6
  54. package/dist/{chunk-HRY7KGAE.cjs.map → chunk-LMAQUR55.cjs.map} +1 -1
  55. package/dist/{chunk-MYJQELFN.cjs → chunk-M5OCFGHF.cjs} +254 -7
  56. package/dist/chunk-M5OCFGHF.cjs.map +1 -0
  57. package/dist/{chunk-I2RQB7VG.js → chunk-MD4XHED4.js} +3 -3
  58. package/dist/{chunk-I2RQB7VG.js.map → chunk-MD4XHED4.js.map} +1 -1
  59. package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
  60. package/dist/chunk-NIAFR5EE.js.map +1 -0
  61. package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
  62. package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
  63. package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
  64. package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
  65. package/dist/{chunk-UDDVDQMF.js → chunk-OV3JTKBY.js} +166 -25
  66. package/dist/chunk-OV3JTKBY.js.map +1 -0
  67. package/dist/{chunk-5YYN5X57.js → chunk-PSKZKLDG.js} +252 -8
  68. package/dist/chunk-PSKZKLDG.js.map +1 -0
  69. package/dist/{chunk-IWWVPR3W.cjs → chunk-TM5JYSJF.cjs} +95 -19
  70. package/dist/chunk-TM5JYSJF.cjs.map +1 -0
  71. package/dist/{chunk-G3KVK7OU.cjs → chunk-V5EEQR2U.cjs} +21 -21
  72. package/dist/{chunk-G3KVK7OU.cjs.map → chunk-V5EEQR2U.cjs.map} +1 -1
  73. package/dist/{chunk-AOJ6B7K4.cjs → chunk-WZVIBAKN.cjs} +12 -12
  74. package/dist/chunk-WZVIBAKN.cjs.map +1 -0
  75. package/dist/{chunk-5M43XMRB.cjs → chunk-X5BAFW3Q.cjs} +8 -8
  76. package/dist/{chunk-5M43XMRB.cjs.map → chunk-X5BAFW3Q.cjs.map} +1 -1
  77. package/dist/{chunk-SYWR5G3T.js → chunk-XBTYGQ6Z.js} +51 -7
  78. package/dist/chunk-XBTYGQ6Z.js.map +1 -0
  79. package/dist/{chunk-AFYTX4AI.cjs → chunk-XGGZWA4A.cjs} +107 -50
  80. package/dist/chunk-XGGZWA4A.cjs.map +1 -0
  81. package/dist/{chunk-VACPZPUA.cjs → chunk-XGVJGNZW.cjs} +5 -5
  82. package/dist/{chunk-VACPZPUA.cjs.map → chunk-XGVJGNZW.cjs.map} +1 -1
  83. package/dist/{chunk-2W745U4A.cjs → chunk-Y35JQPT6.cjs} +42 -70
  84. package/dist/chunk-Y35JQPT6.cjs.map +1 -0
  85. package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
  86. package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
  87. package/dist/{chunk-PTD6EDUU.js → chunk-YUER7TJG.js} +3 -3
  88. package/dist/{chunk-PTD6EDUU.js.map → chunk-YUER7TJG.js.map} +1 -1
  89. package/dist/{chunk-Y6X7UJSD.js → chunk-YX6TFX7H.js} +66 -14
  90. package/dist/chunk-YX6TFX7H.js.map +1 -0
  91. package/dist/{chunk-TWF2OSH4.cjs → chunk-ZPE2ZTJ4.cjs} +4 -4
  92. package/dist/{chunk-TWF2OSH4.cjs.map → chunk-ZPE2ZTJ4.cjs.map} +1 -1
  93. package/dist/entries/apps.cjs +42 -42
  94. package/dist/entries/apps.js +7 -7
  95. package/dist/entries/credits.cjs +237 -169
  96. package/dist/entries/credits.d.cts +163 -16
  97. package/dist/entries/credits.d.ts +163 -16
  98. package/dist/entries/credits.js +10 -10
  99. package/dist/entries/llm-models.cjs +77 -57
  100. package/dist/entries/llm-models.d.cts +85 -6
  101. package/dist/entries/llm-models.d.ts +85 -6
  102. package/dist/entries/llm-models.js +2 -2
  103. package/dist/entries/media.cjs +63 -63
  104. package/dist/entries/media.d.cts +8 -0
  105. package/dist/entries/media.d.ts +8 -0
  106. package/dist/entries/media.js +1 -1
  107. package/dist/entries/model-catalog.cjs +121 -105
  108. package/dist/entries/model-catalog.d.cts +48 -18
  109. package/dist/entries/model-catalog.d.ts +48 -18
  110. package/dist/entries/model-catalog.js +4 -4
  111. package/dist/entries/models.cjs +418 -322
  112. package/dist/entries/models.d.cts +71 -5
  113. package/dist/entries/models.d.ts +71 -5
  114. package/dist/entries/models.js +5 -5
  115. package/dist/entries/nodes.cjs +216 -208
  116. package/dist/entries/nodes.d.cts +22 -6
  117. package/dist/entries/nodes.d.ts +22 -6
  118. package/dist/entries/nodes.js +8 -8
  119. package/dist/entries/pipeline.cjs +152 -152
  120. package/dist/entries/pipeline.d.cts +3 -3
  121. package/dist/entries/pipeline.d.ts +3 -3
  122. package/dist/entries/pipeline.js +3 -3
  123. package/dist/entries/runtime-config.cjs +29 -29
  124. package/dist/entries/runtime-config.d.cts +10 -7
  125. package/dist/entries/runtime-config.d.ts +10 -7
  126. package/dist/entries/runtime-config.js +1 -1
  127. package/dist/entries/social.cjs +177 -177
  128. package/dist/entries/social.js +2 -2
  129. package/dist/entries/types.d.cts +8 -0
  130. package/dist/entries/types.d.ts +8 -0
  131. package/dist/entries/ugc.cjs +71 -71
  132. package/dist/entries/ugc.js +4 -4
  133. package/dist/entries/video.cjs +154 -150
  134. package/dist/entries/video.d.cts +11 -2
  135. package/dist/entries/video.d.ts +11 -2
  136. package/dist/entries/video.js +6 -6
  137. package/dist/entries/workflow.d.cts +1 -1
  138. package/dist/entries/workflow.d.ts +1 -1
  139. package/dist/index.cjs +1727 -1515
  140. package/dist/index.d.cts +8 -8
  141. package/dist/index.d.ts +8 -8
  142. package/dist/index.js +23 -23
  143. package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-C_Eo35tL.d.cts} +30 -0
  144. package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-C_Eo35tL.d.ts} +30 -0
  145. package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-Bg4ccSQb.d.ts} +138 -25
  146. package/dist/{model-constants-B88p6XR0.d.ts → model-constants-DWcxOmaY.d.cts} +138 -25
  147. package/package.json +1 -1
  148. package/src/__tests__/credit-identifiers.test.ts +29 -0
  149. package/src/__tests__/extend-providers.test.ts +106 -26
  150. package/src/__tests__/gvp-supported-providers.test.ts +27 -2
  151. package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
  152. package/src/__tests__/lip-sync-levers.test.ts +31 -0
  153. package/src/__tests__/llm-models.test.ts +132 -3
  154. package/src/__tests__/llm-price-key.test.ts +152 -1
  155. package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
  156. package/src/__tests__/normalize-node-params.test.ts +25 -0
  157. package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
  158. package/src/__tests__/prompt-length-limits.test.ts +4 -0
  159. package/src/__tests__/seedance-task-type.test.ts +13 -3
  160. package/src/__tests__/transcribe-capabilities.test.ts +39 -2
  161. package/src/__tests__/transcribe-preflight.test.ts +50 -1
  162. package/src/__tests__/video-audio-capability.test.ts +35 -6
  163. package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
  164. package/src/__tests__/video-upscale-params.test.ts +62 -0
  165. package/src/catalog-projection.ts +8 -0
  166. package/src/credit-estimators/index.ts +10 -0
  167. package/src/credit-estimators/nemotron-transcribe.ts +87 -0
  168. package/src/credit-identifiers.ts +109 -35
  169. package/src/entries/credits.ts +12 -1
  170. package/src/entries/llm-models.ts +6 -0
  171. package/src/entries/model-catalog.ts +9 -0
  172. package/src/entries/models.ts +35 -0
  173. package/src/entries/nodes.ts +2 -0
  174. package/src/entries/video.ts +1 -1
  175. package/src/freecut-protocol.ts +8 -0
  176. package/src/lip-sync-levers.ts +56 -0
  177. package/src/lip-sync-pricing.ts +91 -1
  178. package/src/llm-models.ts +249 -4
  179. package/src/model-catalog.ts +250 -4
  180. package/src/model-constants.ts +277 -30
  181. package/src/model-tree.ts +2 -1
  182. package/src/nodaro-video-upscale.ts +48 -0
  183. package/src/node-default-mappings.ts +3 -0
  184. package/src/normalize-node-params.ts +49 -1
  185. package/src/runtime-config/contract.ts +10 -7
  186. package/src/seedance-draft.ts +2 -1
  187. package/src/transcribe-preflight.ts +58 -7
  188. package/src/video-duration.ts +9 -0
  189. package/src/video-ui-defaults.ts +5 -3
  190. package/src/video-upscale-params.ts +67 -0
  191. package/dist/chunk-2W745U4A.cjs.map +0 -1
  192. package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
  193. package/dist/chunk-3OYO3XCC.js.map +0 -1
  194. package/dist/chunk-5YYN5X57.js.map +0 -1
  195. package/dist/chunk-6CSXMWL4.cjs.map +0 -1
  196. package/dist/chunk-6G7NN4S4.js.map +0 -1
  197. package/dist/chunk-AFYTX4AI.cjs.map +0 -1
  198. package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
  199. package/dist/chunk-E2HZTGYX.js.map +0 -1
  200. package/dist/chunk-FVII3KHN.js.map +0 -1
  201. package/dist/chunk-GSFB537T.js.map +0 -1
  202. package/dist/chunk-IWWVPR3W.cjs.map +0 -1
  203. package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
  204. package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
  205. package/dist/chunk-MYJQELFN.cjs.map +0 -1
  206. package/dist/chunk-NGKKNSK6.js.map +0 -1
  207. package/dist/chunk-QWYFHQYK.cjs.map +0 -1
  208. package/dist/chunk-S24ZBUB4.js.map +0 -1
  209. package/dist/chunk-SYWR5G3T.js.map +0 -1
  210. package/dist/chunk-TRVWMKNE.cjs.map +0 -1
  211. package/dist/chunk-UDDVDQMF.js.map +0 -1
  212. package/dist/chunk-Y6X7UJSD.js.map +0 -1
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Nemotron 3.5 Transcribe pricing — per STARTED minute of the file (decided
3
+ * 2026-11-12): the same price with word timings or a translation.
4
+ *
5
+ * The base price is 0.75 credits a minute, which no whole-credit row can hold
6
+ * (`model_pricing.credit_cost` is an integer), so the rate row prices FOUR
7
+ * minutes — the same trick as Nodaro Video Upscale's four-second rows. A run
8
+ * reserves `nemotron-3-5-transcribe:<N>m` (N = started minutes, 1..60), which
9
+ * billing prices as that row × N ÷ 4, rounded up once for the whole run, then
10
+ * marked up once — never a row of its own, so a retune of the rate row moves
11
+ * the route, the workflow run, the node's Run button and every estimate
12
+ * together. The same id is built by the route (from the probed length), the
13
+ * workflow run (the same probe) and the editor (the upstream length it knows).
14
+ * That id is the HOLD: a run is then CHARGED for the minutes the provider
15
+ * reports it decoded, up or down (decided 2026-11-12; backend
16
+ * `lib/nemotron-transcribe-settle.ts`).
17
+ *
18
+ * Worked base prices at the row's launch value of 3 (per 4 minutes):
19
+ * 0:45 → 1, 1:00 → 1, 1:01 → 2, 10:00 → 8, 60:00 → 45.
20
+ * The listed (marked-up) price follows from those.
21
+ */
22
+
23
+ /** The engine's id — the Transcribe node's `provider`, and the bare price id. */
24
+ export const NEMOTRON_TRANSCRIBE_ID = "nemotron-3-5-transcribe"
25
+
26
+ export const NEMOTRON_TRANSCRIBE_PRICING = {
27
+ /** The rate row: credits per {@link NEMOTRON_TRANSCRIBE_PRICING.RATE_MINUTES} minutes. Never reserved by itself. */
28
+ RATE_CREDIT_ID: "nemotron-3-5-transcribe:per-4m",
29
+ /** The minutes the rate row prices. */
30
+ RATE_MINUTES: 4,
31
+ /** The rate row's launch value (admin-retunable in /admin/models): 0.75 base credits a minute. */
32
+ CREDITS_PER_RATE_DEFAULT: 3,
33
+ /** The longest file a run accepts, in seconds (KIE's 60-minute limit; the route refuses longer). */
34
+ MAX_DURATION_SEC: 3600,
35
+ /** The most minutes a `nemotron-3-5-transcribe:<N>m` id can carry. */
36
+ MAX_MINUTES: 60,
37
+ /** The largest file a run accepts, in bytes (KIE's 200 MB limit). */
38
+ MAX_BYTES: 200 * 1024 * 1024,
39
+ } as const
40
+
41
+ /**
42
+ * Started minutes of a file of `durationSec` seconds: ceil(sec / 60), at least
43
+ * 1, at most 60. An unknown or non-positive length counts as one minute here; a
44
+ * quote of an unknown length names 60 instead ({@link nemotronTranscribeQuoteCreditId}),
45
+ * as does a run whose file's length cannot be read (it holds 60 minutes and
46
+ * settles at the provider's decoded length).
47
+ */
48
+ export function nemotronTranscribeStartedMinutes(durationSec: number | null | undefined): number {
49
+ if (typeof durationSec !== "number" || !Number.isFinite(durationSec) || durationSec <= 0) return 1
50
+ return Math.min(NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES, Math.max(1, Math.ceil(durationSec / 60)))
51
+ }
52
+
53
+ /** `nemotron-3-5-transcribe:<N>m` — the id a run on a file of `durationSec` seconds reserves. */
54
+ export function nemotronTranscribeCreditId(durationSec: number | null | undefined): string {
55
+ return `${NEMOTRON_TRANSCRIBE_ID}:${nemotronTranscribeStartedMinutes(durationSec)}m`
56
+ }
57
+
58
+ /**
59
+ * The id a QUOTE names for a file of `durationSec` seconds — every estimate
60
+ * before a run. A known length is the id its run reserves. An UNKNOWN length is
61
+ * the 60-minute id: a run measures the file before it reserves, holds 60
62
+ * minutes for one whose length cannot be read and refuses one over 60 minutes,
63
+ * and the provider refuses longer audio, so 60 minutes is the most any run can
64
+ * be charged and the quote is never below the charge (Pitch & Tempo's rule).
65
+ */
66
+ export function nemotronTranscribeQuoteCreditId(durationSec: number | null | undefined): string {
67
+ const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0
68
+ return nemotronTranscribeCreditId(known ? durationSec : NEMOTRON_TRANSCRIBE_PRICING.MAX_DURATION_SEC)
69
+ }
70
+
71
+ /** The minutes of a `nemotron-3-5-transcribe:<N>m` id (1 ≤ N ≤ 60), or `undefined` for any other id. */
72
+ export function parseNemotronTranscribeCreditId(id: string): { minutes: number } | undefined {
73
+ const m = /^nemotron-3-5-transcribe:(\d+)m$/.exec(id)
74
+ if (!m) return undefined
75
+ const minutes = Number(m[1])
76
+ if (!Number.isInteger(minutes) || minutes < 1 || minutes > NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES) return undefined
77
+ return { minutes }
78
+ }
79
+
80
+ /**
81
+ * The base of a run of `minutes` started minutes from the rate row's value
82
+ * (`ratePerBlock` credits per {@link NEMOTRON_TRANSCRIBE_PRICING.RATE_MINUTES}
83
+ * minutes): rate × minutes ÷ 4, rounded up once for the whole run, at least 1.
84
+ */
85
+ export function nemotronTranscribeBaseCredits(ratePerBlock: number, minutes: number): number {
86
+ return Math.max(1, Math.ceil((ratePerBlock * minutes) / NEMOTRON_TRANSCRIBE_PRICING.RATE_MINUTES))
87
+ }
@@ -32,14 +32,18 @@ import {
32
32
  KLING_4_FLASH_RESOLUTION,
33
33
  isGrokVideo15Provider,
34
34
  normalizeGrokVideo15Resolution,
35
+ isPixverseV6MaxProvider,
36
+ normalizePixverseV6MaxQuality,
35
37
  VIDEO_REF_RATE_PROVIDERS,
36
38
  normalizeMinimaxH3Resolution,
37
39
  normalizeWan3Resolution,
38
40
  normalizeViduQ4Resolution,
39
- getVideoAudioCapability,
41
+ videoAudioPricedOn,
42
+ type VideoAudioRequest,
40
43
  canonicalVideoProvider,
41
- isSeedanceExtendProvider,
44
+ isTailExtendProvider,
42
45
  type SeedanceExtendProvider,
46
+ type TailExtendProvider,
43
47
  } from "./model-constants.js"
44
48
  import { isFlux2Model, FLUX2_RES_MP, type Flux2Model } from "./flux2-pricing.js"
45
49
  import {
@@ -450,7 +454,9 @@ const T2V_CREDIT_OVERRIDES: Record<string, string> = {
450
454
  *
451
455
  * @param provider - Video model key (e.g., "kling-3.0")
452
456
  * @param duration - Video duration in seconds
453
- * @param sound - Whether audio/sound is enabled
457
+ * @param sound - The request's audio: its `sound` flag, or the whole audio
458
+ * request (`{ sound, generateAudio }`) — read through `videoAudioIntent`, the
459
+ * same reading the provider runner sends the model's switch from
454
460
  * @param nodeType - Node type for T2V-specific cost overrides
455
461
  * @param mode - Quality variant that affects pricing
456
462
  * @param resolution - Output resolution (used by Seedance 2 for 480p/720p pricing)
@@ -509,23 +515,26 @@ function wireNormalizedResolution(provider: string, resolution: string | undefin
509
515
  // Kling 4.0 Flash renders 720p whatever it is asked (its runner sends 720p).
510
516
  if (isKling4FlashProvider(provider)) return KLING_4_FLASH_RESOLUTION
511
517
  if (isGrokVideo15Provider(provider)) return normalizeGrokVideo15Resolution(resolution)
518
+ if (isPixverseV6MaxProvider(provider)) return normalizePixverseV6MaxQuality(resolution)
512
519
  return resolution
513
520
  }
514
521
 
515
522
  export function buildVideoCreditModelIdentifier(
516
523
  rawProvider: string,
517
524
  duration?: number | string,
518
- sound?: boolean,
525
+ sound?: boolean | VideoAudioRequest,
519
526
  nodeType?: "image-to-video" | "text-to-video",
520
527
  mode?: string,
521
528
  resolution?: string,
522
529
  hasVideoRef?: boolean,
523
530
  ): string {
531
+ const audio: VideoAudioRequest = typeof sound === "object" && sound !== null ? sound : { sound }
524
532
  // A retired model (RETIRED_VIDEO_PROVIDERS) is priced as the model it runs as.
525
533
  const provider = canonicalVideoProvider(rawProvider) as string
526
- // A Seedance Extend Video provider is priced on its own rows — the one
527
- // builder every surface that prices an extend reads.
528
- if (isSeedanceExtendProvider(provider)) return seedanceExtendCreditId(provider, duration, resolution)
534
+ // A tail-recipe Extend Video provider (Seedance 2.5 / 2.0, Kling 4) is
535
+ // priced on its own rows — the one builder every surface that prices an
536
+ // extend reads.
537
+ if (isTailExtendProvider(provider)) return tailExtendCreditId(provider, duration, resolution)
529
538
  // T2V overrides: some providers have different base costs for text-to-video
530
539
  let effectiveProvider = provider
531
540
  if (nodeType === "text-to-video") {
@@ -596,16 +605,6 @@ export function buildVideoCreditModelIdentifier(
596
605
  const tier = tiers.find(t => durationSec <= t.maxSeconds) ?? tiers[tiers.length - 1]
597
606
  let identifier = `${effectiveProvider}:${tier.suffix}`
598
607
 
599
- // Append audio suffix if applicable. When the caller expressed no intent
600
- // (sound === undefined), fall back to the model's own default (capability
601
- // `defaultOn` — kling-3.0 generates audio unless explicitly disabled), so an
602
- // intent-less request is billed for the audio it actually produces instead
603
- // of reserving the cheaper no-audio tier against an audio-on generation.
604
- const soundOn = sound ?? (getVideoAudioCapability(effectiveProvider).defaultOn === true)
605
- if (AUDIO_ADDON_PROVIDERS.has(effectiveProvider) && soundOn) {
606
- identifier += ":audio"
607
- }
608
-
609
608
  // Append mode suffix for providers with quality-tiered pricing
610
609
  // "high" comes from I2V videoSize field, "pro" comes from T2V mode field
611
610
  if (MODE_ADDON_PROVIDERS.has(effectiveProvider) && (mode === "high" || mode === "pro")) {
@@ -660,7 +659,7 @@ export function buildVideoCreditModelIdentifier(
660
659
  // Collapsing through the SAME normalizer the runner uses makes render == billed
661
660
  // by construction for every spelling, including garbage (→ the declared 720p).
662
661
  // Scoped to the families whose runner normalizes on purpose (Wan 3.0, Vidu
663
- // Q4, Kling 4.0, Grok Imagine Video 1.5): the other RESOLUTION_DURATION_PRICING members pass `resolution` to
662
+ // Q4, Kling 4.0, Grok Imagine Video 1.5, PixVerse V6 Max): the other RESOLUTION_DURATION_PRICING members pass `resolution` to
664
663
  // their wire verbatim, so case-folding their billing without probing their
665
664
  // wire would reprice live models.
666
665
  const requested = wireNormalizedResolution(effectiveProvider, resolution)
@@ -680,6 +679,17 @@ export function buildVideoCreditModelIdentifier(
680
679
  identifier += ":768p"
681
680
  }
682
681
 
682
+ // Append the audio suffix LAST, after every other dimension
683
+ // (`kling-3.0:10s:audio`, `pixverse-v6-max:5s:720p:audio`). The request's
684
+ // audio is read by `videoAudioIntent` — the reading `applyVideoAudioToggle`
685
+ // sends the model's switch from — and with no intent falls back to the
686
+ // model's own default (capability `defaultOn` — kling-3.0 and PixVerse V6 Max
687
+ // generate audio unless explicitly disabled), so a request is billed for the
688
+ // audio it actually produces.
689
+ if (AUDIO_ADDON_PROVIDERS.has(effectiveProvider) && videoAudioPricedOn(effectiveProvider, audio)) {
690
+ identifier += ":audio"
691
+ }
692
+
683
693
  return identifier
684
694
  }
685
695
 
@@ -706,6 +716,8 @@ export function videoGenerationCreditId(args: {
706
716
  provider: string
707
717
  duration?: number | string
708
718
  sound?: boolean
719
+ /** The request's `generateAudio`, read after `sound` where the model reads it (`videoAudioIntent`). */
720
+ generateAudio?: boolean
709
721
  nodeType?: "image-to-video" | "text-to-video"
710
722
  mode?: string
711
723
  resolution?: string
@@ -719,7 +731,7 @@ export function videoGenerationCreditId(args: {
719
731
  return buildVideoCreditModelIdentifier(
720
732
  args.provider,
721
733
  args.duration,
722
- args.sound,
734
+ { sound: args.sound, generateAudio: args.generateAudio },
723
735
  args.nodeType ?? "image-to-video",
724
736
  args.mode,
725
737
  resolution,
@@ -757,43 +769,59 @@ export function seedanceVideoEditCreditId(provider: string, resolution?: string,
757
769
  })
758
770
  }
759
771
 
760
- /** The resolution a Seedance extend that names none, or one it does not offer, is priced and run at. */
761
- const SEEDANCE_EXTEND_DEFAULT_RESOLUTION = "720p"
772
+ /** The resolution a tail-recipe extend that names none, or one it does not offer, is priced and run at (every one offers it). */
773
+ const TAIL_EXTEND_DEFAULT_RESOLUTION = "720p"
762
774
 
763
775
  /**
764
- * The resolution a Seedance Extend Video run is priced at, and so the one it
765
- * must render at: the requested one when it is among the provider's catalog
766
- * `resolutions`, else 720p (also when none is named). The workflow run queues
767
- * it and the worker holds the job to it, so a stored or sent resolution the
768
- * model does not offer (`4k`) can never render above the row it reserved.
776
+ * The resolution a tail-recipe Extend Video run (Seedance 2.5 / 2.0, Kling 4)
777
+ * is priced at, and so the one it must render at: the requested one when it is
778
+ * among the provider's catalog `resolutions`, else 720p (also when none is
779
+ * named). The workflow run queues it and the worker holds the job to it, so a
780
+ * stored or sent resolution the model does not offer (`4k`, or `480p` on Kling
781
+ * 4) can never render above, or bill apart from, the row it reserved.
769
782
  */
770
- export function seedanceExtendResolution(provider: SeedanceExtendProvider, resolution?: unknown): string {
783
+ export function tailExtendResolution(provider: TailExtendProvider, resolution?: unknown): string {
771
784
  return typeof resolution === "string" && MODEL_CATALOG[provider]?.resolutions?.includes(resolution)
772
785
  ? resolution
773
- : SEEDANCE_EXTEND_DEFAULT_RESOLUTION
786
+ : TAIL_EXTEND_DEFAULT_RESOLUTION
774
787
  }
775
788
 
776
789
  /**
777
- * The credit identifier one Seedance Extend Video run is priced at — the one
778
- * builder every surface that prices it reads (the route's guard and
790
+ * The credit identifier one tail-recipe Extend Video run is priced at — the
791
+ * one builder every surface that prices it reads (the route's guard and
779
792
  * reservation, the workflow reservation and estimate, the editor), so none of
780
793
  * them can name a different row.
781
794
  *
782
795
  * The seconds added snap into the provider's catalog `durations` (its catalog
783
796
  * `defaultDuration` when unset, through {@link pricedOutputDurationSec}); the
784
- * resolution is {@link seedanceExtendResolution}'s. Each provider has its own
797
+ * resolution is {@link tailExtendResolution}'s. Each provider has its own
785
798
  * rows, one per second of its window and resolution: `<provider>:<N>s:<res>`
786
- * (`seedance-2-5-extend` 4–30 s, `seedance-2-0-extend` 4–15 s).
799
+ * (`seedance-2-5-extend` 4–30 s, `seedance-2-0-extend` 4–15 s, both at
800
+ * 480p / 720p / 1080p; `kling-4-extend` 3–30 s at 720p / 1080p).
787
801
  *
788
- * A retired id (`seedance-2-extend`) is not a {@link SeedanceExtendProvider}:
802
+ * A retired id (`seedance-2-extend`) is not a {@link TailExtendProvider}:
789
803
  * pass a stored or sent provider through `canonicalVideoProvider` first.
790
804
  */
805
+ export function tailExtendCreditId(
806
+ provider: TailExtendProvider,
807
+ duration?: number | string,
808
+ resolution?: string,
809
+ ): string {
810
+ return `${provider}:${pricedOutputDurationSec(provider, duration)}s:${tailExtendResolution(provider, resolution)}`
811
+ }
812
+
813
+ /** @deprecated Use {@link tailExtendResolution}, which also answers for Kling 4 Extend. */
814
+ export function seedanceExtendResolution(provider: SeedanceExtendProvider, resolution?: unknown): string {
815
+ return tailExtendResolution(provider, resolution)
816
+ }
817
+
818
+ /** @deprecated Use {@link tailExtendCreditId}, which also answers for Kling 4 Extend. */
791
819
  export function seedanceExtendCreditId(
792
820
  provider: SeedanceExtendProvider,
793
821
  duration?: number | string,
794
822
  resolution?: string,
795
823
  ): string {
796
- return `${provider}:${pricedOutputDurationSec(provider, duration)}s:${seedanceExtendResolution(provider, resolution)}`
824
+ return tailExtendCreditId(provider, duration, resolution)
797
825
  }
798
826
 
799
827
  /** What the video credit identifier PRICES for a request, for the levers whose
@@ -897,13 +925,59 @@ export function pricedVideoSelection(opts: {
897
925
  * "wan-animate-move" (480p default), "wan-animate-move:580p", "wan-animate-move:720p"
898
926
  *
899
927
  * @param provider - Motion control provider key ("kling" for 2.6, "kling-3.0", "wan-animate-move", "wan-animate-replace")
900
- * @param resolution - "720p" or "1080p" (Kling), "480p" or "580p" or "720p" (Wan Animate)
928
+ * @param resolution - "720p" or "1080p" (Kling), "480p" or "580p" or "720p" (Wan Animate); a size the
929
+ * model does not have is priced as the size it runs at (`motionTransferResolution`: Wan Animate's 1080p as 720p)
901
930
  * @param videoDuration - Reference video duration in seconds (defaults to 10s, unused for Wan Animate)
902
931
  */
903
932
  export function buildMotionCreditModelIdentifier(
904
933
  provider: string,
905
934
  resolution: string,
906
935
  videoDuration?: number,
936
+ ): string {
937
+ return motionCreditIdentifier(provider, motionTransferResolution(provider, resolution).resolution, videoDuration)
938
+ }
939
+
940
+ /** The catalog model a Motion Transfer option runs: the base of the id it is billed under. */
941
+ function motionModelOf(provider: string): string {
942
+ return motionCreditIdentifier(provider, "720p").split(":")[0]!
943
+ }
944
+
945
+ /**
946
+ * Motion models still SENT at a size their catalog entry does not list, as
947
+ * before Wan Animate had entries: Kling 2.6 and Kling 3.0 Motion Control
948
+ * (720p and 1080p). Their price is the same either way (any size but 1080p is
949
+ * charged on the 720p rows), and Kling 3.0's provider already sends such a
950
+ * size as 720p; whether Kling 2.6 should too is not decided. Only shrinks.
951
+ */
952
+ const MOTION_MODELS_SENT_AS_NAMED: ReadonlySet<string> = new Set(["motion-transfer", "kling-3.0-motion"])
953
+
954
+ /** The size a Motion Transfer run is sent and charged at, and what moved. */
955
+ export interface MotionTransferResolution {
956
+ resolution: string
957
+ /** Empty when the size it names is the one it runs at. */
958
+ adjustments: ModelInputAdjustment[]
959
+ }
960
+
961
+ /**
962
+ * The size a Motion Transfer run is sent and charged at (decided 2026-11-12):
963
+ * the size it names, held to the catalog entry of the model its option runs
964
+ * (`normalizeModelInput`), so a size that model does not have moves to the
965
+ * entry's `defaultResolution` — a Wan Animate request at 1080p runs, and is
966
+ * charged, as 720p. The route, the workflow build, the MCP workflow writes and
967
+ * every price (through `buildMotionCreditModelIdentifier`) read this one rule.
968
+ */
969
+ export function motionTransferResolution(provider: string, resolution: string): MotionTransferResolution {
970
+ const model = motionModelOf(provider)
971
+ if (MOTION_MODELS_SENT_AS_NAMED.has(model)) return { resolution, adjustments: [] }
972
+ const normalized = normalizeModelInput(model, { resolution })
973
+ if (normalized.resolution === undefined) return { resolution, adjustments: [] }
974
+ return { resolution: normalized.resolution, adjustments: normalized.adjustments }
975
+ }
976
+
977
+ function motionCreditIdentifier(
978
+ provider: string,
979
+ resolution: string,
980
+ videoDuration?: number,
907
981
  ): string {
908
982
  // Wan Animate providers use resolution-tiered pricing (not duration-based)
909
983
  if (provider === "wan-animate-move" || provider === "wan-animate-replace") {
@@ -24,11 +24,15 @@ export {
24
24
  imageGenAutoAspectNeedsSourceImage,
25
25
  buildVideoCreditModelIdentifier,
26
26
  seedanceVideoEditCreditId,
27
+ tailExtendCreditId,
28
+ tailExtendResolution,
27
29
  seedanceExtendCreditId,
28
30
  seedanceExtendResolution,
29
31
  videoGenerationCreditId,
30
32
  pricedVideoSelection,
31
33
  buildMotionCreditModelIdentifier,
34
+ motionTransferResolution,
35
+ type MotionTransferResolution,
32
36
  speedRampCreditId,
33
37
  applyEdlCreditId,
34
38
  speakerViewCreditId,
@@ -71,8 +75,15 @@ export {
71
75
  getLipSyncMaxAudioSeconds,
72
76
  isPerSecondLipSyncProvider,
73
77
  buildLipSyncCreditId,
78
+ LIP_SYNC_AUDIO_RATES,
79
+ OMNIHUMAN_2_0_PER_SECOND_CREDIT_ID,
80
+ lipSyncAudioRateOf,
81
+ lipSyncBilledSeconds,
82
+ lipSyncEstimateSeconds,
83
+ lipSyncFifteenSecondCreditId,
84
+ LIP_SYNC_UNMEASURED_ESTIMATE_SECONDS,
74
85
  } from "../lip-sync-pricing.js"
75
- export type { LipSyncDurationBucket } from "../lip-sync-pricing.js"
86
+ export type { LipSyncDurationBucket, LipSyncAudioRate } from "../lip-sync-pricing.js"
76
87
  export {
77
88
  AI_AVATAR_MAX_DURATION_SEC,
78
89
  AI_AVATAR_MAX_AUDIO_SEC,
@@ -51,6 +51,12 @@ export {
51
51
  supportsAdvancedMode,
52
52
  llmServesDirect,
53
53
  llmPriceKey,
54
+ LLM_PRICE_KEY_DIRECT,
55
+ LLM_PRICE_KEY_EFFORT,
56
+ parseLlmPriceKeyModel,
57
+ type LlmPriceKeyModel,
58
+ structuredWireMode,
59
+ llmSendsSchema,
54
60
  LLM_FEATURE_DEFAULTS_FROM,
55
61
  llmDefaultsFeature,
56
62
  LLM_CREDIT_RUNGS,
@@ -167,3 +167,12 @@ export {
167
167
  export type { ImageModelRole } from "../image-model-roles.js"
168
168
  export type { SafetyRetryPolicy } from "../safety-retry-policy.js"
169
169
  export { VIDEO_DURATION_AUTO, isAutoVideoDuration } from "../video-duration-auto.js"
170
+ // Video Upscale's target resolution per provider, coerced from the catalog
171
+ // (`resolutions` / `defaultResolution`) on every lane.
172
+ export {
173
+ VIDEO_UPSCALE_RESOLUTIONS,
174
+ videoUpscaleModelOf,
175
+ videoUpscaleResolutionsFor,
176
+ normalizeVideoUpscaleResolution,
177
+ } from "../video-upscale-params.js"
178
+ export type { VideoUpscaleResolution, NormalizedVideoUpscaleResolution } from "../video-upscale-params.js"
@@ -63,6 +63,8 @@ export {
63
63
  videoModelSupportsAudio,
64
64
  videoModelCanSpeakDialogue,
65
65
  applyVideoAudioToggle,
66
+ videoAudioIntent,
67
+ videoAudioPricedOn,
66
68
  VIDEO_VARIABLE_PRICING,
67
69
  VIDEO_DURATION_TIERS,
68
70
  ASPECT_RATIO_DIMENSIONS,
@@ -87,6 +89,7 @@ export {
87
89
  VIDEO_UPSCALE_PROVIDERS,
88
90
  EXTEND_VIDEO_PROVIDERS,
89
91
  isSeedanceExtendProvider,
92
+ isTailExtendProvider,
90
93
  LIP_SYNC_PROVIDERS,
91
94
  REPLICATE_LIP_SYNC_PROVIDERS,
92
95
  FAL_LIP_SYNC_PROVIDERS,
@@ -111,8 +114,12 @@ export {
111
114
  TRANSCRIBE_PROVIDERS,
112
115
  TRANSCRIBE_LANES,
113
116
  TRANSCRIBE_PROVIDER_CAPABILITIES,
117
+ CAPTION_TRANSCRIBE_LANES,
118
+ TRANSCRIBE_TARGET_LANGUAGES,
114
119
  transcribeProvidersWithWordTimestamps,
115
120
  transcribeLaneSupportsWordTimestamps,
121
+ transcribeProvidersWithTranslation,
122
+ transcribeLaneSupportsTranslation,
116
123
  DEFAULT_TRANSCRIBE_PROVIDER,
117
124
  DEFAULT_TRANSCRIBE_NODE_PROVIDER,
118
125
  SCRIPT_PROVIDERS,
@@ -196,6 +203,10 @@ export {
196
203
  normalizeGrokVideo15Resolution,
197
204
  GROK_VIDEO_15_MAX_MIDDLE_FRAMES,
198
205
  grokVideo15MiddleFrameSlots,
206
+ PIXVERSE_V6_MAX_PROVIDER,
207
+ isPixverseV6MaxProvider,
208
+ PIXVERSE_V6_MAX_DEFAULT_QUALITY,
209
+ normalizePixverseV6MaxQuality,
199
210
  videoKeyframesMiddleCap,
200
211
  VIDEO_REF_RATE_PROVIDERS,
201
212
  billsReferenceVideoSeconds,
@@ -302,6 +313,7 @@ export type {
302
313
  VideoUpscaleProvider,
303
314
  ExtendVideoProvider,
304
315
  SeedanceExtendProvider,
316
+ TailExtendProvider,
305
317
  FaceSwapProvider,
306
318
  LipSyncProvider,
307
319
  MotionTransferProviderType,
@@ -312,6 +324,8 @@ export type {
312
324
  MusicProvider,
313
325
  TranscribeProvider,
314
326
  TranscribeLane,
327
+ CaptionTranscribeLane,
328
+ TranscribeTargetLanguage,
315
329
  ScriptProvider,
316
330
  AiWriterProvider,
317
331
  QaCheckProvider,
@@ -327,6 +341,7 @@ export type {
327
341
  ModelPromptingStyle,
328
342
  VideoModelCapabilities,
329
343
  VideoAudioMode,
344
+ VideoAudioRequest,
330
345
  VideoAudioCapability,
331
346
  GvpAnchorChoice,
332
347
  GvpAnchorWireMode,
@@ -421,6 +436,18 @@ export type {
421
436
  TopazVideoTargetInput,
422
437
  TopazVideoTarget,
423
438
  } from "../topaz-video.js"
439
+ // --- Nodaro Video Upscale (tiers, limits) ---
440
+ export {
441
+ NODARO_VIDEO_UPSCALE_PROVIDER,
442
+ NODARO_VIDEO_UPSCALE_TIERS,
443
+ NODARO_VIDEO_UPSCALE_DEFAULT_TIER,
444
+ NODARO_VIDEO_UPSCALE_BOX,
445
+ NODARO_VIDEO_UPSCALE_MAX_SEC,
446
+ NODARO_VIDEO_UPSCALE_MAX_BYTES,
447
+ isNodaroVideoUpscaleTier,
448
+ isNodaroVideoUpscaleProvider,
449
+ } from "../nodaro-video-upscale.js"
450
+ export type { NodaroVideoUpscaleTier } from "../nodaro-video-upscale.js"
424
451
  export {
425
452
  AUDIO_SOUNDTRACK_MIN_SEC,
426
453
  AUDIO_SOUNDTRACK_FPS,
@@ -428,3 +455,11 @@ export {
428
455
  audioSoundtrackClipSec,
429
456
  audioSoundtrackPrompt,
430
457
  } from "../audio-soundtrack.js"
458
+ export {
459
+ LIP_SYNC_MODEL_LEVERS,
460
+ lipSyncLeversNotTaken,
461
+ lipSyncTakesLever,
462
+ lipSyncLeverClearPatch,
463
+ withoutLipSyncLeversNotTaken,
464
+ } from "../lip-sync-levers.js"
465
+ export type { LipSyncModelLever } from "../lip-sync-levers.js"
@@ -191,6 +191,8 @@ export {
191
191
  export * from "../node-pass-through.js"
192
192
  export {
193
193
  transcribeWordTimestampsRefusal,
194
+ transcribeTranslationRefusal,
195
+ transcribeTargetLanguageOf,
194
196
  findWordlessTranscriptFeeds,
195
197
  } from "../transcribe-preflight.js"
196
198
  export type { PreflightGraphNode, PreflightGraphEdge, WordlessTranscriptFeed } from "../transcribe-preflight.js"
@@ -23,7 +23,7 @@ export {
23
23
  VIDEO_CHARACTER_VOICE_EXAMPLE_MAX,
24
24
  } from "../video-character-refs.js"
25
25
  export type { VideoCharacterReference, VideoCharacterVoice, VideoCharacterRefProblem } from "../video-character-refs.js"
26
- export { extractVideoDurationFromNode, editPlanSourceDurationSec } from "../video-duration.js"
26
+ export { CONTAINER_OVERHANG_SEC, extractVideoDurationFromNode, editPlanSourceDurationSec } from "../video-duration.js"
27
27
  // --- Video URL node + social-video import (host allowlist, node output rule) ---
28
28
  export {
29
29
  SOCIAL_VIDEO_HOSTS,
@@ -32,6 +32,14 @@ export interface NodaroLoadVideoPayload {
32
32
  readonly videoBuffer?: ArrayBuffer
33
33
  readonly projectJson?: unknown
34
34
  readonly additionalFiles?: ReadonlyArray<FreecutImportFile>
35
+ /**
36
+ * What the editor's Save & Exit hands back. "video": it renders the timeline
37
+ * and answers with FREECUT_EXPORT_COMPLETE (the video and the project JSON),
38
+ * for a parent that keeps an edit as a new video (the workflow editor).
39
+ * Absent or "project": it answers with the project JSON alone
40
+ * (FREECUT_SAVE_EXIT), for a parent that renders the cut itself (Studio).
41
+ */
42
+ readonly saveExit?: "video" | "project"
35
43
  }
36
44
 
37
45
  export interface NodaroLoadTimelinePayload {
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The Lip Sync node's model-specific levers that a model may not take.
3
+ *
4
+ * OmniHuman 2.0 sits beside OmniHuman 1.5 but is not a superset of it: it has
5
+ * no resolution choice (always 720p), no fast mode and no seed (decided
6
+ * 2026-11-11). A node switched from 1.5 keeps those values in its data unless
7
+ * something clears them, and a node written straight into workflow JSON, an
8
+ * API body or an MCP call can carry them too. One table, read by every
9
+ * surface: the config panel (its dropdown and fail-safe effect), the quick
10
+ * strip's model switch, the lip-sync route and the workflow payload.
11
+ *
12
+ * Only models listed here lose anything: every other model's levers are left
13
+ * exactly as they were.
14
+ */
15
+
16
+ /** The generic levers the Lip Sync node carries beside its inputs and prompt. */
17
+ export const LIP_SYNC_MODEL_LEVERS = ["resolution", "fastMode", "seed"] as const
18
+ export type LipSyncModelLever = typeof LIP_SYNC_MODEL_LEVERS[number]
19
+
20
+ const LEVERS_NOT_TAKEN: Readonly<Record<string, readonly LipSyncModelLever[]>> = {
21
+ "omnihuman-2-0": ["resolution", "fastMode", "seed"],
22
+ }
23
+
24
+ /** The levers `provider` does not take (none for a model this table does not list). */
25
+ export function lipSyncLeversNotTaken(provider: unknown): readonly LipSyncModelLever[] {
26
+ return typeof provider === "string" && Object.prototype.hasOwnProperty.call(LEVERS_NOT_TAKEN, provider)
27
+ ? LEVERS_NOT_TAKEN[provider]!
28
+ : []
29
+ }
30
+
31
+ /** Does `provider` take this lever? */
32
+ export function lipSyncTakesLever(provider: unknown, lever: LipSyncModelLever): boolean {
33
+ return !lipSyncLeversNotTaken(provider).includes(lever)
34
+ }
35
+
36
+ /**
37
+ * A patch that clears every lever `provider` does not take and `data` still
38
+ * holds (each written as `undefined`). Empty when there is nothing to clear,
39
+ * so a caller can skip the write.
40
+ */
41
+ export function lipSyncLeverClearPatch(
42
+ provider: unknown,
43
+ data: Readonly<Record<string, unknown>>,
44
+ ): Partial<Record<LipSyncModelLever, undefined>> {
45
+ const patch: Partial<Record<LipSyncModelLever, undefined>> = {}
46
+ for (const lever of lipSyncLeversNotTaken(provider)) {
47
+ if (data[lever] !== undefined) patch[lever] = undefined
48
+ }
49
+ return patch
50
+ }
51
+
52
+ /** `data` without the levers `provider` does not take: a copy when any was dropped, else `data` itself. */
53
+ export function withoutLipSyncLeversNotTaken<T extends Readonly<Record<string, unknown>>>(provider: unknown, data: T): T {
54
+ const patch = lipSyncLeverClearPatch(provider, data)
55
+ return Object.keys(patch).length === 0 ? data : { ...data, ...patch }
56
+ }