@nodaro/shared 3.61.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 (313) hide show
  1. package/dist/{chunk-4KYLNTR7.cjs → chunk-2PU3AGGS.cjs} +27 -4
  2. package/dist/chunk-2PU3AGGS.cjs.map +1 -0
  3. package/dist/{chunk-43TGSZRJ.js → chunk-2QKF7M2Z.js} +3 -3
  4. package/dist/{chunk-43TGSZRJ.js.map → chunk-2QKF7M2Z.js.map} +1 -1
  5. package/dist/{chunk-B6BG3LV2.js → chunk-34QLPTSA.js} +3 -3
  6. package/dist/{chunk-B6BG3LV2.js.map → chunk-34QLPTSA.js.map} +1 -1
  7. package/dist/chunk-3K24DWOH.js +453 -0
  8. package/dist/chunk-3K24DWOH.js.map +1 -0
  9. package/dist/{chunk-IRQ3SPX7.js → chunk-4DVWXEB6.js} +23 -4
  10. package/dist/chunk-4DVWXEB6.js.map +1 -0
  11. package/dist/{chunk-ZES6EZC4.js → chunk-4MMZD63H.js} +3 -3
  12. package/dist/{chunk-ZES6EZC4.js.map → chunk-4MMZD63H.js.map} +1 -1
  13. package/dist/{chunk-MQZRQ5LM.cjs → chunk-63H4C56Q.cjs} +8 -8
  14. package/dist/{chunk-MQZRQ5LM.cjs.map → chunk-63H4C56Q.cjs.map} +1 -1
  15. package/dist/{chunk-IVXSNW2B.cjs → chunk-6BZC2ZHC.cjs} +18 -332
  16. package/dist/chunk-6BZC2ZHC.cjs.map +1 -0
  17. package/dist/{chunk-M3SXUUWC.cjs → chunk-6FQBKI2A.cjs} +4 -11
  18. package/dist/chunk-6FQBKI2A.cjs.map +1 -0
  19. package/dist/{chunk-673E4KYC.js → chunk-6M563QE6.js} +134 -8
  20. package/dist/chunk-6M563QE6.js.map +1 -0
  21. package/dist/chunk-6TGB7ECA.cjs +48 -0
  22. package/dist/chunk-6TGB7ECA.cjs.map +1 -0
  23. package/dist/{chunk-XUJC6GHE.cjs → chunk-6XUG4L7X.cjs} +6 -6
  24. package/dist/{chunk-XUJC6GHE.cjs.map → chunk-6XUG4L7X.cjs.map} +1 -1
  25. package/dist/{chunk-XZKFZMRT.cjs → chunk-77WU3V3J.cjs} +6 -6
  26. package/dist/{chunk-XZKFZMRT.cjs.map → chunk-77WU3V3J.cjs.map} +1 -1
  27. package/dist/{chunk-ZFJN23V4.cjs → chunk-A2PX5IRC.cjs} +4 -4
  28. package/dist/{chunk-ZFJN23V4.cjs.map → chunk-A2PX5IRC.cjs.map} +1 -1
  29. package/dist/{chunk-ZDBPQBAA.js → chunk-AE3AAJ4O.js} +3 -3
  30. package/dist/{chunk-ZDBPQBAA.js.map → chunk-AE3AAJ4O.js.map} +1 -1
  31. package/dist/chunk-ALRXY4QH.cjs +13 -0
  32. package/dist/chunk-ALRXY4QH.cjs.map +1 -0
  33. package/dist/{chunk-UARGJ5IZ.js → chunk-BMJVKYVB.js} +56 -12
  34. package/dist/chunk-BMJVKYVB.js.map +1 -0
  35. package/dist/{chunk-6XVHYD5R.js → chunk-CLAKSLXF.js} +4 -9
  36. package/dist/chunk-CLAKSLXF.js.map +1 -0
  37. package/dist/chunk-CTANEPMY.js +61 -0
  38. package/dist/chunk-CTANEPMY.js.map +1 -0
  39. package/dist/chunk-CZ5IQB3L.js +42 -0
  40. package/dist/chunk-CZ5IQB3L.js.map +1 -0
  41. package/dist/{chunk-WGKAOUEQ.cjs → chunk-D34K455O.cjs} +3 -2
  42. package/dist/chunk-D34K455O.cjs.map +1 -0
  43. package/dist/chunk-EPXGG27L.js +331 -0
  44. package/dist/chunk-EPXGG27L.js.map +1 -0
  45. package/dist/{chunk-3M4BNKFJ.cjs → chunk-F6WGGYQW.cjs} +167 -3
  46. package/dist/chunk-F6WGGYQW.cjs.map +1 -0
  47. package/dist/{chunk-7FCTCWHD.js → chunk-FXGNRYQQ.js} +3 -3
  48. package/dist/{chunk-7FCTCWHD.js.map → chunk-FXGNRYQQ.js.map} +1 -1
  49. package/dist/{chunk-ZNM2LW3D.cjs → chunk-GMBDLNLD.cjs} +105 -56
  50. package/dist/chunk-GMBDLNLD.cjs.map +1 -0
  51. package/dist/{chunk-NJVOJXBS.cjs → chunk-GSKLPI3J.cjs} +104 -49
  52. package/dist/chunk-GSKLPI3J.cjs.map +1 -0
  53. package/dist/{chunk-EWS2VFO4.js → chunk-HBXF6RUU.js} +4 -4
  54. package/dist/{chunk-EWS2VFO4.js.map → chunk-HBXF6RUU.js.map} +1 -1
  55. package/dist/{chunk-MOMFX32D.js → chunk-HWQ2SYNA.js} +194 -325
  56. package/dist/chunk-HWQ2SYNA.js.map +1 -0
  57. package/dist/{chunk-SCMTN57Y.js → chunk-IY3Y462W.js} +3 -3
  58. package/dist/{chunk-SCMTN57Y.js.map → chunk-IY3Y462W.js.map} +1 -1
  59. package/dist/{chunk-ZZGQRRN7.js → chunk-KCZHQH2O.js} +6 -306
  60. package/dist/chunk-KCZHQH2O.js.map +1 -0
  61. package/dist/{chunk-XROE3CAS.cjs → chunk-KHH54GRP.cjs} +120 -79
  62. package/dist/chunk-KHH54GRP.cjs.map +1 -0
  63. package/dist/{chunk-FVVD6XY2.js → chunk-KL6GAYTT.js} +13 -4
  64. package/dist/chunk-KL6GAYTT.js.map +1 -0
  65. package/dist/{chunk-FVII3KHN.js → chunk-KMGCHV6O.js} +163 -4
  66. package/dist/chunk-KMGCHV6O.js.map +1 -0
  67. package/dist/{chunk-FMXFHJWX.cjs → chunk-L2TVY6XN.cjs} +4 -4
  68. package/dist/{chunk-FMXFHJWX.cjs.map → chunk-L2TVY6XN.cjs.map} +1 -1
  69. package/dist/{chunk-FQXRYPCX.cjs → chunk-LH72PQO2.cjs} +505 -68
  70. package/dist/chunk-LH72PQO2.cjs.map +1 -0
  71. package/dist/chunk-LMAQUR55.cjs +506 -0
  72. package/dist/chunk-LMAQUR55.cjs.map +1 -0
  73. package/dist/{chunk-F5YEMSNK.cjs → chunk-M5OCFGHF.cjs} +571 -30
  74. package/dist/chunk-M5OCFGHF.cjs.map +1 -0
  75. package/dist/{chunk-VOWJCUMR.js → chunk-MD4XHED4.js} +3 -3
  76. package/dist/{chunk-VOWJCUMR.js.map → chunk-MD4XHED4.js.map} +1 -1
  77. package/dist/chunk-N5HH46JF.cjs +68 -0
  78. package/dist/chunk-N5HH46JF.cjs.map +1 -0
  79. package/dist/{chunk-G4XWVWRI.js → chunk-NIAFR5EE.js} +5 -4
  80. package/dist/chunk-NIAFR5EE.js.map +1 -0
  81. package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
  82. package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
  83. package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
  84. package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
  85. package/dist/{chunk-SWVGHAYO.js → chunk-O7RZRUMZ.js} +110 -74
  86. package/dist/chunk-O7RZRUMZ.js.map +1 -0
  87. package/dist/{chunk-LLOIAGFB.js → chunk-OV3JTKBY.js} +449 -51
  88. package/dist/chunk-OV3JTKBY.js.map +1 -0
  89. package/dist/{chunk-A3FHTSLB.js → chunk-PSKZKLDG.js} +550 -31
  90. package/dist/chunk-PSKZKLDG.js.map +1 -0
  91. package/dist/{chunk-VB2ARGQ6.js → chunk-RGNHHIMN.js} +3 -3
  92. package/dist/chunk-RGNHHIMN.js.map +1 -0
  93. package/dist/chunk-SMOO5FAH.js +10 -0
  94. package/dist/chunk-SMOO5FAH.js.map +1 -0
  95. package/dist/{chunk-5XRRENHD.cjs → chunk-TM5JYSJF.cjs} +170 -17
  96. package/dist/chunk-TM5JYSJF.cjs.map +1 -0
  97. package/dist/{chunk-PONP5J5E.cjs → chunk-V24EPI5N.cjs} +13 -3
  98. package/dist/chunk-V24EPI5N.cjs.map +1 -0
  99. package/dist/{chunk-RQ4F3AJH.cjs → chunk-V5EEQR2U.cjs} +21 -21
  100. package/dist/{chunk-RQ4F3AJH.cjs.map → chunk-V5EEQR2U.cjs.map} +1 -1
  101. package/dist/chunk-WZVIBAKN.cjs +351 -0
  102. package/dist/chunk-WZVIBAKN.cjs.map +1 -0
  103. package/dist/{chunk-5M43XMRB.cjs → chunk-X5BAFW3Q.cjs} +8 -8
  104. package/dist/{chunk-5M43XMRB.cjs.map → chunk-X5BAFW3Q.cjs.map} +1 -1
  105. package/dist/{chunk-RUHKBEFF.js → chunk-XBTYGQ6Z.js} +63 -10
  106. package/dist/chunk-XBTYGQ6Z.js.map +1 -0
  107. package/dist/{chunk-JHTT2V4A.cjs → chunk-XGGZWA4A.cjs} +118 -52
  108. package/dist/chunk-XGGZWA4A.cjs.map +1 -0
  109. package/dist/{chunk-5I4T4QR5.cjs → chunk-XGVJGNZW.cjs} +5 -5
  110. package/dist/{chunk-5I4T4QR5.cjs.map → chunk-XGVJGNZW.cjs.map} +1 -1
  111. package/dist/{chunk-7ARKVJTN.cjs → chunk-Y35JQPT6.cjs} +228 -383
  112. package/dist/chunk-Y35JQPT6.cjs.map +1 -0
  113. package/dist/{chunk-AFQFGZN7.cjs → chunk-Y4GCJJPF.cjs} +8 -6
  114. package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
  115. package/dist/{chunk-C77F4ZTL.js → chunk-YUER7TJG.js} +3 -3
  116. package/dist/{chunk-C77F4ZTL.js.map → chunk-YUER7TJG.js.map} +1 -1
  117. package/dist/{chunk-HGI2VKIV.js → chunk-YX6TFX7H.js} +67 -14
  118. package/dist/chunk-YX6TFX7H.js.map +1 -0
  119. package/dist/{chunk-TWF2OSH4.cjs → chunk-ZPE2ZTJ4.cjs} +4 -4
  120. package/dist/{chunk-TWF2OSH4.cjs.map → chunk-ZPE2ZTJ4.cjs.map} +1 -1
  121. package/dist/entries/apps.cjs +44 -44
  122. package/dist/entries/apps.js +9 -9
  123. package/dist/entries/credits.cjs +286 -153
  124. package/dist/entries/credits.d.cts +254 -5
  125. package/dist/entries/credits.d.ts +254 -5
  126. package/dist/entries/credits.js +14 -9
  127. package/dist/entries/entities.cjs +188 -143
  128. package/dist/entries/entities.d.cts +122 -1
  129. package/dist/entries/entities.d.ts +122 -1
  130. package/dist/entries/entities.js +2 -1
  131. package/dist/entries/llm-models.cjs +77 -57
  132. package/dist/entries/llm-models.d.cts +85 -5
  133. package/dist/entries/llm-models.d.ts +85 -5
  134. package/dist/entries/llm-models.js +2 -2
  135. package/dist/entries/media.cjs +92 -87
  136. package/dist/entries/media.d.cts +19 -1
  137. package/dist/entries/media.d.ts +19 -1
  138. package/dist/entries/media.js +3 -2
  139. package/dist/entries/model-catalog.cjs +211 -103
  140. package/dist/entries/model-catalog.d.cts +135 -19
  141. package/dist/entries/model-catalog.d.ts +135 -19
  142. package/dist/entries/model-catalog.js +5 -5
  143. package/dist/entries/models.cjs +504 -295
  144. package/dist/entries/models.d.cts +71 -4
  145. package/dist/entries/models.d.ts +71 -4
  146. package/dist/entries/models.js +7 -6
  147. package/dist/entries/nodes.cjs +249 -233
  148. package/dist/entries/nodes.d.cts +35 -6
  149. package/dist/entries/nodes.d.ts +35 -6
  150. package/dist/entries/nodes.js +10 -10
  151. package/dist/entries/pipeline.cjs +152 -152
  152. package/dist/entries/pipeline.d.cts +3 -2
  153. package/dist/entries/pipeline.d.ts +3 -2
  154. package/dist/entries/pipeline.js +3 -3
  155. package/dist/entries/runtime-config.cjs +29 -29
  156. package/dist/entries/runtime-config.d.cts +10 -7
  157. package/dist/entries/runtime-config.d.ts +10 -7
  158. package/dist/entries/runtime-config.js +1 -1
  159. package/dist/entries/social.cjs +177 -177
  160. package/dist/entries/social.js +2 -2
  161. package/dist/entries/types.d.cts +8 -0
  162. package/dist/entries/types.d.ts +8 -0
  163. package/dist/entries/ugc.cjs +71 -71
  164. package/dist/entries/ugc.js +4 -4
  165. package/dist/entries/video.cjs +316 -208
  166. package/dist/entries/video.d.cts +490 -99
  167. package/dist/entries/video.d.ts +490 -99
  168. package/dist/entries/video.js +8 -4
  169. package/dist/entries/workflow.cjs +102 -102
  170. package/dist/entries/workflow.d.cts +5 -4
  171. package/dist/entries/workflow.d.ts +5 -4
  172. package/dist/entries/workflow.js +2 -2
  173. package/dist/{gpt-image-2-6-BeZdT-pW.d.cts → gpt-image-2-6-jIRQBRag.d.cts} +6 -0
  174. package/dist/{gpt-image-2-6-BeZdT-pW.d.ts → gpt-image-2-6-jIRQBRag.d.ts} +6 -0
  175. package/dist/index.cjs +2727 -2092
  176. package/dist/index.d.cts +11 -11
  177. package/dist/index.d.ts +11 -11
  178. package/dist/index.js +30 -27
  179. package/dist/{model-catalog-BgSvskgY.d.ts → model-catalog-C_Eo35tL.d.cts} +158 -14
  180. package/dist/{model-catalog-BgSvskgY.d.cts → model-catalog-C_Eo35tL.d.ts} +158 -14
  181. package/dist/{model-constants-DHd9jwQ7.d.cts → model-constants-Bg4ccSQb.d.ts} +427 -34
  182. package/dist/{model-constants-DHd9jwQ7.d.ts → model-constants-DWcxOmaY.d.cts} +427 -34
  183. package/package.json +1 -1
  184. package/src/__tests__/credit-identifiers.test.ts +29 -0
  185. package/src/__tests__/extend-providers.test.ts +194 -0
  186. package/src/__tests__/fixtures/mask-composite-quote-parity.json +118 -0
  187. package/src/__tests__/fixtures/root-exports.baseline.json +68 -0
  188. package/src/__tests__/gpt-image-2-6-formats.test.ts +4 -1
  189. package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
  190. package/src/__tests__/gvp-supported-providers.test.ts +32 -4
  191. package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
  192. package/src/__tests__/lip-sync-levers.test.ts +31 -0
  193. package/src/__tests__/llm-models.test.ts +132 -3
  194. package/src/__tests__/llm-price-key.test.ts +152 -1
  195. package/src/__tests__/minimax-h3-image.test.ts +140 -0
  196. package/src/__tests__/model-makers.test.ts +49 -11
  197. package/src/__tests__/model-tree.test.ts +13 -0
  198. package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
  199. package/src/__tests__/normalize-node-params.test.ts +25 -0
  200. package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
  201. package/src/__tests__/prompt-length-limits.test.ts +4 -0
  202. package/src/__tests__/retired-video-provider.test.ts +15 -5
  203. package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
  204. package/src/__tests__/seedance-task-type.test.ts +188 -0
  205. package/src/__tests__/seedream-5-5.test.ts +117 -0
  206. package/src/__tests__/transcribe-capabilities.test.ts +39 -2
  207. package/src/__tests__/transcribe-preflight.test.ts +50 -1
  208. package/src/__tests__/unit-contract-compose.test.ts +27 -1
  209. package/src/__tests__/unit-contracts.test.ts +20 -6
  210. package/src/__tests__/upscale-factors.test.ts +107 -0
  211. package/src/__tests__/video-audio-capability.test.ts +35 -6
  212. package/src/__tests__/video-character-refs.test.ts +20 -2
  213. package/src/__tests__/video-collapse-parity.test.ts +19 -0
  214. package/src/__tests__/video-overlay-geometry.test.ts +68 -0
  215. package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
  216. package/src/__tests__/video-overlay-layouts.test.ts +529 -0
  217. package/src/__tests__/video-overlay-pricing.test.ts +61 -0
  218. package/src/__tests__/video-overlay-validate.test.ts +128 -0
  219. package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
  220. package/src/__tests__/video-overlay.test.ts +280 -194
  221. package/src/__tests__/video-ref-limits.test.ts +2 -1
  222. package/src/__tests__/video-reference-only.test.ts +6 -2
  223. package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
  224. package/src/__tests__/video-start-frame-only.test.ts +98 -0
  225. package/src/__tests__/video-upscale-params.test.ts +62 -0
  226. package/src/__tests__/wired-character-names.test.ts +220 -0
  227. package/src/catalog-projection.ts +8 -0
  228. package/src/credit-estimators/index.ts +18 -0
  229. package/src/credit-estimators/nemotron-transcribe.ts +87 -0
  230. package/src/credit-estimators/video-overlay.ts +70 -0
  231. package/src/credit-identifiers.ts +183 -16
  232. package/src/entity-image-url.ts +21 -0
  233. package/src/entries/credits.ts +26 -1
  234. package/src/entries/entities.ts +14 -0
  235. package/src/entries/llm-models.ts +6 -0
  236. package/src/entries/model-catalog.ts +44 -1
  237. package/src/entries/models.ts +69 -0
  238. package/src/entries/nodes.ts +4 -0
  239. package/src/entries/video.ts +7 -1
  240. package/src/freecut-protocol.ts +8 -0
  241. package/src/generated/unit-contracts.ts +8 -1
  242. package/src/gpt-image-2-6.ts +6 -0
  243. package/src/input-image-pricing.ts +76 -0
  244. package/src/lip-sync-levers.ts +56 -0
  245. package/src/lip-sync-pricing.ts +91 -1
  246. package/src/llm-models.ts +249 -4
  247. package/src/mask-composite.ts +11 -0
  248. package/src/minimax-h3-image.ts +61 -0
  249. package/src/model-catalog.ts +604 -40
  250. package/src/model-constants.ts +860 -55
  251. package/src/model-tree.ts +2 -1
  252. package/src/nodaro-video-upscale.ts +48 -0
  253. package/src/node-default-mappings.ts +15 -2
  254. package/src/node-execution-state.ts +4 -3
  255. package/src/normalize-node-params.ts +49 -1
  256. package/src/producer-types.ts +23 -1
  257. package/src/runtime-config/contract.ts +10 -7
  258. package/src/seedance-draft.ts +2 -1
  259. package/src/seedance-task-type.ts +37 -0
  260. package/src/seedream-5-5.ts +45 -0
  261. package/src/transcribe-preflight.ts +58 -7
  262. package/src/unit-contract-compose.ts +4 -1
  263. package/src/upscale-factors.ts +111 -0
  264. package/src/video-character-refs.ts +7 -4
  265. package/src/video-duration.ts +9 -0
  266. package/src/video-overlay-geometry.ts +99 -0
  267. package/src/video-overlay-input.ts +25 -0
  268. package/src/video-overlay-layout-ids.ts +48 -0
  269. package/src/video-overlay-layouts.ts +315 -0
  270. package/src/video-overlay-validate.ts +223 -0
  271. package/src/video-overlay-video-layers.ts +304 -0
  272. package/src/video-overlay.ts +165 -297
  273. package/src/video-ui-defaults.ts +11 -7
  274. package/src/video-upscale-params.ts +67 -0
  275. package/src/wired-character-names.ts +202 -0
  276. package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
  277. package/dist/chunk-4KYLNTR7.cjs.map +0 -1
  278. package/dist/chunk-5XRRENHD.cjs.map +0 -1
  279. package/dist/chunk-673E4KYC.js.map +0 -1
  280. package/dist/chunk-6XVHYD5R.js.map +0 -1
  281. package/dist/chunk-7ARKVJTN.cjs.map +0 -1
  282. package/dist/chunk-7WGKP3EU.js +0 -23
  283. package/dist/chunk-7WGKP3EU.js.map +0 -1
  284. package/dist/chunk-A3FHTSLB.js.map +0 -1
  285. package/dist/chunk-AFQFGZN7.cjs.map +0 -1
  286. package/dist/chunk-F5YEMSNK.cjs.map +0 -1
  287. package/dist/chunk-FQXRYPCX.cjs.map +0 -1
  288. package/dist/chunk-FVII3KHN.js.map +0 -1
  289. package/dist/chunk-FVVD6XY2.js.map +0 -1
  290. package/dist/chunk-G4XWVWRI.js.map +0 -1
  291. package/dist/chunk-HGI2VKIV.js.map +0 -1
  292. package/dist/chunk-IRQ3SPX7.js.map +0 -1
  293. package/dist/chunk-IVXSNW2B.cjs.map +0 -1
  294. package/dist/chunk-JHTT2V4A.cjs.map +0 -1
  295. package/dist/chunk-KHZAQGRP.js +0 -17
  296. package/dist/chunk-KHZAQGRP.js.map +0 -1
  297. package/dist/chunk-LLOIAGFB.js.map +0 -1
  298. package/dist/chunk-M3SXUUWC.cjs.map +0 -1
  299. package/dist/chunk-MOMFX32D.js.map +0 -1
  300. package/dist/chunk-NCOGGRRP.cjs +0 -27
  301. package/dist/chunk-NCOGGRRP.cjs.map +0 -1
  302. package/dist/chunk-NJVOJXBS.cjs.map +0 -1
  303. package/dist/chunk-PONP5J5E.cjs.map +0 -1
  304. package/dist/chunk-RUHKBEFF.js.map +0 -1
  305. package/dist/chunk-SWVGHAYO.js.map +0 -1
  306. package/dist/chunk-UARGJ5IZ.js.map +0 -1
  307. package/dist/chunk-VB2ARGQ6.js.map +0 -1
  308. package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
  309. package/dist/chunk-XROE3CAS.cjs.map +0 -1
  310. package/dist/chunk-ZLDFPVVI.cjs +0 -19
  311. package/dist/chunk-ZLDFPVVI.cjs.map +0 -1
  312. package/dist/chunk-ZNM2LW3D.cjs.map +0 -1
  313. package/dist/chunk-ZZGQRRN7.js.map +0 -1
package/src/llm-models.ts CHANGED
@@ -75,6 +75,18 @@ export interface LlmModelDef {
75
75
  * Capability-driven so `llmCompleteStructured` never hardcodes provider ids.
76
76
  */
77
77
  structuredOutputMode?: "anthropic-tool" | "kie-response-format" | "responses-json-schema"
78
+ /**
79
+ * For a model with NO trusted `structuredOutputMode`: the wire field a
80
+ * structured call still sends its schema in, as a hint the model reads but
81
+ * the provider was not found to hold its answer to. Read through
82
+ * {@link structuredWireMode}, which every request builder uses; everything
83
+ * that decides TRUST (STRUCTURED_VISION_MODELS, the structured-model
84
+ * filters) keeps reading `structuredOutputMode` alone, so a hinted model is
85
+ * never offered where guaranteed structured output is required. Every answer
86
+ * is still parsed, validated and re-asked by `llmCompleteStructured`, as for
87
+ * any model. Never set together with `structuredOutputMode` (registry test).
88
+ */
89
+ structuredOutputHint?: "kie-response-format" | "responses-json-schema"
78
90
  /** If set, fallback to direct Anthropic SDK with this model ID when KIE.ai fails */
79
91
  directFallbackModel?: string
80
92
  /**
@@ -118,6 +130,27 @@ export interface LlmModelDef {
118
130
  directOnly?: true
119
131
  /** Effort levels this model accepts (ascending). Absent/empty = no effort lever, picker hidden. */
120
132
  reasoningEfforts?: readonly LlmReasoningEffort[]
133
+ /**
134
+ * true = a REQUESTED effort below this model's lowest level is sent as that
135
+ * lowest level, never as nothing ({@link effectiveReasoningEffort}): with no
136
+ * effort on the wire the provider runs this model at its HIGHEST level, so
137
+ * dropping a `none` request would buy the most reasoning instead of the
138
+ * least. Auto — no effort requested at all — still sends nothing. Absent =
139
+ * a request below the lowest level is dropped (Auto), the usual rule.
140
+ */
141
+ effortBelowLowestSendsLowest?: true
142
+ /**
143
+ * true = the PRICE of a call on this model depends on whether it sends a
144
+ * reasoning effort, not only on its lane: the aggregator adds input of its
145
+ * own to every call, whose size depends on it. So the model's price key
146
+ * names the effort a call sends ({@link llmPriceKey}: `:effort-<level>`),
147
+ * and every estimate surface quotes that call. The sizes themselves are
148
+ * backend data (`backend/src/lib/pricing/llm-cost.ts`), held to this flag by
149
+ * a backend test. No model sets it today (GPT-6.1 Terra did for part of
150
+ * 2026-11-12, until its aggregator's added input stopped depending on the
151
+ * effort).
152
+ */
153
+ effortPriced?: true
121
154
  /**
122
155
  * Effort levels available on the DIRECT lane, when the vendor's own API
123
156
  * accepts more than the aggregator does. Absent = the direct lane offers the
@@ -564,6 +597,54 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
564
597
  // ended early (one declined the task, one stopped on RECITATION).
565
598
  thinkingDefaultOn: true,
566
599
  },
600
+ {
601
+ id: "gemini-4-carbon",
602
+ displayName: "Gemini 4 Carbon",
603
+ series: "Gemini",
604
+ desc: "Deepest-reasoning Gemini, 1M context",
605
+ tier: "premium",
606
+ kieFormat: "chat-completions",
607
+ // KIE serves it on the OpenAI-compatible dialect under this slug
608
+ // (docs.kie.ai/market/gemini/gemini-4-carbon-openai — Argon's page with the
609
+ // name swapped). Unlike Argon's, this lane passed its probe (2026-11-12):
610
+ // every call answered, images read, a stream ended cleanly, no empty 200,
611
+ // no negative counts, no code-execution fences. KIE flags it "Chat only",
612
+ // like Argon: it may not back a tool-loop feature (none does today).
613
+ kieSlugOrModel: "gemini-4-carbon-openai",
614
+ vendor: "google",
615
+ // NO trusted `structuredOutputMode` (decided 2026-11-12): KIE did NOT
616
+ // enforce a `response_format` json_schema — both probe calls came back as
617
+ // JSON holding an off-enum value in the enum field ("cheerful and
618
+ // energized" for happy | sad). So it is not a STRUCTURED_VISION_MODELS
619
+ // member (not offered by describe-to-picker), and every answer is parsed,
620
+ // validated and re-asked by `llmCompleteStructured`.
621
+ // The schema still goes on the wire, as a hint (`structuredOutputHint`): as
622
+ // `response_format` on KIE (the probe's replies followed its shape, only the
623
+ // enum slipped) and as `responseJsonSchema` on the direct Google lane,
624
+ // which enforced it in the probe — on every attempt, the re-ask included.
625
+ structuredOutputHint: "kie-response-format",
626
+ supportsImages: true,
627
+ // The registry's usual 16384, as Argon. Every call is floored to the
628
+ // default 32768 (`thinkingDefaultOn`, below): Google lists an output cap of
629
+ // 32,768 (models.list) and accepted maxOutputTokens 65536; KIE's doc
630
+ // states up to 65,536 tokens, thinking included.
631
+ maxOutputTokens: 16384,
632
+ // KIE first, Google as the reliability fallback (and Advanced mode) — no
633
+ // `preferDirect`, no `directOnly`. Google serves `models/gemini-4-carbon`
634
+ // beside Argon (models.list, 2026-11-12).
635
+ directGeminiModel: "gemini-4-carbon",
636
+ // KIE's documented `reasoning_effort` enum, and the direct lane's ladder
637
+ // too: Google 400s thinkingLevel MINIMAL on this model ("not supported")
638
+ // and answers LOW / MEDIUM / HIGH (probed 2026-11-12) — Argon's shape. So
639
+ // no `none` (it maps to MINIMAL in the direct client) and no
640
+ // `directReasoningEfforts`: a `none` request clamps to Auto on both lanes.
641
+ reasoningEfforts: ["low", "medium", "high"],
642
+ // Reasons with no thinking param sent on both lanes: KIE's `total_tokens`
643
+ // ran well past prompt + completion on every no-effort call (its dialect
644
+ // reports no reasoning split), and Google's no-level call reported thought
645
+ // tokens. No `reasoningOutputFloor`: both lanes take the default 32768.
646
+ thinkingDefaultOn: true,
647
+ },
567
648
  {
568
649
  id: "claude-opus-4.7",
569
650
  displayName: "Claude Opus 4.7",
@@ -807,6 +888,43 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
807
888
  supportsTemperature: false,
808
889
  thinkingDefaultOn: true,
809
890
  },
891
+ {
892
+ id: "gpt-6.1-terra",
893
+ displayName: "GPT-6.1 Terra",
894
+ series: "GPT",
895
+ desc: "Fast, efficient GPT-6.1, sharp visual reasoning",
896
+ tier: "standard",
897
+ kieFormat: "responses",
898
+ // The GPT-6 wire (codex/v1/responses, derived from `vendor`); KIE's doc is
899
+ // 6.1 Sol's page with the name swapped and `none` added to the effort enum.
900
+ // Live-probed 2026-11-12: non-stream 16/16, `text.format` json_schema
901
+ // ENFORCED (asked for prose, it returned schema JSON with the enum
902
+ // honoured), data-URI vision, SSE deltas. Unlike luna / sol / 6.1 sol it
903
+ // reports REAL top-level `usage.input_tokens` — see `kieInputUntrusted` in
904
+ // backend/src/lib/llm/kie-cost.ts.
905
+ //
906
+ // KIE's endpoint adds its own instructions to every call and counts them as
907
+ // input. The hold and the estimate count them too
908
+ // (backend/src/lib/pricing/llm-cost.ts, `llmLaneAddedInputTokens`). They
909
+ // were several times larger with an effort sent on the morning of
910
+ // 2026-11-12 and the same size either way by that afternoon, so its price
911
+ // does not depend on the effort: not `effortPriced` (re-measure if KIE's
912
+ // reported input jumps again).
913
+ kieSlugOrModel: "gpt-6-1-terra",
914
+ vendor: "openai",
915
+ structuredOutputMode: "responses-json-schema",
916
+ supportsImages: true,
917
+ maxOutputTokens: 16384,
918
+ // NO `none` (decided 2026-11-12): KIE answers it, but a `none` sent on the
919
+ // wire is answered as an effort (it echoed `medium`) while reasoning no
920
+ // more than Auto. Clamping maps a `none` request to nothing sent (Auto).
921
+ reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
922
+ // Same doc as 6.1 Sol: no temperature lever.
923
+ supportsTemperature: false,
924
+ // NO `thinkingDefaultOn`: with no effort sent (and at low / medium / high)
925
+ // the probe reported 0 reasoning tokens; only xhigh (8) and max (27)
926
+ // reasoned, and those already floor the cap (`raiseToReasoningFloor`).
927
+ },
810
928
  {
811
929
  id: "grok-4.6",
812
930
  displayName: "Grok 4.6",
@@ -1036,12 +1154,49 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
1036
1154
  // KIE's documented enum. The endpoint accepted xhigh/none without error but
1037
1155
  // never echoes an effort back, so nothing beyond the doc is verifiable.
1038
1156
  reasoningEfforts: ["low", "medium", "high"],
1157
+ // Decided 2026-11-12: a request below `low` (`none`) is sent as `low`,
1158
+ // never as nothing — KIE runs Kimi at its highest level when no effort is
1159
+ // sent (K3.1 Pro's no-effort replies echoed `max`). Auto still sends nothing.
1160
+ effortBelowLowestSendsLowest: true,
1039
1161
  // The doc lists no `temperature` field at all.
1040
1162
  supportsTemperature: false,
1041
1163
  // "Reasons by default" per KIE's doc (its usage reports no reasoning-token
1042
1164
  // split, so this is the doc's word, not a measurement).
1043
1165
  thinkingDefaultOn: true,
1044
1166
  },
1167
+ {
1168
+ id: "kimi-k3.1-pro",
1169
+ displayName: "Kimi K3.1 Pro",
1170
+ series: "Kimi",
1171
+ desc: "Kimi tuned for coding and research, 1M context",
1172
+ tier: "premium",
1173
+ kieFormat: "responses",
1174
+ // Same openai/v1/responses family path and wire as kimi-k3 (KIE's doc is
1175
+ // K3's page with the name and the effort enum changed). Live-probed
1176
+ // 2026-11-12: non-stream 9/9, `text.format` json_schema ENFORCED (asked for
1177
+ // prose, it returned schema JSON with the enum honoured), data-URI vision,
1178
+ // real `usage.input_tokens` and `credits_consumed`. Its stream sends
1179
+ // `response.reasoning_text.delta` frames apart from the
1180
+ // `response.output_text.delta` ones, and only the latter are the answer.
1181
+ kieSlugOrModel: "kimi-k3-1-pro",
1182
+ vendor: "moonshot",
1183
+ structuredOutputMode: "responses-json-schema",
1184
+ supportsImages: true,
1185
+ maxOutputTokens: 16384,
1186
+ // KIE's documented enum (K3's was low / medium / high). Each level was
1187
+ // echoed back. An off-enum `medium` answered too (echoed as `high`), so it
1188
+ // is not offered: a `medium` request clamps down to `low`.
1189
+ reasoningEfforts: ["low", "high", "max"],
1190
+ // Decided 2026-11-12: a request below `low` (`none`) is sent as `low`,
1191
+ // never as nothing — with no effort sent KIE runs it at `max` (the probe's
1192
+ // no-effort replies echoed `max`). Auto still sends nothing.
1193
+ effortBelowLowestSendsLowest: true,
1194
+ // The doc lists no `temperature` field at all, as K3's.
1195
+ supportsTemperature: false,
1196
+ // Measured: every probe call reported reasoning tokens (20 to 163), the
1197
+ // no-effort ones included (they echoed effort `max`).
1198
+ thinkingDefaultOn: true,
1199
+ },
1045
1200
  {
1046
1201
  id: "deepseek-v4.1-flash",
1047
1202
  displayName: "DeepSeek V4.1 Flash",
@@ -1099,6 +1254,31 @@ export const STRUCTURED_VISION_MODELS = LLM_MODELS.filter(
1099
1254
  (m) => m.supportsImages && m.structuredOutputMode != null,
1100
1255
  )
1101
1256
 
1257
+ /**
1258
+ * How a structured call's schema goes on the wire for `model`: its trusted
1259
+ * `structuredOutputMode`, else its `structuredOutputHint`; undefined = the
1260
+ * schema is not sent at all (a model with neither: plain text, parsed and
1261
+ * re-asked). What the request builders read — never a TRUST decision, which
1262
+ * reads `structuredOutputMode` alone.
1263
+ */
1264
+ export function structuredWireMode(
1265
+ model: Pick<LlmModelDef, "structuredOutputMode" | "structuredOutputHint">,
1266
+ ): LlmModelDef["structuredOutputMode"] {
1267
+ return model.structuredOutputMode ?? model.structuredOutputHint
1268
+ }
1269
+
1270
+ /**
1271
+ * Does a structured call on `modelId` (unset = `feature`'s default model) put
1272
+ * its schema on the wire ({@link structuredWireMode})? What a request's size
1273
+ * counts the schema by — a schema that is not sent is not read by the model.
1274
+ * A model the registry does not know counts as yes (the larger size).
1275
+ */
1276
+ export function llmSendsSchema(modelId: string | undefined, feature?: string): boolean {
1277
+ const id = modelId || (feature ? LLM_FEATURE_DEFAULTS[feature as LlmFeature] : undefined)
1278
+ const model = id ? getLlmModel(id) : undefined
1279
+ return !model || structuredWireMode(model) !== undefined
1280
+ }
1281
+
1102
1282
  /**
1103
1283
  * Models {@link STRUCTURED_VISION_MODELS} carries that describe-to-picker does
1104
1284
  * NOT offer — now none.
@@ -1376,6 +1556,12 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1376
1556
  // video-analysis tier + pricing decision. That waits on a Video Analysis
1377
1557
  // bake-off; flip these two flags ONLY together with its outcome.
1378
1558
  "gemini-4-argon": { image: true, video: false, audio: false },
1559
+ // gemini-4-carbon is IMAGE-ONLY for now, by decision (2026-11-12): the model
1560
+ // reads video and audio, but full caps would auto-enroll it in
1561
+ // VIDEO_ANALYSIS_LLM_MODELS (derived below). Its video + audio input comes in
1562
+ // a follow-up change that also decides its Video Analysis enrolment; flip
1563
+ // these two flags ONLY together with that.
1564
+ "gemini-4-carbon": { image: true, video: false, audio: false },
1379
1565
  "claude-haiku-4.5": { image: true, video: false, audio: false },
1380
1566
  "claude-haiku-5.5": { image: true, video: false, audio: false },
1381
1567
  "claude-sonnet-4.6": { image: true, video: false, audio: false },
@@ -1392,6 +1578,8 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1392
1578
  "gpt-6-luna": { image: true, video: false, audio: false },
1393
1579
  "gpt-6-sol": { image: true, video: false, audio: false },
1394
1580
  "gpt-6.1-sol": { image: true, video: false, audio: false },
1581
+ // KIE's doc also takes files (PDFs, documents); that input is not wired here.
1582
+ "gpt-6.1-terra": { image: true, video: false, audio: false },
1395
1583
  "grok-4.6": { image: true, video: false, audio: false },
1396
1584
  "grok-4.7": { image: true, video: false, audio: false },
1397
1585
  "claude-sonnet-5": { image: true, video: false, audio: false },
@@ -1402,6 +1590,7 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1402
1590
  "claude-fable-5": { image: true, video: false, audio: false },
1403
1591
  // KIE documents text + image input only for both.
1404
1592
  "kimi-k3": { image: true, video: false, audio: false },
1593
+ "kimi-k3.1-pro": { image: true, video: false, audio: false },
1405
1594
  "deepseek-v4.1-flash": { image: true, video: false, audio: false },
1406
1595
  }
1407
1596
 
@@ -1479,7 +1668,12 @@ export function availableReasoningEfforts(
1479
1668
  return model.reasoningEfforts ?? []
1480
1669
  }
1481
1670
 
1482
- /** Highest level the model supports that is ≤ the requested level; undefined = treat as Auto. */
1671
+ /**
1672
+ * Highest level the model supports that is ≤ the requested level; undefined =
1673
+ * treat as Auto. A request below the model's lowest level is dropped (Auto) —
1674
+ * except on a model that declares `effortBelowLowestSendsLowest`, where it is
1675
+ * sent as that lowest level. No request at all is always Auto.
1676
+ */
1483
1677
  export function effectiveReasoningEffort(
1484
1678
  modelId: string | undefined,
1485
1679
  requested?: string,
@@ -1493,6 +1687,7 @@ export function effectiveReasoningEffort(
1493
1687
  for (const l of levels) {
1494
1688
  if (EFFORT_RANK[l] <= EFFORT_RANK[req] && (best === undefined || EFFORT_RANK[l] > EFFORT_RANK[best])) best = l
1495
1689
  }
1690
+ if (best === undefined && getLlmModel(modelId ?? "")?.effortBelowLowestSendsLowest) return levels[0]
1496
1691
  return best
1497
1692
  }
1498
1693
 
@@ -1610,12 +1805,16 @@ export function llmServesDirect(
1610
1805
  * `POST /v1/credits/model-costs` (or `GET /v1/credits/model-cost?model=`) for
1611
1806
  * the call's estimated price: `<feature>:<modelId>`, plus `:direct` when the
1612
1807
  * call is served on the vendor's own API ({@link llmServesDirect}), which is
1613
- * priced at the direct rate.
1808
+ * priced at the direct rate, or — on a model whose price depends on the effort
1809
+ * (`effortPriced`, served on the aggregator) — `:effort-<level>` naming the
1810
+ * effort the call sends. On every other model the effort changes the key only
1811
+ * through its lane. Read back by {@link parseLlmPriceKeyModel}.
1614
1812
  *
1615
1813
  * With no `reasoningEffort` the default effort of the feature the call
1616
1814
  * borrows its defaults from applies ({@link llmDefaultsFeature},
1617
1815
  * {@link defaultReasoningEffort}) — the effort the call then runs at — so the
1618
- * key names the lane the call is held and charged on.
1816
+ * key names the lane (and, where it matters, the effort) the call is held and
1817
+ * charged on.
1619
1818
  *
1620
1819
  * `modelId` must already be resolved: the model the call runs on, never empty
1621
1820
  * (a caller with no model passes the feature's default, `LLM_FEATURE_DEFAULTS`
@@ -1629,7 +1828,53 @@ export function llmPriceKey(
1629
1828
  ): string {
1630
1829
  if (!modelId) throw new TypeError(`llmPriceKey: modelId must be a resolved model id (feature "${feature}")`)
1631
1830
  const effort = reasoningEffort ?? defaultReasoningEffort(llmDefaultsFeature(feature), modelId)
1632
- return llmServesDirect(modelId, effort, advancedMode) ? `${feature}:${modelId}:direct` : `${feature}:${modelId}`
1831
+ if (llmServesDirect(modelId, effort, advancedMode)) return `${feature}:${modelId}${LLM_PRICE_KEY_DIRECT}`
1832
+ // A model whose price depends on the effort (`effortPriced`) names the one
1833
+ // the call sends — clamped as the aggregator's wire clamps it, so a level it
1834
+ // does not offer is the effort that is really sent (or none). Every other
1835
+ // model's key is unchanged.
1836
+ const sent = getLlmModel(modelId)?.effortPriced ? effectiveReasoningEffort(modelId, effort) : undefined
1837
+ return sent ? `${feature}:${modelId}${LLM_PRICE_KEY_EFFORT}${sent}` : `${feature}:${modelId}`
1838
+ }
1839
+
1840
+ /** The price-key suffix of a call served on the vendor's own API (see {@link llmPriceKey}). */
1841
+ export const LLM_PRICE_KEY_DIRECT = ":direct"
1842
+ /** The price-key suffix naming the effort a call sends, on an `effortPriced` model: `:effort-<level>`. */
1843
+ export const LLM_PRICE_KEY_EFFORT = ":effort-"
1844
+
1845
+ /** A price key's model part, read back by {@link parseLlmPriceKeyModel}. */
1846
+ export interface LlmPriceKeyModel {
1847
+ modelId: string
1848
+ /** Present only for a key that names the direct lane. */
1849
+ lane?: "direct"
1850
+ /** Present only for a key that names an effort (an `effortPriced` model's). */
1851
+ reasoningEffort?: LlmReasoningEffort
1852
+ }
1853
+
1854
+ const REGISTRY_MODEL_IDS: ReadonlySet<string> = new Set(LLM_MODEL_IDS)
1855
+
1856
+ /**
1857
+ * The part of a price key after its `<feature>:` — `<modelId>`,
1858
+ * `<modelId>:direct` or `<modelId>:effort-<level>` — read back, or null for
1859
+ * anything that is not a key {@link llmPriceKey} could build: a model that is
1860
+ * not a registry id (never a borrowed slug), an effort on a model whose price
1861
+ * does not depend on it, a level it does not offer on the aggregator, any
1862
+ * other suffix. The one reader both the server and the editor use, so every
1863
+ * key names exactly one price.
1864
+ */
1865
+ export function parseLlmPriceKeyModel(tail: string): LlmPriceKeyModel | null {
1866
+ if (REGISTRY_MODEL_IDS.has(tail)) return { modelId: tail }
1867
+ if (tail.endsWith(LLM_PRICE_KEY_DIRECT)) {
1868
+ const modelId = tail.slice(0, -LLM_PRICE_KEY_DIRECT.length)
1869
+ return REGISTRY_MODEL_IDS.has(modelId) ? { modelId, lane: "direct" } : null
1870
+ }
1871
+ const at = tail.lastIndexOf(LLM_PRICE_KEY_EFFORT)
1872
+ if (at <= 0) return null
1873
+ const modelId = tail.slice(0, at)
1874
+ const level = tail.slice(at + LLM_PRICE_KEY_EFFORT.length) as LlmReasoningEffort
1875
+ const model = REGISTRY_MODEL_IDS.has(modelId) ? getLlmModel(modelId) : undefined
1876
+ if (!model?.effortPriced || !availableReasoningEfforts(modelId).includes(level)) return null
1877
+ return { modelId, reasoningEffort: level }
1633
1878
  }
1634
1879
 
1635
1880
  /**
@@ -67,6 +67,17 @@ export const MASK_COMPOSITE_BOUNDS = {
67
67
  /** Seconds of result one pricing unit covers. */
68
68
  export const MASK_COMPOSITE_UNIT_SEC = 5
69
69
 
70
+ /**
71
+ * How much longer, in seconds, the leading video the render downloads may run
72
+ * than the one measured before the run was charged, before the render refuses
73
+ * it as changed: a re-measure can read a hair longer (a re-encode, a
74
+ * container's rounding), and that is not a different file. Applied to the
75
+ * seconds, never to the units, before the price's own 0.05 s grace
76
+ * (`pricedClipSeconds`): a run billed for 10 s renders a lead of up to about
77
+ * 10.55 s. The same slack as Video Overlay's base.
78
+ */
79
+ export const MASK_COMPOSITE_REMEASURE_SLACK_SEC = 0.5
80
+
70
81
  /**
71
82
  * Pricing units for a result `durationSec` long: one per started 5 seconds,
72
83
  * at least one, after `pricedClipSeconds` (up to 0.05 s past a whole second is
@@ -0,0 +1,61 @@
1
+ /**
2
+ * MiniMax H3 Image: a text-to-image id and its edit sibling. It is priced by
3
+ * size (1K and 2K cost the same, 4K more) and, on an edit, by how many
4
+ * reference images it is given.
5
+ *
6
+ * Only the ids and levers live in this published package. The rates and the
7
+ * formula are `backend/src/ee/billing/minimax-h3-image-pricing.ts`.
8
+ *
9
+ * Not the MiniMax H3 VIDEO model, `minimax-h3`. These ids extend that string,
10
+ * so nothing here may match by prefix, and neither id may join a set keyed on
11
+ * the video model (`MINIMAX_H3_PROVIDERS`).
12
+ */
13
+
14
+ export const MINIMAX_H3_IMAGE_T2I = "minimax-h3-image"
15
+ export const MINIMAX_H3_IMAGE_I2I = "minimax-h3-image-i2i"
16
+ export type MinimaxH3ImageModel = typeof MINIMAX_H3_IMAGE_T2I | typeof MINIMAX_H3_IMAGE_I2I
17
+
18
+ export const MINIMAX_H3_IMAGE_RESOLUTIONS = ["1K", "2K", "4K"] as const
19
+ export type MinimaxH3ImageResolution = (typeof MINIMAX_H3_IMAGE_RESOLUTIONS)[number]
20
+ /** What a run renders when it names no size: the provider's own default. */
21
+ export const MINIMAX_H3_IMAGE_DEFAULT_RESOLUTION: MinimaxH3ImageResolution = "2K"
22
+ /** The most reference images one edit takes (`REF_IMAGE_MAX_LIMITS`). */
23
+ export const MINIMAX_H3_IMAGE_MAX_INPUT_IMAGES = 16
24
+
25
+ export function isMinimaxH3Image(model: unknown): model is MinimaxH3ImageModel {
26
+ return model === MINIMAX_H3_IMAGE_T2I || model === MINIMAX_H3_IMAGE_I2I
27
+ }
28
+
29
+ export function isMinimaxH3ImageI2i(model: unknown): model is typeof MINIMAX_H3_IMAGE_I2I {
30
+ return model === MINIMAX_H3_IMAGE_I2I
31
+ }
32
+
33
+ /** The size a run is priced at: the one asked for in any case, else the default. */
34
+ function pricedResolution(resolution: unknown): MinimaxH3ImageResolution {
35
+ const asked = typeof resolution === "string" ? resolution.trim().toLowerCase() : ""
36
+ return MINIMAX_H3_IMAGE_RESOLUTIONS.find((r) => r.toLowerCase() === asked) ?? MINIMAX_H3_IMAGE_DEFAULT_RESOLUTION
37
+ }
38
+
39
+ /**
40
+ * The price id of a MiniMax H3 Image run: `minimax-h3-image:<size>` from a
41
+ * prompt, `minimax-h3-image-i2i:<size>:<N>ref` for an edit given N reference
42
+ * images (1 to 16). The bare ids are never built here.
43
+ *
44
+ * A size off the grid (a stored node, the multi-model preview pricing one
45
+ * node's data against every model) is priced at the default, 2K. The text-to-
46
+ * image id sent reference images runs on the edit endpoint (the KIE provider
47
+ * swaps it), so a caller that does not swap first (the entity routes, a
48
+ * pipeline pin) is priced there too. An edit always has at least one image.
49
+ */
50
+ export function minimaxH3ImageCreditId(
51
+ provider: MinimaxH3ImageModel,
52
+ resolution: unknown,
53
+ referenceImageCount: number | undefined,
54
+ ): string {
55
+ const size = pricedResolution(resolution)
56
+ const asked = Number.isFinite(referenceImageCount) ? Math.trunc(referenceImageCount as number) : 0
57
+ const edit = provider === MINIMAX_H3_IMAGE_I2I || asked > 0
58
+ if (!edit) return `${MINIMAX_H3_IMAGE_T2I}:${size}`
59
+ const images = Math.min(Math.max(1, asked), MINIMAX_H3_IMAGE_MAX_INPUT_IMAGES)
60
+ return `${MINIMAX_H3_IMAGE_I2I}:${size}:${images}ref`
61
+ }