@nodaro/shared 3.62.0 → 3.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/{chunk-C7POAYFE.js → chunk-36VWLB4J.js} +3 -3
  2. package/dist/{chunk-C7POAYFE.js.map → chunk-36VWLB4J.js.map} +1 -1
  3. package/dist/{chunk-S24ZBUB4.js → chunk-3AYM47GW.js} +6 -32
  4. package/dist/chunk-3AYM47GW.js.map +1 -0
  5. package/dist/{chunk-YCXRSWCQ.js → chunk-3KTWYYCN.js} +8 -5
  6. package/dist/chunk-3KTWYYCN.js.map +1 -0
  7. package/dist/{chunk-ZES6EZC4.js → chunk-4IUE2JB7.js} +3 -3
  8. package/dist/{chunk-ZES6EZC4.js.map → chunk-4IUE2JB7.js.map} +1 -1
  9. package/dist/{chunk-MYJQELFN.cjs → chunk-5OBTGNUQ.cjs} +547 -29
  10. package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
  11. package/dist/{chunk-TWF2OSH4.cjs → chunk-67CMMTLN.cjs} +4 -4
  12. package/dist/{chunk-TWF2OSH4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-S5TMRJMX.js → chunk-6YIV37V7.js} +4 -4
  16. package/dist/{chunk-S5TMRJMX.js.map → chunk-6YIV37V7.js.map} +1 -1
  17. package/dist/{chunk-3M4BNKFJ.cjs → chunk-7AJGUI7L.cjs} +202 -16
  18. package/dist/chunk-7AJGUI7L.cjs.map +1 -0
  19. package/dist/{chunk-JZGZ26YB.js → chunk-7KQ6W5DS.js} +4 -4
  20. package/dist/{chunk-JZGZ26YB.js.map → chunk-7KQ6W5DS.js.map} +1 -1
  21. package/dist/{chunk-IWWVPR3W.cjs → chunk-ACZZHHFZ.cjs} +149 -34
  22. package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
  23. package/dist/{chunk-2W745U4A.cjs → chunk-AZNZ5WNZ.cjs} +42 -70
  24. package/dist/chunk-AZNZ5WNZ.cjs.map +1 -0
  25. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  26. package/dist/chunk-BQYCZLMF.js.map +1 -0
  27. package/dist/chunk-CHS2SIP6.cjs +504 -0
  28. package/dist/chunk-CHS2SIP6.cjs.map +1 -0
  29. package/dist/{chunk-CIPPPT7E.cjs → chunk-CHTZZRAL.cjs} +6 -6
  30. package/dist/{chunk-CIPPPT7E.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
  31. package/dist/{chunk-AOJ6B7K4.cjs → chunk-D4KWNDPH.cjs} +12 -12
  32. package/dist/chunk-D4KWNDPH.cjs.map +1 -0
  33. package/dist/{chunk-5YYN5X57.js → chunk-DZ4IOP3Q.js} +536 -30
  34. package/dist/chunk-DZ4IOP3Q.js.map +1 -0
  35. package/dist/{chunk-VACPZPUA.cjs → chunk-EXEVT6D2.cjs} +15 -5
  36. package/dist/chunk-EXEVT6D2.cjs.map +1 -0
  37. package/dist/{chunk-5M43XMRB.cjs → chunk-FHGRKQVZ.cjs} +8 -8
  38. package/dist/{chunk-5M43XMRB.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
  39. package/dist/{chunk-KJSRPHJ2.cjs → chunk-GTWUS6MQ.cjs} +165 -54
  40. package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
  41. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  42. package/dist/chunk-H5KHWTAE.js.map +1 -0
  43. package/dist/{chunk-G3KVK7OU.cjs → chunk-HDPJNNMF.cjs} +21 -21
  44. package/dist/{chunk-G3KVK7OU.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
  45. package/dist/{chunk-3OYO3XCC.js → chunk-IYSOVS7O.js} +118 -24
  46. package/dist/chunk-IYSOVS7O.js.map +1 -0
  47. package/dist/{chunk-AFYTX4AI.cjs → chunk-J6B7J73J.cjs} +110 -50
  48. package/dist/chunk-J6B7J73J.cjs.map +1 -0
  49. package/dist/{chunk-I2RQB7VG.js → chunk-KB2SQAR3.js} +3 -3
  50. package/dist/{chunk-I2RQB7VG.js.map → chunk-KB2SQAR3.js.map} +1 -1
  51. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  52. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  53. package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
  54. package/dist/chunk-NIAFR5EE.js.map +1 -0
  55. package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
  56. package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
  57. package/dist/{chunk-IDTKF5EX.cjs → chunk-O4RPXBDZ.cjs} +12 -8
  58. package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
  59. package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
  60. package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
  61. package/dist/{chunk-PTD6EDUU.js → chunk-OBOOHG3N.js} +13 -4
  62. package/dist/chunk-OBOOHG3N.js.map +1 -0
  63. package/dist/{chunk-2D5LQFV4.cjs → chunk-OOZW2MM6.cjs} +9 -9
  64. package/dist/{chunk-2D5LQFV4.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
  65. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  66. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  67. package/dist/{chunk-G4U3HW6W.js → chunk-PJJAZQVZ.js} +3 -3
  68. package/dist/{chunk-G4U3HW6W.js.map → chunk-PJJAZQVZ.js.map} +1 -1
  69. package/dist/{chunk-E2HZTGYX.js → chunk-Q2Y4JHF7.js} +7 -7
  70. package/dist/chunk-Q2Y4JHF7.js.map +1 -0
  71. package/dist/{chunk-FVII3KHN.js → chunk-QYU7J5EQ.js} +198 -17
  72. package/dist/chunk-QYU7J5EQ.js.map +1 -0
  73. package/dist/{chunk-JJNNM23P.js → chunk-S3UGLZSF.js} +3 -3
  74. package/dist/{chunk-JJNNM23P.js.map → chunk-S3UGLZSF.js.map} +1 -1
  75. package/dist/{chunk-CC4V2B7S.js → chunk-SHH2T4CR.js} +3 -3
  76. package/dist/{chunk-CC4V2B7S.js.map → chunk-SHH2T4CR.js.map} +1 -1
  77. package/dist/{chunk-4ZEFP2FQ.cjs → chunk-SPAHI7DY.cjs} +4 -4
  78. package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
  79. package/dist/{chunk-Y6X7UJSD.js → chunk-SXHHLZ22.js} +122 -15
  80. package/dist/chunk-SXHHLZ22.js.map +1 -0
  81. package/dist/{chunk-HRY7KGAE.cjs → chunk-T2OVDF2M.cjs} +6 -6
  82. package/dist/{chunk-HRY7KGAE.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
  83. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  84. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  85. package/dist/{chunk-NGKKNSK6.js → chunk-TPQJKS7D.js} +139 -16
  86. package/dist/chunk-TPQJKS7D.js.map +1 -0
  87. package/dist/{chunk-N7OUQK7E.cjs → chunk-TQW3R44P.cjs} +8 -8
  88. package/dist/{chunk-N7OUQK7E.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
  89. package/dist/{chunk-GSFB537T.js → chunk-TTGZ2L3O.js} +23 -4
  90. package/dist/chunk-TTGZ2L3O.js.map +1 -0
  91. package/dist/{chunk-SYWR5G3T.js → chunk-VPTA4Z7G.js} +54 -7
  92. package/dist/chunk-VPTA4Z7G.js.map +1 -0
  93. package/dist/{chunk-2HZGDZZN.cjs → chunk-VZ6TE23U.cjs} +6 -6
  94. package/dist/{chunk-2HZGDZZN.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
  95. package/dist/{chunk-TRVWMKNE.cjs → chunk-W6VJAUGM.cjs} +285 -64
  96. package/dist/chunk-W6VJAUGM.cjs.map +1 -0
  97. package/dist/{chunk-UDDVDQMF.js → chunk-W7KHHNZR.js} +235 -37
  98. package/dist/chunk-W7KHHNZR.js.map +1 -0
  99. package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
  100. package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
  101. package/dist/{chunk-6CSXMWL4.cjs → chunk-YQV53HRR.cjs} +27 -4
  102. package/dist/chunk-YQV53HRR.cjs.map +1 -0
  103. package/dist/{chunk-7FCTCWHD.js → chunk-ZI3QDUHO.js} +3 -3
  104. package/dist/{chunk-7FCTCWHD.js.map → chunk-ZI3QDUHO.js.map} +1 -1
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.js +8 -7
  107. package/dist/entries/captions.cjs +38 -30
  108. package/dist/entries/captions.d.cts +47 -1
  109. package/dist/entries/captions.d.ts +47 -1
  110. package/dist/entries/captions.js +1 -1
  111. package/dist/entries/credits.cjs +354 -174
  112. package/dist/entries/credits.d.cts +378 -27
  113. package/dist/entries/credits.d.ts +378 -27
  114. package/dist/entries/credits.js +11 -11
  115. package/dist/entries/llm-models.cjs +77 -57
  116. package/dist/entries/llm-models.d.cts +108 -7
  117. package/dist/entries/llm-models.d.ts +108 -7
  118. package/dist/entries/llm-models.js +2 -2
  119. package/dist/entries/media.cjs +63 -63
  120. package/dist/entries/media.d.cts +8 -0
  121. package/dist/entries/media.d.ts +8 -0
  122. package/dist/entries/media.js +1 -1
  123. package/dist/entries/model-catalog.cjs +161 -105
  124. package/dist/entries/model-catalog.d.cts +109 -22
  125. package/dist/entries/model-catalog.d.ts +109 -22
  126. package/dist/entries/model-catalog.js +4 -4
  127. package/dist/entries/models.cjs +466 -322
  128. package/dist/entries/models.d.cts +71 -5
  129. package/dist/entries/models.d.ts +71 -5
  130. package/dist/entries/models.js +5 -5
  131. package/dist/entries/nodes.cjs +226 -209
  132. package/dist/entries/nodes.d.cts +66 -7
  133. package/dist/entries/nodes.d.ts +66 -7
  134. package/dist/entries/nodes.js +10 -9
  135. package/dist/entries/pipeline.cjs +156 -152
  136. package/dist/entries/pipeline.d.cts +14 -4
  137. package/dist/entries/pipeline.d.ts +14 -4
  138. package/dist/entries/pipeline.js +3 -3
  139. package/dist/entries/runtime-config.cjs +29 -29
  140. package/dist/entries/runtime-config.d.cts +10 -7
  141. package/dist/entries/runtime-config.d.ts +10 -7
  142. package/dist/entries/runtime-config.js +1 -1
  143. package/dist/entries/social.cjs +177 -177
  144. package/dist/entries/social.js +2 -2
  145. package/dist/entries/types.d.cts +8 -0
  146. package/dist/entries/types.d.ts +8 -0
  147. package/dist/entries/ugc.cjs +71 -71
  148. package/dist/entries/ugc.js +4 -4
  149. package/dist/entries/video.cjs +154 -150
  150. package/dist/entries/video.d.cts +11 -2
  151. package/dist/entries/video.d.ts +11 -2
  152. package/dist/entries/video.js +6 -6
  153. package/dist/entries/workflow.cjs +150 -150
  154. package/dist/entries/workflow.d.cts +1 -1
  155. package/dist/entries/workflow.d.ts +1 -1
  156. package/dist/entries/workflow.js +2 -2
  157. package/dist/index.cjs +2136 -1704
  158. package/dist/index.d.cts +10 -10
  159. package/dist/index.d.ts +10 -10
  160. package/dist/index.js +27 -27
  161. package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-Cf9fkEUp.d.cts} +45 -2
  162. package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-Cf9fkEUp.d.ts} +45 -2
  163. package/dist/{model-constants-B88p6XR0.d.ts → model-constants-BxjiWVQ9.d.ts} +215 -32
  164. package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-C_Nyft_i.d.cts} +215 -32
  165. package/package.json +1 -1
  166. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  167. package/src/__tests__/credit-identifiers.test.ts +29 -0
  168. package/src/__tests__/extend-providers.test.ts +359 -39
  169. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  170. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  171. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  172. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  173. package/src/__tests__/flux-3-klein.test.ts +203 -0
  174. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  175. package/src/__tests__/gvp-supported-providers.test.ts +27 -2
  176. package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
  177. package/src/__tests__/lip-sync-levers.test.ts +31 -0
  178. package/src/__tests__/llm-models.test.ts +139 -12
  179. package/src/__tests__/llm-price-key.test.ts +164 -1
  180. package/src/__tests__/model-makers.test.ts +3 -0
  181. package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
  182. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  183. package/src/__tests__/normalize-node-params.test.ts +172 -1
  184. package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
  185. package/src/__tests__/prompt-length-limits.test.ts +4 -0
  186. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  187. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  188. package/src/__tests__/seedance-task-type.test.ts +13 -3
  189. package/src/__tests__/sequence-execution.test.ts +22 -1
  190. package/src/__tests__/suno-credit-type.test.ts +21 -2
  191. package/src/__tests__/transcribe-capabilities.test.ts +41 -2
  192. package/src/__tests__/transcribe-preflight.test.ts +50 -1
  193. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  194. package/src/__tests__/video-analysis-pricing.test.ts +10 -9
  195. package/src/__tests__/video-audio-capability.test.ts +35 -6
  196. package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
  197. package/src/__tests__/video-upscale-params.test.ts +62 -0
  198. package/src/caption-styles.ts +62 -0
  199. package/src/catalog-projection.ts +8 -0
  200. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  201. package/src/credit-estimators/index.ts +20 -0
  202. package/src/credit-estimators/nemotron-transcribe.ts +87 -0
  203. package/src/credit-identifiers.ts +351 -41
  204. package/src/entries/captions.ts +2 -0
  205. package/src/entries/credits.ts +37 -2
  206. package/src/entries/llm-models.ts +6 -0
  207. package/src/entries/model-catalog.ts +22 -0
  208. package/src/entries/models.ts +50 -0
  209. package/src/entries/nodes.ts +4 -0
  210. package/src/entries/pipeline.ts +1 -1
  211. package/src/entries/video.ts +1 -1
  212. package/src/flux-3-klein.ts +69 -0
  213. package/src/freecut-protocol.ts +8 -0
  214. package/src/input-image-pricing.ts +23 -6
  215. package/src/lip-sync-levers.ts +56 -0
  216. package/src/lip-sync-pricing.ts +91 -1
  217. package/src/llm-models.ts +305 -16
  218. package/src/model-catalog.ts +529 -28
  219. package/src/model-constants.ts +417 -41
  220. package/src/model-tree.ts +2 -1
  221. package/src/nodaro-video-upscale.ts +48 -0
  222. package/src/node-default-mappings.ts +6 -0
  223. package/src/node-runtime-keys.ts +3 -0
  224. package/src/normalize-node-params.ts +172 -3
  225. package/src/runtime-config/contract.ts +10 -7
  226. package/src/seedance-draft.ts +2 -1
  227. package/src/seedance-extend-rate.ts +116 -0
  228. package/src/sequence-execution.ts +24 -0
  229. package/src/transcribe-preflight.ts +81 -7
  230. package/src/video-analysis-pricing.ts +28 -15
  231. package/src/video-duration.ts +9 -0
  232. package/src/video-ui-defaults.ts +5 -3
  233. package/src/video-upscale-params.ts +67 -0
  234. package/dist/chunk-2W745U4A.cjs.map +0 -1
  235. package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
  236. package/dist/chunk-3OYO3XCC.js.map +0 -1
  237. package/dist/chunk-5YYN5X57.js.map +0 -1
  238. package/dist/chunk-6CSXMWL4.cjs.map +0 -1
  239. package/dist/chunk-6G7NN4S4.js.map +0 -1
  240. package/dist/chunk-AFYTX4AI.cjs.map +0 -1
  241. package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
  242. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  243. package/dist/chunk-E2HZTGYX.js.map +0 -1
  244. package/dist/chunk-FVII3KHN.js.map +0 -1
  245. package/dist/chunk-GSFB537T.js.map +0 -1
  246. package/dist/chunk-HSHCCBIV.js.map +0 -1
  247. package/dist/chunk-IDTKF5EX.cjs.map +0 -1
  248. package/dist/chunk-IWWVPR3W.cjs.map +0 -1
  249. package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
  250. package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
  251. package/dist/chunk-MYJQELFN.cjs.map +0 -1
  252. package/dist/chunk-NGKKNSK6.js.map +0 -1
  253. package/dist/chunk-PTD6EDUU.js.map +0 -1
  254. package/dist/chunk-Q6IES3U2.js.map +0 -1
  255. package/dist/chunk-QWYFHQYK.cjs +0 -357
  256. package/dist/chunk-QWYFHQYK.cjs.map +0 -1
  257. package/dist/chunk-S24ZBUB4.js.map +0 -1
  258. package/dist/chunk-SYWR5G3T.js.map +0 -1
  259. package/dist/chunk-TRVWMKNE.cjs.map +0 -1
  260. package/dist/chunk-UDDVDQMF.js.map +0 -1
  261. package/dist/chunk-VACPZPUA.cjs.map +0 -1
  262. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  263. package/dist/chunk-Y6X7UJSD.js.map +0 -1
  264. package/dist/chunk-YCXRSWCQ.js.map +0 -1
@@ -163,8 +163,10 @@ describe("bare video-analysis node-type credit id", () => {
163
163
  // plugin's token pin 8_203 -> 8_482, 356 wrote 2071: Stage 1.3 grew
164
164
  // that prompt again, moving the pin 8_482 -> 8_706, and 357 wrote 2076:
165
165
  // the transition vocabulary v2 doctrine (twelve named values; absent =
166
- // nothing asserted) grew it once more, moving the pin 8_706 -> 9_082.
167
- expect(ceiling).toBe(2076)
166
+ // nothing asserted) grew it once more, moving the pin 8_706 -> 9_082, and
167
+ // the fast-tier move to gemini-3.8-flash (2026-11-13) wrote 2097: smart's
168
+ // donor rolls roll the fast model too.
169
+ expect(ceiling).toBe(2097)
168
170
  })
169
171
 
170
172
  it("the bare id still bounds the default tier at the ceiling bucket", () => {
@@ -60,7 +60,7 @@ describe("video-analysis-pricing", () => {
60
60
  })
61
61
 
62
62
  it("model SSOT is capability-derived and Gemini-only today", () => {
63
- expect(VIDEO_ANALYSIS_LLM_MODELS).toEqual(["gemini-3-flash", "gemini-3.6-flash", "gemini-3.1-pro"])
63
+ expect(VIDEO_ANALYSIS_LLM_MODELS).toEqual(["gemini-3-flash", "gemini-3.6-flash", "gemini-3.8-flash", "gemini-3.1-pro"])
64
64
  })
65
65
 
66
66
  it("tier layer: every model-backed tier maps to a real model AND every model is tier-reachable or explicitly legacy (no vendor leak)", () => {
@@ -103,9 +103,10 @@ describe("video-analysis-pricing", () => {
103
103
  expect(DEFAULT_VIDEO_ANALYSIS_TIER).toBe("pro")
104
104
  expect(DEFAULT_VIDEO_ANALYSIS_MODEL).toBe("gemini-3.1-pro")
105
105
  expect(resolveVideoAnalysisModel("pro")).toBe("gemini-3.1-pro")
106
- // The economy tiers moved to the cheaper flash generation when they moved to
107
- // the cheaper transport; the newer flash now sits behind the `smart` sentinel.
108
- expect(resolveVideoAnalysisModel("fast")).toBe("gemini-3-flash")
106
+ // The fast tier moved to gemini-3.8-flash when KIE dropped gemini-3-flash's
107
+ // channel (2026-11-13); gemini-3-flash is now a legacy fast backing.
108
+ expect(resolveVideoAnalysisModel("fast")).toBe("gemini-3.8-flash")
109
+ expect(VIDEO_ANALYSIS_LEGACY_MODELS["gemini-3-flash"]).toBe("fast")
109
110
  expect(resolveVideoAnalysisModel("mixed")).toBe("mixed") // roll-plan sentinel passthrough
110
111
  expect(resolveVideoAnalysisModel("mixed-fast")).toBe("mixed-fast")
111
112
  // `smart` is a sentinel too — it names an engine plan, never a model id, so the
@@ -193,11 +194,11 @@ describe("video-audit-pricing", () => {
193
194
 
194
195
  it("videoAuditCreditsForBucket: table lookup by resolved bucket + family, snapping a raw duration onto the ladder", () => {
195
196
  expect(videoAuditCreditsForBucket(60, false)).toBe(215)
196
- expect(videoAuditCreditsForBucket(60, true)).toBe(396)
197
+ expect(videoAuditCreditsForBucket(60, true)).toBe(401)
197
198
  expect(videoAuditCreditsForBucket(180, false)).toBe(290)
198
199
  expect(videoAuditCreditsForBucket(360, false)).toBe(663)
199
200
  expect(videoAuditCreditsForBucket(600, false)).toBe(1073)
200
- expect(videoAuditCreditsForBucket(600, true)).toBe(1921)
201
+ expect(videoAuditCreditsForBucket(600, true)).toBe(1953)
201
202
  // Not just exact ladder values — a raw duration snaps up to its bucket.
202
203
  expect(videoAuditCreditsForBucket(70, false)).toBe(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:180s"])
203
204
  expect(videoAuditCreditsForBucket(9999, true)).toBe(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"])
@@ -239,17 +240,17 @@ describe("video-audit-pricing", () => {
239
240
  expect(Object.keys(VIDEO_AUDIT_BUCKET_CREDITS)).toHaveLength(8)
240
241
  // Bare-id values quoted in the task/catalog must equal each family's 600s ceiling.
241
242
  expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:600s"]).toBe(1073)
242
- expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"]).toBe(1921)
243
+ expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"]).toBe(1953)
243
244
  })
244
245
 
245
- it("auto family = base family + the gemini-3-flash (legacy fast tier) row at the same bucket, exactly — single-source, never hand-added", () => {
246
+ it("auto family = base family + the fast tier's row at the same bucket, exactly — single-source, never hand-added", () => {
246
247
  // Single-source assertion: reads the fast-tier row straight out of
247
248
  // VIDEO_ANALYSIS_BUCKET_CREDITS rather than re-hardcoding 180/185/514/846
248
249
  // here, so this test can't silently drift from that table either.
249
250
  for (const bucketSec of VIDEO_ANALYSIS_DURATION_BUCKETS) {
250
251
  const base = VIDEO_AUDIT_BUCKET_CREDITS[`video-audit:${bucketSec}s`]!
251
252
  const auto = VIDEO_AUDIT_BUCKET_CREDITS[`video-audit:auto:${bucketSec}s`]!
252
- const fastRow = VIDEO_ANALYSIS_BUCKET_CREDITS[`video-analysis:gemini-3-flash:${bucketSec}s`]!
253
+ const fastRow = VIDEO_ANALYSIS_BUCKET_CREDITS[buildVideoAnalysisCreditId(VIDEO_ANALYSIS_TIERS.fast, bucketSec)]!
253
254
  expect(auto - base, `auto-base mismatch at ${bucketSec}s`).toBe(fastRow)
254
255
  }
255
256
  })
@@ -159,18 +159,34 @@ describe("seedance-2-mini is a full Seedance 2 family member", () => {
159
159
  })
160
160
 
161
161
  describe("VIDEO_AUDIO_CAPABILITY internal consistency", () => {
162
- it("every AUDIO_ADDON provider is cost-affecting on the canonical `sound` lever", () => {
162
+ it("every AUDIO_ADDON provider is cost-affecting on the canonical `sound` intent", () => {
163
163
  // The billing-critical invariant: the `:audio` surcharge keys off `sound`,
164
- // so every surcharged model must declare audio, be marked cost-affecting,
165
- // and carry its toggle on that exact field (applyVideoAudioToggle then
166
- // refuses the generateAudio alias for these, making a billed/generated
167
- // divergence structurally impossible).
164
+ // so every surcharged model must declare audio, be marked cost-affecting
165
+ // (applyVideoAudioToggle then reads ONLY `sound` for it and refuses the
166
+ // generateAudio alias), and have a switch to write it to — Kling's wire
167
+ // key is `sound`, PixVerse V6 Max's `generate_audio_switch`. A
168
+ // billed/generated divergence is then structurally impossible.
168
169
  for (const m of AUDIO_ADDON_PROVIDERS) {
169
170
  const cap = getVideoAudioCapability(m)
170
171
  expect(cap.mode, m).not.toBe("none")
171
- expect(cap.field, m).toBe("sound")
172
+ expect(cap.field, m).toBeDefined()
173
+ expect(cap.alwaysOn, m).toBeUndefined()
172
174
  expect(cap.affectsCost, m).toBe(true)
175
+ for (const sound of [true, false]) {
176
+ const viaSound: Record<string, unknown> = {}
177
+ applyVideoAudioToggle(viaSound, m, { sound })
178
+ expect(Object.values(viaSound), m).toEqual([sound])
179
+ }
180
+ // The alias turns the switch only on a model that declares it reads it
181
+ // (PixVerse V6 Max) — its price reads the same field (videoAudioIntent).
182
+ const viaAlias: Record<string, unknown> = {}
183
+ applyVideoAudioToggle(viaAlias, m, { generateAudio: true })
184
+ expect(viaAlias, m).toEqual(getVideoAudioCapability(m).readsGenerateAudio ? { generate_audio_switch: true } : {})
173
185
  }
186
+ expect(getVideoAudioCapability("kling").field).toBe("sound")
187
+ expect(getVideoAudioCapability("kling-3.0").field).toBe("sound")
188
+ expect(getVideoAudioCapability("kling").readsGenerateAudio).toBeUndefined()
189
+ expect(getVideoAudioCapability("kling-3.0").readsGenerateAudio).toBeUndefined()
174
190
  })
175
191
 
176
192
  it("every VEO provider is native_speech", () => {
@@ -298,3 +314,16 @@ describe("applyVideoAudioToggle — neutral audio intent → per-model KIE field
298
314
  expect(input.generate_audio).toBe(true)
299
315
  })
300
316
  })
317
+
318
+ describe("readsGenerateAudio", () => {
319
+ it("is declared only by a cost-affecting model with a switch (today PixVerse V6 Max alone)", () => {
320
+ const declaring = Object.entries(VIDEO_AUDIO_CAPABILITY).filter(([, cap]) => cap.readsGenerateAudio).map(([m]) => m)
321
+ expect(declaring).toEqual(["pixverse-v6-max"])
322
+ for (const m of declaring) {
323
+ const cap = getVideoAudioCapability(m)
324
+ expect(cap.affectsCost, m).toBe(true)
325
+ expect(cap.field, m).toBeDefined()
326
+ expect(AUDIO_ADDON_PROVIDERS.has(m), m).toBe(true)
327
+ }
328
+ })
329
+ })
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A video model whose runner normalizes its resolution lever (Wan 3.0, Vidu Q4,
3
+ * Kling 4.0, PixVerse V6 Max, …) bills — through the very normalizer the runner
4
+ * sends — each of its catalog tiers on the 480p / 720p / 1080p / 4k ladder as
5
+ * that tier. Generate Video Pro offers exactly those tiers (`@nodaro/render-rules`
6
+ * `gvpOfferedResolutions`), so this is what makes each of them render as named.
7
+ */
8
+ import { describe, it, expect } from "vitest"
9
+ import { MODEL_CATALOG } from "../model-catalog.js"
10
+ import { GVP_SUPPORTED_PROVIDERS, RESOLUTION_DURATION_PRICING } from "../model-constants.js"
11
+ import { buildVideoCreditModelIdentifier } from "../credit-identifiers.js"
12
+
13
+ const LADDER = ["480p", "720p", "1080p", "4k"]
14
+
15
+ describe("a Generate Video Pro model bills each ladder tier of its catalog as named", () => {
16
+ it("holds for every pro model priced by (seconds × resolution)", () => {
17
+ const checked: string[] = []
18
+ for (const p of GVP_SUPPORTED_PROVIDERS) {
19
+ const tiers = RESOLUTION_DURATION_PRICING[p]
20
+ if (!tiers) continue
21
+ for (const r of (MODEL_CATALOG[p]?.resolutions ?? []) as readonly string[]) {
22
+ if (!LADDER.includes(r) || !tiers.includes(r)) continue
23
+ expect(buildVideoCreditModelIdentifier(p, 8, false, "image-to-video", undefined, r, false), `${p} ${r}`).toMatch(new RegExp(`:${r}(?::|-|$)`))
24
+ checked.push(p)
25
+ }
26
+ }
27
+ // The families whose runner normalizes are all among them.
28
+ for (const p of ["wan-3", "vidu-q4", "kling-4", "kling-4-flash", "pixverse-v6-max"]) expect(checked, p).toContain(p)
29
+ })
30
+ })
@@ -0,0 +1,62 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { MODEL_CATALOG } from "../model-catalog.js"
3
+ import { normalizeVideoUpscaleResolution, videoUpscaleModelOf, videoUpscaleResolutionsFor, VIDEO_UPSCALE_RESOLUTIONS } from "../video-upscale-params.js"
4
+ import { normalizeNodeModelParams } from "../normalize-node-params.js"
5
+ import { VIDEO_UPSCALE_PROVIDERS } from "../model-constants.js"
6
+ import { NODARO_VIDEO_UPSCALE_DEFAULT_TIER, NODARO_VIDEO_UPSCALE_TIERS } from "../nodaro-video-upscale.js"
7
+ import { TOPAZ_VIDEO_RESOLUTIONS } from "../topaz-video.js"
8
+
9
+ /**
10
+ * The Video Upscale node's target resolution: held to what its provider takes
11
+ * only for a provider whose catalog entry declares its resolutions — Nodaro
12
+ * Video Upscale's 1080p / 2K / 4K. Topaz keeps its own list (720p / 1080p /
13
+ * 4K, `TOPAZ_VIDEO_RESOLUTIONS`) and every other provider's node is left
14
+ * exactly as it came: its run reads the field by its own rules.
15
+ */
16
+ describe("Video Upscale target resolution per provider", () => {
17
+ it("only Nodaro Video Upscale's catalog entry declares resolutions; the route's enum covers every provider's", () => {
18
+ expect(videoUpscaleResolutionsFor("nodaro-video-upscale")).toEqual([...NODARO_VIDEO_UPSCALE_TIERS])
19
+ for (const p of ["topaz", undefined, "veo-1080p", "veo-4k", "seedance-2-5-hd"]) {
20
+ expect(videoUpscaleResolutionsFor(p), String(p)).toEqual([])
21
+ }
22
+ expect(MODEL_CATALOG["topaz-video"]).not.toHaveProperty("resolutions")
23
+ expect(MODEL_CATALOG["topaz-video"]).not.toHaveProperty("defaultResolution")
24
+ for (const p of VIDEO_UPSCALE_PROVIDERS) expect(MODEL_CATALOG[videoUpscaleModelOf(p)], p).toBeDefined()
25
+ for (const r of [...TOPAZ_VIDEO_RESOLUTIONS, ...NODARO_VIDEO_UPSCALE_TIERS]) expect(VIDEO_UPSCALE_RESOLUTIONS).toContain(r)
26
+ })
27
+
28
+ it("coerces a value Nodaro Video Upscale does not take to its default, and canonicalises its spelling", () => {
29
+ expect(MODEL_CATALOG["nodaro-video-upscale"]!.defaultResolution).toBe(NODARO_VIDEO_UPSCALE_DEFAULT_TIER)
30
+ expect(normalizeVideoUpscaleResolution("nodaro-video-upscale", "720p").targetResolution).toBe("1080p")
31
+ expect(normalizeVideoUpscaleResolution("nodaro-video-upscale", "720p").adjustment?.reason).toMatch(/Nodaro Video Upscale/)
32
+ expect(normalizeVideoUpscaleResolution("nodaro-video-upscale", "2K")).toEqual({ targetResolution: "2k" })
33
+ })
34
+
35
+ it("leaves every other provider's value, and an unset value, as it came", () => {
36
+ expect(normalizeVideoUpscaleResolution("topaz", "2k")).toEqual({ targetResolution: "2k" })
37
+ expect(normalizeVideoUpscaleResolution("topaz", "4K")).toEqual({ targetResolution: "4K" })
38
+ expect(normalizeVideoUpscaleResolution(undefined, "2k")).toEqual({ targetResolution: "2k" })
39
+ expect(normalizeVideoUpscaleResolution("veo-4k", "1080p")).toEqual({ targetResolution: "1080p" })
40
+ expect(normalizeVideoUpscaleResolution("nodaro-video-upscale", undefined)).toEqual({ targetResolution: undefined })
41
+ expect(normalizeVideoUpscaleResolution("nodaro-video-upscale", "")).toEqual({ targetResolution: undefined })
42
+ })
43
+
44
+ it("a node written straight into workflow JSON: only Nodaro Video Upscale's is healed; Topaz's, VEO's and an unnamed provider's come back as the same node", () => {
45
+ const nodes = [
46
+ // Topaz's spellings and another provider's target: left for its run, which drops what it does not take.
47
+ { id: "a", type: "video-upscale", data: { provider: "topaz", targetResolution: "4K" } },
48
+ // The old factor path stays: the run reads the factor when the target is not Topaz's.
49
+ { id: "b", type: "video-upscale", data: { provider: "topaz", targetResolution: "2k", upscaleFactor: "2" } },
50
+ // No provider named: Topaz, left alone.
51
+ { id: "c", type: "video-upscale", data: { targetResolution: "720P" } },
52
+ { id: "d", type: "video-upscale", data: { provider: "veo-4k", targetResolution: "2k" } },
53
+ { id: "e", type: "video-upscale", data: { provider: "nodaro-video-upscale", targetResolution: "720p", label: "E" } },
54
+ { id: "f", type: "video-upscale", data: { provider: "topaz", targetResolution: "8k", upscaleFactor: "4" } },
55
+ { id: "g", type: "video-upscale", data: { provider: "topaz", targetResolution: "2k", targetFps: 30 } },
56
+ ]
57
+ const { nodes: out, adjustments } = normalizeNodeModelParams(nodes)
58
+ for (const i of [0, 1, 2, 3, 5, 6]) expect(out[i], nodes[i]!.id).toBe(nodes[i])
59
+ expect(out[4]!.data).toEqual({ provider: "nodaro-video-upscale", targetResolution: "1080p", label: "E" })
60
+ expect(adjustments.map((a) => [a.nodeId, a.from, a.to])).toEqual([["e", "720p", "1080p"]])
61
+ })
62
+ })
@@ -129,6 +129,68 @@ export function captionRoutesToRemotion(input: {
129
129
  return false
130
130
  }
131
131
 
132
+ /**
133
+ * Is this render's caption source a STATIC TEXT BLOCK — the caller's `text`,
134
+ * burned once for the whole clip — rather than timed words?
135
+ *
136
+ * On `subtitle`, `text` IS the caption: one block, `\n` a forced line break,
137
+ * never transcribed over, whichever renderer draws it (the cheap FFmpeg drawtext
138
+ * burn with no styling lever, the Remotion SubtitleOverlay with one). On a
139
+ * KINETIC style the same `text` stays what it always was — a FALLBACK, spread
140
+ * evenly across the clip as synthetic word timings when transcription returns
141
+ * nothing.
142
+ *
143
+ * Source precedence is unchanged: `captions[]` > wired transcript > (`text` on
144
+ * subtitle) > auto-transcription. `auto_transcribe` is deliberately NOT read: on
145
+ * a subtitle the caller's text wins either way.
146
+ *
147
+ * Shared by the WORKER (which must not pay for a transcription it then discards)
148
+ * and the ROUTE/DAG ingress, so the two cannot disagree about where the words
149
+ * come from.
150
+ */
151
+ export function isStaticTextCaptionSource(input: {
152
+ style?: string | null
153
+ text?: string | null
154
+ captions?: readonly unknown[] | null
155
+ transcript?: unknown
156
+ segments?: readonly unknown[] | null
157
+ }): boolean {
158
+ if (input.segments && input.segments.length > 0) return false
159
+ if (isKineticCaptionStyle(input.style)) return false
160
+ if (input.captions && input.captions.length > 0) return false
161
+ if (input.transcript !== undefined && input.transcript !== null) return false
162
+ return typeof input.text === "string" && /\S/.test(input.text)
163
+ }
164
+
165
+ /**
166
+ * Whether an Add Captions render transcribes its audio: it carries no caption
167
+ * source of its own — no captions, no wired transcript, no static text block —
168
+ * auto-transcribe is not turned off, and its segments (when it has any) do not
169
+ * all carry their own text or captions. The worker decides with it; the route's
170
+ * credit guard asks it so a request is judged on its transcription model only
171
+ * when one will run, and every place that prices a run on an engine charged by
172
+ * the video's length (Nemotron 3.5 Transcribe) holds that price only when it does.
173
+ */
174
+ export function captionsNeedTranscription(input: {
175
+ style?: string | null
176
+ text?: string | null
177
+ captions?: readonly unknown[] | null
178
+ transcript?: unknown
179
+ segments?: ReadonlyArray<{ readonly text?: unknown; readonly captions?: readonly unknown[] | null }> | null
180
+ auto_transcribe?: boolean | null
181
+ }): boolean {
182
+ const hasSegments = !!(input.segments && input.segments.length > 0)
183
+ const hasTranscript = input.transcript !== undefined && input.transcript !== null
184
+ const someSegmentNeedsShared = hasSegments && input.segments!.some((s) => !(s.text || (s.captions && s.captions.length > 0)))
185
+ return (
186
+ !isStaticTextCaptionSource(input) &&
187
+ !input.captions?.length &&
188
+ !hasTranscript &&
189
+ input.auto_transcribe !== false &&
190
+ (!hasSegments || someSegmentNeedsShared)
191
+ )
192
+ }
193
+
132
194
  /**
133
195
  * `maxWordsPerLine` — caps how many words a caption LINE (or tiktok-words page)
134
196
  * may hold, on top of the frame-width budget, sentence ends and pauses that
@@ -60,6 +60,14 @@ export interface ProjectedCatalogOption {
60
60
  * large tile stays sharp; `imageUrl` is its 480px member.
61
61
  */
62
62
  imageSrcSet?: string
63
+ /**
64
+ * Absolute URL of the option's enlarged picture: the larger version to show
65
+ * where a picker shows the option big (hover, zoom, a detail view). Present
66
+ * only on a deployment that shows its own pictures (`catalogs.images:
67
+ * "own"`) and gave one for this option, on the REST replies; on its media
68
+ * host, like `imageUrl`. Absent otherwise — draw `imageUrl` there instead.
69
+ */
70
+ imageLargeUrl?: string
63
71
  }
64
72
 
65
73
  export interface ProjectedCatalogDimension {
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Add Captions transcribing on Nemotron 3.5 Transcribe — ONE charge for the
3
+ * render and its transcription (decided 2026-11-13).
4
+ *
5
+ * Every Add Captions render that transcribes is a Remotion render
6
+ * (`captionRoutesToRemotion`), billed at the kinetic row. On the other engines
7
+ * that flat row covers the transcription too. Nemotron is priced by the
8
+ * video's length, so its caption run holds
9
+ * `add-captions:kinetic:nemotron:<N>m` (N = started minutes of the video,
10
+ * 1..60): the kinetic row plus Nemotron's own per-minute price (its four-minute
11
+ * rate row × N ÷ 4, rounded up once), summed into one base and marked up once
12
+ * — never a row of its own, so a retune of either row moves every price
13
+ * together. The id keeps the `add-captions` prefix, so Add Captions' margin
14
+ * applies to the whole charge.
15
+ *
16
+ * It is held only when a transcription will actually run on Nemotron; a
17
+ * Nemotron node that brings its own captions, transcript or static text holds
18
+ * the plain kinetic row. Like the Transcribe node's id it is the HOLD: the run
19
+ * is charged for the minutes the provider reports it decoded, up or down
20
+ * (backend `lib/nemotron-transcribe-settle.ts`).
21
+ */
22
+ import {
23
+ NEMOTRON_TRANSCRIBE_PRICING,
24
+ nemotronTranscribeBaseCredits,
25
+ nemotronTranscribeStartedMinutes,
26
+ } from "./nemotron-transcribe.js"
27
+
28
+ /** The Remotion render's row — every Add Captions render that transcribes. */
29
+ export const ADD_CAPTIONS_KINETIC_CREDIT_ID = "add-captions:kinetic"
30
+
31
+ /** The prefix of the per-minute ids a Nemotron caption run holds. */
32
+ export const ADD_CAPTIONS_NEMOTRON_ID_PREFIX = `${ADD_CAPTIONS_KINETIC_CREDIT_ID}:nemotron`
33
+
34
+ /** `add-captions:kinetic:nemotron:<N>m` for N started minutes (1..60, clamped). */
35
+ export function addCaptionsNemotronMinutesId(minutes: number): string {
36
+ const n = Math.min(NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES, Math.max(1, Math.ceil(minutes)))
37
+ return `${ADD_CAPTIONS_NEMOTRON_ID_PREFIX}:${n}m`
38
+ }
39
+
40
+ /** The id a Nemotron caption run on a video of `durationSec` seconds holds (its started minutes). */
41
+ export function addCaptionsNemotronCreditId(durationSec: number | null | undefined): string {
42
+ return addCaptionsNemotronMinutesId(nemotronTranscribeStartedMinutes(durationSec))
43
+ }
44
+
45
+ /**
46
+ * The id a QUOTE names for a video of `durationSec` seconds — every estimate
47
+ * before a run. A known length is the id its run holds; an UNKNOWN length is
48
+ * the 60-minute id, the most any run can be charged (a run measures the video
49
+ * first, holds 60 minutes for one whose length cannot be read, and refuses one
50
+ * over 60 minutes).
51
+ */
52
+ export function addCaptionsNemotronQuoteCreditId(durationSec: number | null | undefined): string {
53
+ const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0
54
+ return addCaptionsNemotronCreditId(known ? durationSec : NEMOTRON_TRANSCRIBE_PRICING.MAX_DURATION_SEC)
55
+ }
56
+
57
+ /** The minutes of an `add-captions:kinetic:nemotron:<N>m` id (1 ≤ N ≤ 60), or `undefined` for any other id. */
58
+ export function parseAddCaptionsNemotronCreditId(id: string): { minutes: number } | undefined {
59
+ const m = /^add-captions:kinetic:nemotron:(\d+)m$/.exec(id)
60
+ if (!m) return undefined
61
+ const minutes = Number(m[1])
62
+ if (!Number.isInteger(minutes) || minutes < 1 || minutes > NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES) return undefined
63
+ return { minutes }
64
+ }
65
+
66
+ /**
67
+ * The base of a Nemotron caption run of `minutes` started minutes: the kinetic
68
+ * row's base plus Nemotron's per-minute base for those minutes (`ratePerBlock`
69
+ * credits per four minutes, rounded up once). Marked up once, as one charge.
70
+ */
71
+ export function addCaptionsNemotronBaseCredits(kineticBase: number, ratePerBlock: number, minutes: number): number {
72
+ return kineticBase + nemotronTranscribeBaseCredits(ratePerBlock, minutes)
73
+ }
@@ -82,6 +82,26 @@ export {
82
82
  semitonesToPitchRatio,
83
83
  } from "./pitch-tempo.js"
84
84
 
85
+ export {
86
+ NEMOTRON_TRANSCRIBE_ID,
87
+ NEMOTRON_TRANSCRIBE_PRICING,
88
+ nemotronTranscribeStartedMinutes,
89
+ nemotronTranscribeCreditId,
90
+ nemotronTranscribeQuoteCreditId,
91
+ parseNemotronTranscribeCreditId,
92
+ nemotronTranscribeBaseCredits,
93
+ } from "./nemotron-transcribe.js"
94
+
95
+ export {
96
+ ADD_CAPTIONS_KINETIC_CREDIT_ID,
97
+ ADD_CAPTIONS_NEMOTRON_ID_PREFIX,
98
+ addCaptionsNemotronMinutesId,
99
+ addCaptionsNemotronCreditId,
100
+ addCaptionsNemotronQuoteCreditId,
101
+ parseAddCaptionsNemotronCreditId,
102
+ addCaptionsNemotronBaseCredits,
103
+ } from "./add-captions-nemotron.js"
104
+
85
105
  export {
86
106
  VIDEO_OVERLAY_PRICING,
87
107
  VIDEO_OVERLAY_REMEASURE_SLACK_SEC,
@@ -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
+ }