@nodaro/shared 3.63.0 → 3.65.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 (265) hide show
  1. package/dist/{chunk-3K24DWOH.js → chunk-222QM7CO.js} +3 -3
  2. package/dist/{chunk-3K24DWOH.js.map → chunk-222QM7CO.js.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-4DVWXEB6.js → chunk-2NKF476Z.js} +3 -3
  6. package/dist/{chunk-4DVWXEB6.js.map → chunk-2NKF476Z.js.map} +1 -1
  7. package/dist/chunk-3AU52TSW.js +143 -0
  8. package/dist/chunk-3AU52TSW.js.map +1 -0
  9. package/dist/{chunk-F6WGGYQW.cjs → chunk-5NVGKXJV.cjs} +68 -29
  10. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  11. package/dist/{chunk-HWQ2SYNA.js → chunk-5SSMPYE5.js} +99 -9
  12. package/dist/chunk-5SSMPYE5.js.map +1 -0
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  16. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  17. package/dist/{chunk-TM5JYSJF.cjs → chunk-6OSIOVF7.cjs} +98 -37
  18. package/dist/chunk-6OSIOVF7.cjs.map +1 -0
  19. package/dist/{chunk-YUER7TJG.js → chunk-6X5PBAC4.js} +13 -4
  20. package/dist/chunk-6X5PBAC4.js.map +1 -0
  21. package/dist/chunk-7BN4EDIC.cjs +185 -0
  22. package/dist/chunk-7BN4EDIC.cjs.map +1 -0
  23. package/dist/{chunk-6M563QE6.js → chunk-7OWXHW7Z.js} +78 -28
  24. package/dist/chunk-7OWXHW7Z.js.map +1 -0
  25. package/dist/{chunk-FXGNRYQQ.js → chunk-AT53ZQUC.js} +3 -3
  26. package/dist/{chunk-FXGNRYQQ.js.map → chunk-AT53ZQUC.js.map} +1 -1
  27. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  28. package/dist/chunk-BQYCZLMF.js.map +1 -0
  29. package/dist/{chunk-34QLPTSA.js → chunk-BSTAAGLY.js} +3 -3
  30. package/dist/{chunk-34QLPTSA.js.map → chunk-BSTAAGLY.js.map} +1 -1
  31. package/dist/{chunk-PSKZKLDG.js → chunk-CW6MMQNO.js} +562 -26
  32. package/dist/chunk-CW6MMQNO.js.map +1 -0
  33. package/dist/{chunk-EPXGG27L.js → chunk-D5Y3EYRM.js} +5 -5
  34. package/dist/{chunk-EPXGG27L.js.map → chunk-D5Y3EYRM.js.map} +1 -1
  35. package/dist/{chunk-XGVJGNZW.cjs → chunk-DQ2PARNH.cjs} +15 -5
  36. package/dist/chunk-DQ2PARNH.cjs.map +1 -0
  37. package/dist/{chunk-6BZC2ZHC.cjs → chunk-E66HSC2E.cjs} +9 -9
  38. package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-E66HSC2E.cjs.map} +1 -1
  39. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  40. package/dist/chunk-FGBGKBML.js.map +1 -0
  41. package/dist/{chunk-M5OCFGHF.cjs → chunk-FI3HJZWM.cjs} +588 -25
  42. package/dist/chunk-FI3HJZWM.cjs.map +1 -0
  43. package/dist/{chunk-L2TVY6XN.cjs → chunk-FJZTQTF4.cjs} +4 -4
  44. package/dist/{chunk-L2TVY6XN.cjs.map → chunk-FJZTQTF4.cjs.map} +1 -1
  45. package/dist/{chunk-XGGZWA4A.cjs → chunk-GJ3D5X4X.cjs} +52 -49
  46. package/dist/chunk-GJ3D5X4X.cjs.map +1 -0
  47. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  48. package/dist/chunk-H5KHWTAE.js.map +1 -0
  49. package/dist/{chunk-MD4XHED4.js → chunk-H745DQ6V.js} +3 -3
  50. package/dist/{chunk-MD4XHED4.js.map → chunk-H745DQ6V.js.map} +1 -1
  51. package/dist/{chunk-KCZHQH2O.js → chunk-HAH2F7LT.js} +4 -4
  52. package/dist/{chunk-KCZHQH2O.js.map → chunk-HAH2F7LT.js.map} +1 -1
  53. package/dist/{chunk-V5EEQR2U.cjs → chunk-JQMFJAYU.cjs} +21 -21
  54. package/dist/{chunk-V5EEQR2U.cjs.map → chunk-JQMFJAYU.cjs.map} +1 -1
  55. package/dist/{chunk-WZVIBAKN.cjs → chunk-JYU5EIRM.cjs} +12 -12
  56. package/dist/{chunk-WZVIBAKN.cjs.map → chunk-JYU5EIRM.cjs.map} +1 -1
  57. package/dist/{chunk-Y35JQPT6.cjs → chunk-K6RIN3LW.cjs} +142 -45
  58. package/dist/chunk-K6RIN3LW.cjs.map +1 -0
  59. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  60. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  61. package/dist/{chunk-2PU3AGGS.cjs → chunk-KTCEKGBJ.cjs} +7 -7
  62. package/dist/{chunk-2PU3AGGS.cjs.map → chunk-KTCEKGBJ.cjs.map} +1 -1
  63. package/dist/{chunk-LH72PQO2.cjs → chunk-KWYS4IIM.cjs} +165 -50
  64. package/dist/chunk-KWYS4IIM.cjs.map +1 -0
  65. package/dist/{chunk-GSKLPI3J.cjs → chunk-MIT2USTS.cjs} +118 -61
  66. package/dist/chunk-MIT2USTS.cjs.map +1 -0
  67. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  68. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  69. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  70. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  71. package/dist/{chunk-X5BAFW3Q.cjs → chunk-PGDR7CO3.cjs} +8 -8
  72. package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  73. package/dist/{chunk-OV3JTKBY.js → chunk-PL7AQQV7.js} +123 -22
  74. package/dist/chunk-PL7AQQV7.js.map +1 -0
  75. package/dist/chunk-Q4YOLT4M.js +164 -0
  76. package/dist/chunk-Q4YOLT4M.js.map +1 -0
  77. package/dist/{chunk-GMBDLNLD.cjs → chunk-R5ILCNCC.cjs} +197 -60
  78. package/dist/chunk-R5ILCNCC.cjs.map +1 -0
  79. package/dist/chunk-RP4KQUNU.cjs +168 -0
  80. package/dist/chunk-RP4KQUNU.cjs.map +1 -0
  81. package/dist/{chunk-77WU3V3J.cjs → chunk-SPU7MUWE.cjs} +6 -6
  82. package/dist/{chunk-77WU3V3J.cjs.map → chunk-SPU7MUWE.cjs.map} +1 -1
  83. package/dist/{chunk-XBTYGQ6Z.js → chunk-ST7OBB5J.js} +8 -5
  84. package/dist/chunk-ST7OBB5J.js.map +1 -0
  85. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  86. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  87. package/dist/{chunk-BMJVKYVB.js → chunk-V5NLQ4L5.js} +123 -7
  88. package/dist/chunk-V5NLQ4L5.js.map +1 -0
  89. package/dist/{chunk-KMGCHV6O.js → chunk-V6OXSXIX.js} +63 -30
  90. package/dist/chunk-V6OXSXIX.js.map +1 -0
  91. package/dist/{chunk-LMAQUR55.cjs → chunk-WQMPIURW.cjs} +6 -6
  92. package/dist/{chunk-LMAQUR55.cjs.map → chunk-WQMPIURW.cjs.map} +1 -1
  93. package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-WZG6GZIL.cjs} +4 -4
  94. package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  95. package/dist/{chunk-AE3AAJ4O.js → chunk-XJANKTIL.js} +3 -3
  96. package/dist/{chunk-AE3AAJ4O.js.map → chunk-XJANKTIL.js.map} +1 -1
  97. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  98. package/dist/chunk-XJWED257.js.map +1 -0
  99. package/dist/chunk-XSSLNINL.js +346 -0
  100. package/dist/chunk-XSSLNINL.js.map +1 -0
  101. package/dist/{chunk-6TGB7ECA.cjs → chunk-YD4XY74W.cjs} +12 -8
  102. package/dist/chunk-YD4XY74W.cjs.map +1 -0
  103. package/dist/{chunk-YX6TFX7H.js → chunk-YMZUE2IX.js} +66 -11
  104. package/dist/chunk-YMZUE2IX.js.map +1 -0
  105. package/dist/{chunk-4MMZD63H.js → chunk-Z77M7Q2R.js} +3 -3
  106. package/dist/{chunk-4MMZD63H.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  107. package/dist/{chunk-CZ5IQB3L.js → chunk-ZSRXY5YT.js} +8 -5
  108. package/dist/chunk-ZSRXY5YT.js.map +1 -0
  109. package/dist/entries/apps.cjs +43 -42
  110. package/dist/entries/apps.js +8 -7
  111. package/dist/entries/captions.cjs +38 -30
  112. package/dist/entries/captions.d.cts +48 -2
  113. package/dist/entries/captions.d.ts +48 -2
  114. package/dist/entries/captions.js +1 -1
  115. package/dist/entries/credits.cjs +319 -191
  116. package/dist/entries/credits.d.cts +260 -19
  117. package/dist/entries/credits.d.ts +260 -19
  118. package/dist/entries/credits.js +11 -11
  119. package/dist/entries/entities.cjs +202 -193
  120. package/dist/entries/entities.d.cts +44 -9
  121. package/dist/entries/entities.d.ts +44 -9
  122. package/dist/entries/entities.js +2 -1
  123. package/dist/entries/llm-models.cjs +86 -62
  124. package/dist/entries/llm-models.d.cts +73 -20
  125. package/dist/entries/llm-models.d.ts +73 -20
  126. package/dist/entries/llm-models.js +2 -2
  127. package/dist/entries/media.cjs +79 -63
  128. package/dist/entries/media.d.cts +154 -1
  129. package/dist/entries/media.d.ts +154 -1
  130. package/dist/entries/media.js +1 -1
  131. package/dist/entries/model-catalog.cjs +205 -109
  132. package/dist/entries/model-catalog.d.cts +65 -58
  133. package/dist/entries/model-catalog.d.ts +65 -58
  134. package/dist/entries/model-catalog.js +4 -4
  135. package/dist/entries/models.cjs +527 -346
  136. package/dist/entries/models.d.cts +86 -7
  137. package/dist/entries/models.d.ts +86 -7
  138. package/dist/entries/models.js +6 -5
  139. package/dist/entries/nodes.cjs +220 -211
  140. package/dist/entries/nodes.d.cts +46 -3
  141. package/dist/entries/nodes.d.ts +46 -3
  142. package/dist/entries/nodes.js +10 -9
  143. package/dist/entries/pipeline.cjs +156 -152
  144. package/dist/entries/pipeline.d.cts +14 -4
  145. package/dist/entries/pipeline.d.ts +14 -4
  146. package/dist/entries/pipeline.js +3 -3
  147. package/dist/entries/social.cjs +177 -177
  148. package/dist/entries/social.js +2 -2
  149. package/dist/entries/ugc.cjs +71 -71
  150. package/dist/entries/ugc.js +4 -4
  151. package/dist/entries/video.cjs +174 -145
  152. package/dist/entries/video.d.cts +114 -2
  153. package/dist/entries/video.d.ts +114 -2
  154. package/dist/entries/video.js +7 -6
  155. package/dist/entries/workflow.cjs +150 -150
  156. package/dist/entries/workflow.d.cts +1 -1
  157. package/dist/entries/workflow.d.ts +1 -1
  158. package/dist/entries/workflow.js +2 -2
  159. package/dist/index.cjs +2430 -1929
  160. package/dist/index.d.cts +13 -12
  161. package/dist/index.d.ts +13 -12
  162. package/dist/index.js +28 -27
  163. package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-BoUKGFNl.d.cts} +182 -3
  164. package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-BoUKGFNl.d.ts} +182 -3
  165. package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BElS3AeE.d.ts} +142 -23
  166. package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-CpQz1bGa.d.cts} +142 -23
  167. package/dist/tts-capabilities-BtnDWK9K.d.ts +133 -0
  168. package/dist/tts-capabilities-C52UccTI.d.cts +133 -0
  169. package/package.json +1 -1
  170. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  171. package/src/__tests__/dialogue-capabilities.test.ts +167 -6
  172. package/src/__tests__/extend-providers.test.ts +353 -26
  173. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  174. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  175. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  176. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  177. package/src/__tests__/flux-3-klein.test.ts +203 -0
  178. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  179. package/src/__tests__/kling4-catalog.test.ts +1 -1
  180. package/src/__tests__/llm-models.test.ts +48 -13
  181. package/src/__tests__/llm-price-key.test.ts +12 -0
  182. package/src/__tests__/model-makers.test.ts +3 -0
  183. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  184. package/src/__tests__/normalize-node-params.test.ts +147 -1
  185. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  186. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  187. package/src/__tests__/sequence-execution.test.ts +22 -1
  188. package/src/__tests__/speech-pricing.test.ts +62 -1
  189. package/src/__tests__/suno-credit-type.test.ts +21 -2
  190. package/src/__tests__/transcribe-capabilities.test.ts +4 -2
  191. package/src/__tests__/tts-capabilities.test.ts +160 -4
  192. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  193. package/src/__tests__/video-analysis-pricing.test.ts +22 -9
  194. package/src/__tests__/video-subjects.test.ts +192 -0
  195. package/src/__tests__/wired-character-names.test.ts +142 -0
  196. package/src/caption-styles.ts +62 -0
  197. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  198. package/src/credit-estimators/index.ts +14 -0
  199. package/src/credit-estimators/speech.ts +57 -9
  200. package/src/credit-identifiers.ts +284 -13
  201. package/src/dialogue-capabilities.ts +220 -3
  202. package/src/dubbing-structure.ts +186 -0
  203. package/src/entries/captions.ts +2 -0
  204. package/src/entries/credits.ts +25 -1
  205. package/src/entries/entities.ts +2 -0
  206. package/src/entries/llm-models.ts +7 -0
  207. package/src/entries/media.ts +3 -1
  208. package/src/entries/model-catalog.ts +30 -0
  209. package/src/entries/models.ts +54 -0
  210. package/src/entries/nodes.ts +2 -0
  211. package/src/entries/pipeline.ts +1 -1
  212. package/src/entries/video.ts +8 -1
  213. package/src/flux-3-klein.ts +69 -0
  214. package/src/gemini-tts.ts +144 -0
  215. package/src/input-image-pricing.ts +23 -6
  216. package/src/llm-models.ts +130 -36
  217. package/src/model-catalog.ts +539 -25
  218. package/src/model-constants.ts +247 -25
  219. package/src/node-default-mappings.ts +3 -0
  220. package/src/node-runtime-keys.ts +3 -0
  221. package/src/normalize-node-params.ts +123 -2
  222. package/src/seedance-extend-rate.ts +116 -0
  223. package/src/sequence-execution.ts +24 -0
  224. package/src/transcribe-preflight.ts +23 -0
  225. package/src/tts-capabilities.ts +193 -1
  226. package/src/video-analysis-pricing.ts +39 -15
  227. package/src/video-character-refs.ts +160 -3
  228. package/src/wired-character-names.ts +134 -18
  229. package/src/wired-character-video-subjects.ts +63 -0
  230. package/dist/chunk-63H4C56Q.cjs +0 -38
  231. package/dist/chunk-63H4C56Q.cjs.map +0 -1
  232. package/dist/chunk-6M563QE6.js.map +0 -1
  233. package/dist/chunk-6TGB7ECA.cjs.map +0 -1
  234. package/dist/chunk-6XUG4L7X.cjs +0 -54
  235. package/dist/chunk-6XUG4L7X.cjs.map +0 -1
  236. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  237. package/dist/chunk-BMJVKYVB.js.map +0 -1
  238. package/dist/chunk-CZ5IQB3L.js.map +0 -1
  239. package/dist/chunk-F6WGGYQW.cjs.map +0 -1
  240. package/dist/chunk-GMBDLNLD.cjs.map +0 -1
  241. package/dist/chunk-GSKLPI3J.cjs.map +0 -1
  242. package/dist/chunk-HBXF6RUU.js +0 -31
  243. package/dist/chunk-HBXF6RUU.js.map +0 -1
  244. package/dist/chunk-HSHCCBIV.js.map +0 -1
  245. package/dist/chunk-HWQ2SYNA.js.map +0 -1
  246. package/dist/chunk-IY3Y462W.js +0 -42
  247. package/dist/chunk-IY3Y462W.js.map +0 -1
  248. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  249. package/dist/chunk-KMGCHV6O.js.map +0 -1
  250. package/dist/chunk-LH72PQO2.cjs.map +0 -1
  251. package/dist/chunk-M5OCFGHF.cjs.map +0 -1
  252. package/dist/chunk-NIAFR5EE.js.map +0 -1
  253. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  254. package/dist/chunk-OV3JTKBY.js.map +0 -1
  255. package/dist/chunk-PSKZKLDG.js.map +0 -1
  256. package/dist/chunk-Q6IES3U2.js.map +0 -1
  257. package/dist/chunk-TM5JYSJF.cjs.map +0 -1
  258. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  259. package/dist/chunk-XBTYGQ6Z.js.map +0 -1
  260. package/dist/chunk-XGGZWA4A.cjs.map +0 -1
  261. package/dist/chunk-XGVJGNZW.cjs.map +0 -1
  262. package/dist/chunk-Y35JQPT6.cjs.map +0 -1
  263. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
  264. package/dist/chunk-YUER7TJG.js.map +0 -1
  265. package/dist/chunk-YX6TFX7H.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/llm-models.ts"],"names":["modelId"],"mappings":";;;AAmBO,IAAM,wBAAwB,CAAC,MAAA,EAAQ,OAAO,QAAA,EAAU,MAAA,EAAQ,SAAS,KAAK;AAG9E,IAAM,mCAAoD,IAAI,GAAA,CAAI,CAAC,OAAA,EAAS,KAAK,CAAC;AACzF,IAAM,WAAA,GAAkD,EAAE,IAAA,EAAM,CAAA,EAAG,GAAA,EAAK,CAAA,EAAG,MAAA,EAAQ,CAAA,EAAG,IAAA,EAAM,CAAA,EAAG,KAAA,EAAO,CAAA,EAAG,KAAK,CAAA,EAAE;AAyOzG,IAAM,sBAAA,GAAyB;AAG/B,SAAS,qBAAqB,KAAA,EAA4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,EAAA,IAAI,KAAA,IAAS,yBAAA,CAA0B,QAAA,CAAS,KAAK,GAAG,OAAO,KAAA;AAC/D,EAAA,OAAO,4BAAA;AACT","file":"chunk-F6WGGYQW.cjs","sourcesContent":["/**\n * LLM Model Registry — shared between frontend and backend.\n *\n * Single source of truth for available chat/LLM models routed through KIE.ai,\n * with direct Anthropic SDK fallback for Claude models. This is the\n * NON-monetary side of the registry (model ids, capabilities, tiers,\n * feature defaults). The provider-$ per-token rate table and the\n * `calculateLlmCost` formula derived from it live in\n * `backend/src/lib/pricing/llm-cost.ts` (core, not ee/ — internal LLM cost\n * logging needs them regardless of edition). They were moved out of this\n * package (published Apache-2.0 on npm — an irrevocable grant) per the\n * 2026-07-06 public-flip IP audit, S5: \"Keep the model-id enum; strip prices\n * + measurement notes.\"\n */\n\nexport type LlmTier = \"economy\" | \"standard\" | \"premium\"\nexport type KieApiFormat = \"chat-completions\" | \"messages\" | \"responses\"\nexport type LlmVendor = \"anthropic\" | \"deepseek\" | \"google\" | \"moonshot\" | \"openai\" | \"xai\"\n\nexport const LLM_REASONING_EFFORTS = [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const\nexport type LlmReasoningEffort = (typeof LLM_REASONING_EFFORTS)[number]\n/** Levels that bill one tier up. `high` is the Claude-family server default — it never bumps. */\nexport const EFFORT_TIER_BUMP: ReadonlySet<LlmReasoningEffort> = new Set([\"xhigh\", \"max\"])\nconst EFFORT_RANK: Record<LlmReasoningEffort, number> = { none: 0, low: 1, medium: 2, high: 3, xhigh: 4, max: 5 }\n\nexport interface LlmModelDef {\n id: string\n displayName: string\n /**\n * The product line a person thinks in and filters by (\"Claude\", \"GPT\",\n * \"Gemini\") — the LLM twin of a catalog entry's `series`. REQUIRED, so a new\n * model cannot ship without one; one line never spans two vendors (registry\n * test).\n */\n series: string\n desc: string\n tier: LlmTier\n kieFormat: KieApiFormat\n /** For chat-completions: the slug prefix (e.g. \"gemini-3-flash\").\n * For messages: the model id sent in the body (e.g. \"claude-haiku-4-5-v1messages\").\n * For responses: the model id sent in the body (e.g. \"gpt-5-4\"). */\n kieSlugOrModel: string\n /**\n * The registry id of the model the aggregator ACTUALLY answers this id's KIE\n * lane with, when that is a different model. Set together with borrowing\n * that model's `kieSlugOrModel`, so the wire names what really runs. Only\n * the KIE lane is affected: the direct lane still serves `directGeminiModel`.\n * The KIE lane is costed on that model's KIE rate row. A lookup by the\n * borrowed slug ({@link getLlmModel}) always resolves to its owner, never\n * to the borrower. Absent = KIE serves this id as itself.\n */\n kieServedAs?: string\n /**\n * true = no longer offered: every model menu and advertised list leaves it\n * out ({@link PICKABLE_LLM_MODELS}, {@link groupLlmModelsByVendor}), while\n * the id stays in {@link LLM_MODEL_IDS}, so a saved node or API call that\n * names it keeps validating, resolving and running exactly as before. No\n * default may point at a retired model (registry test).\n */\n retired?: true\n vendor: LlmVendor\n supportsImages: boolean\n maxOutputTokens: number\n /**\n * How this model can be forced into schema-valid structured output.\n * - \"anthropic-tool\" → forced tool_choice on the Claude wire (direct SDK\n * guaranteed; KIE's proxy re-serializes the tool call\n * as a `<tool_calls>` text tag — decoded in llm-client).\n * - \"kie-response-format\" → KIE chat-completions `response_format: json_schema`\n * (verified enforced for Gemini via KIE).\n * - \"responses-json-schema\" → KIE codex/v1/responses `text.format: json_schema`\n * (live-verified 2026-07-14 for gpt-5.4/5.5 and the\n * whole GPT-5.6 family, text AND vision inputs).\n * - undefined → no native mode; callers fall back to parse + retry.\n * Capability-driven so `llmCompleteStructured` never hardcodes provider ids.\n */\n structuredOutputMode?: \"anthropic-tool\" | \"kie-response-format\" | \"responses-json-schema\"\n /**\n * For a model with NO trusted `structuredOutputMode`: the wire field a\n * structured call still sends its schema in, as a hint the model reads but\n * the provider was not found to hold its answer to. Read through\n * {@link structuredWireMode}, which every request builder uses; everything\n * that decides TRUST (STRUCTURED_VISION_MODELS, the structured-model\n * filters) keeps reading `structuredOutputMode` alone, so a hinted model is\n * never offered where guaranteed structured output is required. Every answer\n * is still parsed, validated and re-asked by `llmCompleteStructured`, as for\n * any model. Never set together with `structuredOutputMode` (registry test).\n */\n structuredOutputHint?: \"kie-response-format\" | \"responses-json-schema\"\n /** If set, fallback to direct Anthropic SDK with this model ID when KIE.ai fails */\n directFallbackModel?: string\n /**\n * Google Gemini API model id for the DIRECT lane (generativelanguage, keyed\n * by `GEMINI_API_KEY`) — the Google-side twin of `directFallbackModel`.\n * Presence declares \"this model CAN be served straight from Google\"; absence\n * pins it to KIE forever. Stated, never derived: Google carries `-preview`\n * suffixes on unreleased models, so the id routinely differs from both `id`\n * and `kieSlugOrModel` (`gemini-3.1-pro` → `gemini-3.1-pro-preview`).\n */\n directGeminiModel?: string\n /**\n * Try the direct-vendor lane FIRST for this model, with KIE as the failure\n * fallback. Absent (while `directGeminiModel` is set) = KIE first, direct\n * only when KIE fails.\n *\n * This is a per-model COST decision, not just a routing one: the two lanes\n * bill the same model at materially different unit rates, so a model that\n * backs a high-volume default (see `LLM_FEATURE_DEFAULTS`) is usually better\n * left on whichever lane is cheaper. The rate tables for both lanes live in\n * `backend/src/lib/pricing/llm-cost.ts` — deliberately not in this package,\n * which is published to npm.\n *\n * Mutually exclusive with `preferKie` — the Claude-side half of the same\n * idea. Guarded by a registry test so the two can't both be set.\n */\n preferDirect?: true\n /**\n * true = served ONLY on the vendor's own API (`directGeminiModel`): KIE is\n * never called for this model — not as the primary lane, not as a failure\n * or exhausted-account fallback, not on a pin. `kieSlugOrModel` still names\n * the aggregator's endpoint, for the record and for a later re-enable after\n * a re-probe; nothing sends to it.\n *\n * Every call therefore runs direct, so {@link llmServesDirect} is true for it\n * and it bills on the direct rung by default, Advanced mode or not. Without a\n * direct key the call fails as provider-unavailable rather than reaching KIE.\n * Stronger than `preferDirect` (which keeps KIE as the fallback); the two are\n * mutually exclusive, as are `directOnly` and `preferKie` (registry test).\n */\n directOnly?: true\n /** Effort levels this model accepts (ascending). Absent/empty = no effort lever, picker hidden. */\n reasoningEfforts?: readonly LlmReasoningEffort[]\n /**\n * true = a REQUESTED effort below this model's lowest level is sent as that\n * lowest level, never as nothing ({@link effectiveReasoningEffort}): with no\n * effort on the wire the provider runs this model at its HIGHEST level, so\n * dropping a `none` request would buy the most reasoning instead of the\n * least. Auto — no effort requested at all — still sends nothing. Absent =\n * a request below the lowest level is dropped (Auto), the usual rule.\n */\n effortBelowLowestSendsLowest?: true\n /**\n * true = the PRICE of a call on this model depends on whether it sends a\n * reasoning effort, not only on its lane: the aggregator adds input of its\n * own to every call, whose size depends on it. So the model's price key\n * names the effort a call sends ({@link llmPriceKey}: `:effort-<level>`),\n * and every estimate surface quotes that call. The sizes themselves are\n * backend data (`backend/src/lib/pricing/llm-cost.ts`), held to this flag by\n * a backend test. No model sets it today (GPT-6.1 Terra did for part of\n * 2026-11-12, until its aggregator's added input stopped depending on the\n * effort).\n */\n effortPriced?: true\n /**\n * Effort levels available on the DIRECT lane, when the vendor's own API\n * accepts more than the aggregator does. Absent = the direct lane offers the\n * same set as `reasoningEfforts`.\n *\n * This exists because `reasoningEfforts` has to stay at the KIE-safe\n * intersection — sending a level KIE rejects is a hard failure — while the\n * vendor API accepts the full ladder. Unlocking those extra levels is one of\n * the concrete things Advanced mode buys.\n */\n directReasoningEfforts?: readonly LlmReasoningEffort[]\n /** false = model rejects `temperature` (Claude 5-era, GPT-5.6). Absent = accepts. */\n supportsTemperature?: false\n /**\n * false = the model 400s on a FORCED `tool_choice` (`{ type: \"tool\" }` /\n * `{ type: \"any\" }`) — Claude Sonnet 5.5 and Opus 5.5 (vendor docs: \"not\n * supported for this model\"). Absent = forcing is accepted.\n *\n * Only meaningful with `structuredOutputMode: \"anthropic-tool\"`: such a model\n * is asked with `tool_choice: auto` plus an instruction naming the tool, and\n * the tool carries `strict: true` whenever its schema is expressible in the\n * vendor's strict subset (`anthropicStrictToolSchema` in llm-client). The\n * caller's Zod still validates every answer, so nothing the wire withholds is\n * lost. Declared per model, never matched on a model name.\n */\n supportsForcedToolChoice?: false\n /**\n * true = the model binds each thinking block to the exact conversation prefix\n * that produced it (\"preserved thinking\" — Claude Sonnet 5.5 / Opus 5.5 /\n * Haiku 5.5):\n * replaying a block after an earlier turn was edited, dropped or rebuilt is a\n * 400 on accounts the vendor enforces. A caller that trims or rebuilds stored\n * history between requests (the Workflow Copilot keeps a token budget by\n * dropping its oldest turns) must strip thinking blocks from the turns it\n * replays. Within one request's own tool loop the history only grows, so\n * blocks produced there stay valid.\n */\n conversationBoundThinking?: true\n /**\n * true = this model's reasoning effort takes effect ONLY on the vendor's own\n * API: the aggregator accepts the field and silently ignores it. Measured\n * 2026-10-08 for the Claude family on KIE — `low`, `max` and no effort gave\n * the same output length on a reasoning-heavy prompt, and no thinking block\n * ever came back, even on Sonnet 4.6 at `max`.\n *\n * So an effort-bearing call on such a model is SERVED direct, and it bills\n * as Advanced mode does — one rung up (decided 2026-10-08: \"effort =\n * Advanced\"). {@link llmServesDirect} is the one place that decides it, for\n * the credit identifier and the routing alike.\n */\n effortRequiresDirect?: true\n /** Claude-only: KIE is the preferred routing, direct Anthropic the fallback. */\n preferKie?: true\n /**\n * KIE's NON-streaming endpoint for this model is unreliable (measured);\n * `llmComplete` serves it by opening the streaming wire and collapsing it to\n * one response. Streaming responses do not reliably carry\n * `credits_consumed`, so provider cost on this path comes from the rate\n * table (`backend/src/lib/pricing/llm-cost.ts`) rather than the real charge.\n *\n * Declared per model — a per-model condition on KIE's side, like the\n * Claude-lane one behind `callKieMessagesCollapsed`. The flag says WHICH\n * model is affected, and `llm-client` reads it instead of matching model\n * names. Today only the `responses` dispatcher in `callKie` honours it (the\n * one format where the condition has been measured); a chat-completions or\n * messages model that needs the same treatment must also teach its `callKie`\n * case to read the flag — declaring it alone changes nothing there.\n */\n kieCollapseStream?: true\n /**\n * true = the model reasons even when NO thinking parameter is sent, so its\n * reasoning tokens share the `max_tokens` budget on EVERY call — not just\n * effort-bearing ones. Claude Opus 5 flipped this default (on Opus 4.8/4.7\n * and Sonnet 5, omitting `thinking` means no thinking at all).\n *\n * Consumers MUST give such a model output headroom regardless of the\n * requested effort, or reasoning silently eats a small legacy cap and the\n * answer truncates with `stop_reason: max_tokens` — a paid-for empty reply\n * (since #1588 the client fails such a call rather than return the\n * fragment, but the floor is what keeps it from happening). `deriveParams`\n * (llm-client.ts) floors to {@link reasoningOutputFloor}; the film\n * pipeline's `callLLM` — Anthropic SDK only, so only its Claude members\n * matter — floors at the default. Keep the flag in sync with the vendor's\n * documented default rather than inferring it from the model name.\n */\n thinkingDefaultOn?: true\n /**\n * The output-token cap a REASONING call on this model is floored to — the\n * room its thinking shares with the answer (`thinkingDefaultOn`, or an\n * xhigh/max effort). Absent = {@link REASONING_OUTPUT_FLOOR}; read it through\n * {@link reasoningOutputFloor}, never directly.\n *\n * Declare it ONLY where a lane serving this model is not known to accept the\n * default: the floor rides every lane the model can be served on (KIE AND its\n * direct fallback), so it has to sit at the intersection of what they take —\n * the rule `maxOutputTokens` already follows for the Gemini flash entries.\n * Never below `maxOutputTokens` (a floor under the default cap is not a\n * floor — guarded by a registry test).\n */\n reasoningOutputFloor?: number\n}\n\n/** The reasoning floor for a model that declares no lane limit of its own. */\nexport const REASONING_OUTPUT_FLOOR = 32768\n\n/** The output cap a reasoning call on `model` is floored to (see `LlmModelDef.reasoningOutputFloor`). */\nexport function reasoningOutputFloor(model: LlmModelDef): number {\n return model.reasoningOutputFloor ?? REASONING_OUTPUT_FLOOR\n}\n\nexport const LLM_MODELS: readonly LlmModelDef[] = [\n {\n id: \"gemini-3-flash\",\n displayName: \"Gemini 3 Flash\",\n series: \"Gemini\",\n desc: \"Fast and cheap, good for simple tasks\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n kieSlugOrModel: \"gemini-3-flash\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n maxOutputTokens: 8192,\n // KIE-first: no `preferDirect` — direct is the reliability fallback only.\n // (Per-lane rates are deliberately NOT in this published package; see\n // backend/src/lib/pricing/llm-cost.ts.)\n directGeminiModel: \"gemini-3-flash-preview\",\n // No `reasoningEfforts` at all on the KIE lane, but the vendor API accepts\n // the full minimal→high ladder (`none` maps to Google's `minimal`).\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n // Reasons with no thinking param sent — Google's Gemini 3 default (dynamic\n // thinking; `minimal` is its floor, never off), measured on 3.6 in #1588.\n // Floored at the KIE-safe 8192, the same intersection as `maxOutputTokens`.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 8192,\n },\n {\n id: \"gemini-3.6-flash\",\n displayName: \"Gemini 3.6 Flash\",\n series: \"Gemini\",\n // Demoted 2026-09-06 alongside 3.7: superlatives belong to the CURRENT top\n // model of a family only, and 3.8 now holds that slot.\n desc: \"Fast Gemini, sharper reasoning\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n // KIE serves Gemini 3.6 Flash on the OpenAI-compatible dialect under this\n // slug (docs.kie.ai/market/gemini/gemini-3-6-flash-openai.md) — same\n // chat-completions path shape as gemini-3-flash, different slug prefix.\n kieSlugOrModel: \"gemini-3-6-flash-openai\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n maxOutputTokens: 8192,\n // KIE's 3.6 endpoint accepts `reasoning_effort: low | high` (thinking\n // level) — exactly the chat-completions wire mapping deriveParams sends.\n // Google's own API additionally accepts `minimal` and `medium` on this\n // model; the set stays at the KIE-safe intersection because ONE field\n // feeds both lanes and this model is KIE-first. Widen it only if/when\n // `preferDirect` is set here.\n reasoningEfforts: [\"low\", \"high\"],\n // Google's own API additionally accepts `minimal` and `medium` here —\n // live-verified 2026-07-28. Advanced mode unlocks them.\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n // KIE-first: this model backs 5 of the LLM_FEATURE_DEFAULTS plus the\n // video-analysis fast tier, so it carries the highest call volume of any\n // Gemini entry — the lane with the lower unit cost wins by default and\n // direct is the reliability fallback only.\n directGeminiModel: \"gemini-3.6-flash\",\n // Reasons with NO thinking param sent — measured, issue #1588: a Generate\n // Text node capped at 1,100 tokens fell back to the direct lane (KIE 500),\n // spent ~1,060 of them reasoning, and returned 120 characters cut mid-URL.\n // On the same input the KIE runs used ~500 output tokens in all, so only\n // the fallback runs broke — every other run of a 5-minute schedule.\n // Floored at 8192, NOT the default 32768: the floor rides the KIE endpoint\n // too, and 8192 is all it is known to take (see `maxOutputTokens`).\n thinkingDefaultOn: true,\n reasoningOutputFloor: 8192,\n },\n {\n id: \"gemini-3.7-flash\",\n displayName: \"Gemini 3.7 Flash\",\n series: \"Gemini\",\n // Demoted 2026-09-06 when 3.8 registered below: superlatives belong to the\n // CURRENT top model of a family only (same rule the Opus entries follow) —\n // `desc` renders in every picker, so leaving \"Newest\" on the older flash\n // steers the A/B's traffic backwards.\n desc: \"Fast Gemini, agentic-tuned\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n // Retired 2026-10-19: the aggregator answers this model's own endpoint\n // (`gemini-3-7-flash-openai`) with 3.8, so the KIE lane now names 3.8's\n // endpoint outright and says so. The direct Google lane below still serves\n // real 3.7, Advanced mode included. The entry leaves every picker; saved\n // nodes and API callers that name the id keep running unchanged.\n kieSlugOrModel: \"gemini-3-8-flash-openai\",\n kieServedAs: \"gemini-3.8-flash\",\n retired: true,\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n // Google's own cap is 65,536, but the field feeds BOTH lanes and the KIE\n // flash endpoints cap at 8192 (the measured 3.6 posture) — stay at the\n // KIE-safe intersection, same reasoning as `reasoningEfforts` below.\n maxOutputTokens: 8192,\n // KIE's 3.7 endpoint enumerates reasoning_effort low | high (verified\n // against its OpenAPI spec 2026-08-18), identical to 3.6.\n reasoningEfforts: [\"low\", \"high\"],\n // Assumed parity with 3.6 pending a live probe on the direct lane.\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n directGeminiModel: \"gemini-3.7-flash\",\n // Gemini 3 default: reasons with no thinking param sent (measured on 3.6,\n // #1588). KIE-safe floor, same intersection as `maxOutputTokens`.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 8192,\n },\n {\n id: \"gemini-3.8-flash\",\n displayName: \"Gemini 3.8 Flash\",\n series: \"Gemini\",\n // Inherits \"Newest\" from 3.7 (demoted above). Deliberately does NOT name\n // agentic video: that capability exists only on the direct Google lane\n // (Interactions API, not wired here) and the modality caps below withhold\n // video — a picker desc must not promise a lever this entry cannot expose.\n desc: \"Newest fast Gemini, agentic-tuned\",\n tier: \"economy\",\n kieFormat: \"chat-completions\",\n // KIE serves it on the OpenAI-compatible dialect under this slug\n // (docs.kie.ai/market/gemini/gemini-3-8-flash-openai.md) — identical\n // chat-completions path shape to gemini-3.7-flash / gemini-3.6-flash,\n // different slug prefix.\n kieSlugOrModel: \"gemini-3-8-flash-openai\",\n vendor: \"google\",\n // Live-verified 2026-09-06 on the KIE lane: `response_format: json_schema`\n // is ENFORCED (the reply came back exact-schema valid, credits_consumed\n // present) — not merely accepted-and-ignored.\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n // 16384 here, NOT the 8192 its 3.6 / 3.7 siblings sit at. Those two stay at\n // the KIE-safe intersection because nobody measured their endpoints past\n // it; 3.8's WAS measured — live-verified 2026-09-06, `max_tokens: 20000`\n // was honored for 14,892 completion tokens with finish_reason \"stop\" (no\n // truncation), so the KIE lane is not the binding constraint. 16384 keeps\n // it level with the rest of the registry's ceiling rather than at the cap.\n maxOutputTokens: 16384,\n // KIE's 3.8 endpoint enumerates reasoning_effort low | high (its doc enum),\n // and usage carries completion_tokens_details.reasoning_tokens — same\n // KIE-safe intersection as 3.6 / 3.7, because ONE field feeds both lanes\n // and this model is KIE-first.\n reasoningEfforts: [\"low\", \"high\"],\n // Google's own API accepts the full minimal→high ladder here (`none` maps\n // to `minimal`), same as 3.7. Advanced mode is what unlocks it.\n directReasoningEfforts: [\"none\", \"low\", \"medium\", \"high\"],\n // KIE-first (no `preferDirect`) — 3.7's posture exactly: the cheap lane\n // serves the A/B, direct is Advanced mode + the reliability fallback.\n directGeminiModel: \"gemini-3.8-flash\",\n // Gemini 3 default: reasons with no thinking param sent (measured on 3.6,\n // #1588). Floored at its own 16384, inside the 20000 its KIE endpoint was\n // measured to honour.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 16384,\n },\n {\n id: \"claude-haiku-4.5\",\n displayName: \"Claude Haiku 4.5\",\n series: \"Claude\",\n // Demoted 2026-10-10 when claude-haiku-5.5 registered.\n desc: \"Previous Haiku, fast economy\",\n tier: \"economy\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-haiku-4-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 8192,\n directFallbackModel: \"claude-haiku-4-5-20251001\",\n // KIE-first since 2026-10-08 (a call is priced on the lane it runs on);\n // KIE served it plain and with a tool on its streaming wire that day.\n preferKie: true,\n },\n {\n id: \"claude-haiku-5.5\",\n displayName: \"Claude Haiku 5.5\",\n series: \"Claude\",\n desc: \"Latest Haiku, fast and low-cost with reasoning\",\n tier: \"economy\",\n kieFormat: \"messages\",\n // KIE plain id on the Claude-native messages dialect\n // (docs.kie.ai/market/claude/claude-haiku-5-5.md). Live-probed 2026-10-10\n // on the streaming wire: plain, system prompt, base64 image, a forced tool\n // and an auto + strict tool (both came back as a real tool_use block), and\n // `max_tokens: 32768` were all served.\n kieSlugOrModel: \"claude-haiku-5-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n // NO `supportsForcedToolChoice: false`, unlike Sonnet 5.5 / Opus 5.5: this\n // model ACCEPTS a forced tool_choice (probed on Anthropic's API 2026-10-10).\n // A forced call skips thinking (same usage with and without an effort), and\n // an effort-bearing structured call is already sent the auto choice.\n //\n // A thinking block is valid only while everything before it is unchanged\n // (vendor docs: the same history check the other 5.5 models run).\n conversationBoundThinking: true,\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-haiku-5-5\",\n // The first Haiku with effort levels. The vendor default is `medium`, where\n // most of the family defaults to `high`.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores effort on this slug too — measured 2026-10-10 on a\n // reasoning-heavy prompt: none / low / max / KIE's own `thinkingFlag` gave\n // 2,076 / 1,886 / 2,223 / 1,927 output tokens and no thinking block, while\n // Anthropic's API gave 2,059 at low and 28,097 at max. An effort call runs\n // direct and bills as Advanced.\n effortRequiresDirect: true,\n // Anthropic 400s a non-default sampling value (\"`temperature` is deprecated\n // for this model\", probed 2026-10-10); KIE's proxy accepted temperature: 0.2.\n supportsTemperature: false,\n preferKie: true,\n // Adaptive thinking runs when no thinking param is sent (vendor default),\n // on BOTH lanes: a no-effort KIE call spent ~2,000 output tokens on a\n // ~350-token answer and returned no thinking block.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-sonnet-4.6\",\n displayName: \"Claude Sonnet 4.6\",\n series: \"Claude\",\n desc: \"Balanced quality and speed\",\n tier: \"standard\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-sonnet-4-6\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-sonnet-4-6\",\n // KIE-first since 2026-10-08 (a call is priced on the lane it runs on);\n // KIE served it plain and with a tool on its streaming wire that day.\n preferKie: true,\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n },\n {\n id: \"gpt-5.2\",\n displayName: \"GPT-5.2\",\n series: \"GPT\",\n desc: \"Strong general purpose\",\n tier: \"standard\",\n kieFormat: \"chat-completions\",\n kieSlugOrModel: \"gpt-5-2\",\n vendor: \"openai\",\n supportsImages: true,\n maxOutputTokens: 16384,\n },\n {\n id: \"gemini-3.1-pro\",\n displayName: \"Gemini 3.1 Pro\",\n series: \"Gemini\",\n desc: \"Advanced reasoning, large context\",\n tier: \"premium\",\n kieFormat: \"chat-completions\",\n kieSlugOrModel: \"gemini-3.1-pro\",\n vendor: \"google\",\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directGeminiModel: \"gemini-3.1-pro-preview\",\n // Google documents low/medium/high for 3.1 Pro — no `minimal` tier, so\n // this ladder is deliberately shorter than the flash models'.\n directReasoningEfforts: [\"low\", \"medium\", \"high\"],\n // NO `reasoningEfforts` (the proxied ladder) ON PURPOSE, not an omission.\n // That endpoint accepts `reasoning_effort: low | high` and already DEFAULTS\n // to \"high\", so leaving it unset gets its deepest setting and a ladder here\n // would unlock nothing. The two lanes are NOT equivalent at their maxima:\n // verified 2026-07-29 on identical input, the proxy's ceiling produces\n // roughly a quarter of the reasoning tokens that the direct lane's\n // `thinkingLevel: HIGH` does, and it does not expose Google's deeper tiers\n // at all. That difference is visible in fine-detail reading (small on-screen\n // text such as a name badge), which is exactly what video-analysis casts\n // identities from — so adding an entry here would silently move analysis to\n // the shallower lane. Don't. Full comparison lives with the analysis engine.\n // KIE-first since 2026-10-08 (decided: a call is priced on the lane it runs\n // on, so the base premium price buys the KIE lane; the direct lane is\n // Advanced mode, billed `premium-direct`). It was the one direct-first\n // Gemini before. What the direct lane buys, now behind Advanced: real\n // `thinkingLevel` control, native media ingestion, and a `responseJsonSchema`\n // that honours `additionalProperties` (KIE's `response_format` silently DROPS\n // record/map-shaped fields — see the z.record rule in backend/CLAUDE.md).\n // Video-analysis is unaffected: it pins `requireLane: \"direct\"` itself.\n // Reasons with no thinking param sent on both lanes — the proxied endpoint\n // DEFAULTS to \"high\" (above), and the direct lane reasons harder still.\n // Floored at its own 16384: its KIE fallback is not known to take more.\n thinkingDefaultOn: true,\n reasoningOutputFloor: 16384,\n },\n {\n id: \"gemini-4-argon\",\n displayName: \"Gemini 4 Argon\",\n series: \"Gemini\",\n desc: \"Newest premium Gemini, 1M context\",\n tier: \"premium\",\n kieFormat: \"chat-completions\",\n // DIRECT-ONLY (decided 2026-10-17): KIE serves it on the OpenAI-compatible\n // dialect under this slug (docs.kie.ai/market/gemini/gemini-4-argon-openai.md,\n // byte-identical to the 3.8 Flash spec apart from the name), but that lane\n // failed its probe the same day — of 15 completed calls, 6 came back HTTP 200\n // `finish_reason: stop` with an EMPTY reply (both image calls among them,\n // each still charged), `completion_tokens` was NEGATIVE on reasoning calls\n // (-33, -38), replies leaked code-execution fences (```python?code_reference),\n // `response_format` json_schema left an enum field holding prose, and an\n // off-enum `reasoning_effort: medium` was an empty 200 rather than an error.\n // So no call reaches KIE (`directOnly`); the slug is kept for the record.\n // Re-enable it only after a re-probe of that lane comes back clean.\n // KIE also flags the page \"Chat only — not yet adapted for agent use\", like\n // kimi-k3 / deepseek below: it may not back a tool-loop feature. No registry\n // gate enforces that today — the only tool loops (Workflow Copilot, the\n // pipeline stage calls) are Claude-only by construction.\n kieSlugOrModel: \"gemini-4-argon-openai\",\n vendor: \"google\",\n // The direct lane enforces `responseJsonSchema` (an enum field came back\n // in-enum, 2026-10-17). This mode is what turns that schema on there.\n structuredOutputMode: \"kie-response-format\",\n supportsImages: true,\n // The registry's usual 16384 default. Google's own cap is 32,768\n // (models.list); every call is floored to that (`thinkingDefaultOn`, below).\n maxOutputTokens: 16384,\n directGeminiModel: \"gemini-4-argon\",\n directOnly: true,\n // The direct lane's ladder, and the only one: every call runs there.\n // Google rejects thinkingLevel MINIMAL on this model with a 400 (\"not\n // supported for this model\") and accepts LOW / MEDIUM / HIGH (probed\n // 2026-10-17) — 3.1 Pro's shape, not the flash one. `none` maps to MINIMAL\n // in the direct client, so it is not offered; a `none` request clamps to\n // Auto.\n reasoningEfforts: [\"low\", \"medium\", \"high\"],\n // Gemini's documented default (dynamic thinking with no param sent). The no-param\n // call reported no thought tokens on a two-part puzzle (HIGH reported 452),\n // so this is the vendor default rather than a measurement — kept because it\n // only raises the output ceiling. No `reasoningOutputFloor`: its one lane\n // is Google's, whose cap IS the default 32768 (models.list), and calls sent\n // maxOutputTokens 32768 / 65536 were served, not refused (2026-10-17). How\n // much output it gives at that cap is unmeasured — both long-output probes\n // ended early (one declined the task, one stopped on RECITATION).\n thinkingDefaultOn: true,\n },\n {\n id: \"gemini-4-carbon\",\n displayName: \"Gemini 4 Carbon\",\n series: \"Gemini\",\n desc: \"Deepest-reasoning Gemini, 1M context\",\n tier: \"premium\",\n kieFormat: \"chat-completions\",\n // KIE serves it on the OpenAI-compatible dialect under this slug\n // (docs.kie.ai/market/gemini/gemini-4-carbon-openai — Argon's page with the\n // name swapped). Unlike Argon's, this lane passed its probe (2026-11-12):\n // every call answered, images read, a stream ended cleanly, no empty 200,\n // no negative counts, no code-execution fences. KIE flags it \"Chat only\",\n // like Argon: it may not back a tool-loop feature (none does today).\n kieSlugOrModel: \"gemini-4-carbon-openai\",\n vendor: \"google\",\n // NO trusted `structuredOutputMode` (decided 2026-11-12): KIE did NOT\n // enforce a `response_format` json_schema — both probe calls came back as\n // JSON holding an off-enum value in the enum field (\"cheerful and\n // energized\" for happy | sad). So it is not a STRUCTURED_VISION_MODELS\n // member (not offered by describe-to-picker), and every answer is parsed,\n // validated and re-asked by `llmCompleteStructured`.\n // The schema still goes on the wire, as a hint (`structuredOutputHint`): as\n // `response_format` on KIE (the probe's replies followed its shape, only the\n // enum slipped) and as `responseJsonSchema` on the direct Google lane,\n // which enforced it in the probe — on every attempt, the re-ask included.\n structuredOutputHint: \"kie-response-format\",\n supportsImages: true,\n // The registry's usual 16384, as Argon. Every call is floored to the\n // default 32768 (`thinkingDefaultOn`, below): Google lists an output cap of\n // 32,768 (models.list) and accepted maxOutputTokens 65536; KIE's doc\n // states up to 65,536 tokens, thinking included.\n maxOutputTokens: 16384,\n // KIE first, Google as the reliability fallback (and Advanced mode) — no\n // `preferDirect`, no `directOnly`. Google serves `models/gemini-4-carbon`\n // beside Argon (models.list, 2026-11-12).\n directGeminiModel: \"gemini-4-carbon\",\n // KIE's documented `reasoning_effort` enum, and the direct lane's ladder\n // too: Google 400s thinkingLevel MINIMAL on this model (\"not supported\")\n // and answers LOW / MEDIUM / HIGH (probed 2026-11-12) — Argon's shape. So\n // no `none` (it maps to MINIMAL in the direct client) and no\n // `directReasoningEfforts`: a `none` request clamps to Auto on both lanes.\n reasoningEfforts: [\"low\", \"medium\", \"high\"],\n // Reasons with no thinking param sent on both lanes: KIE's `total_tokens`\n // ran well past prompt + completion on every no-effort call (its dialect\n // reports no reasoning split), and Google's no-level call reported thought\n // tokens. No `reasoningOutputFloor`: both lanes take the default 32768.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-opus-4.7\",\n displayName: \"Claude Opus 4.7\",\n series: \"Claude\",\n // Superlatives belong to the CURRENT top model only — `desc` renders in every\n // model picker, so leaving \"highest quality\" on an older Opus steers\n // quality-critical work backwards (all three Opus entries bill premium, so\n // the mis-steer is invisible on the invoice).\n desc: \"Older Opus, complex tasks\",\n tier: \"premium\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-opus-4-7\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-4-7\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n },\n {\n id: \"gpt-5.4\",\n displayName: \"GPT-5.4\",\n series: \"GPT\",\n // Demoted 2026-09-06: two GPT generations have shipped above it, so\n // \"Latest\" steered the picker at the oldest premium GPT in the registry.\n desc: \"Older GPT, premium quality\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-4\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"low\", \"medium\", \"high\"],\n },\n {\n id: \"gpt-5.5\",\n displayName: \"GPT-5.5\",\n series: \"GPT\",\n desc: \"Previous flagship GPT, deep reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-5\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n },\n {\n id: \"gpt-5.6-luna\",\n displayName: \"GPT-5.6 Luna\",\n series: \"GPT\",\n desc: \"Fastest GPT-5.6, high-volume workloads\",\n tier: \"economy\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-6-luna\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n },\n {\n id: \"gpt-5.6-terra\",\n displayName: \"GPT-5.6 Terra\",\n series: \"GPT\",\n desc: \"Balanced GPT-5.6 for production work\",\n tier: \"standard\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-6-terra\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n },\n {\n id: \"gpt-5.6-sol\",\n displayName: \"GPT-5.6 Sol\",\n series: \"GPT\",\n // Demoted 2026-09-06 when gpt-6-astra registered below — \"Flagship /\n // deepest\" is the current top GPT's copy only. Worded to stay distinct\n // from gpt-5.5's \"Previous flagship GPT, deep reasoning\": all three read\n // premium on the invoice, so a stale superlative mis-steers silently.\n desc: \"Previous flagship GPT-5.6, deep reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-5-6-sol\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n // SERVED COLLAPSED, on the astra precedent (2026-09-17). The 2026-07-14\n // verification that KIE's non-stream responses endpoint serves the GPT-5.6\n // family reliably no longer holds: a live call — a recast continuity\n // review, ~3k tokens, `reasoning.effort: high`, `text.format: json_schema`\n // — came back `500 {\"error\":{\"type\":\"server_error\"}}` / \"Server exception,\n // please try again later\". Same endpoint family, same dialect and the same\n // signature astra was measured on (12 calls: non-stream 2/6, streaming\n // 5/6; a schema-less non-stream call 500'd too, so the lane is the trigger\n // and not the schema). ONE sighting here rather than a fresh 12-call probe\n // — the precedent is strong and the flag is cheap to reverse.\n //\n // THE COST: SSE does not reliably carry `credits_consumed`, so this model's\n // provider cost becomes the rate-table estimate instead of the billed\n // figure. That is the price of a lane that answers, and it is the same\n // trade astra already makes.\n kieCollapseStream: true,\n },\n {\n id: \"gpt-6-astra\",\n displayName: \"GPT-6 Astra\",\n series: \"GPT\",\n desc: \"Flagship GPT-6, deepest reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n // KIE serves GPT-6 on the responses dialect under the OpenAI family path —\n // codex/v1/responses, which llm-client DERIVES from `vendor` (the same\n // derivation that keeps Grok on grok/v1/responses). So this field is the\n // body `model` only, not a path segment. Live-verified 2026-09-06 on the\n // streaming path (array `input`, SSE deltas), which is the ONLY path we\n // serve it on — see `kieCollapseStream` below. The non-stream reply does\n // carry `credits_consumed` (and cached_tokens/cache_write_tokens in usage)\n // on the ~1 call in 3 that returns one, but we no longer take that reply,\n // so provider cost here is the rate-table estimate.\n // KIE's codex/v1/responses injects its own Codex-agent `instructions`\n // prompt ABOVE the caller's `developer` message — observed in the\n // 2026-07-14 live probe of that endpoint, and unchanged for GPT-6. Budget\n // for it when a developer message has to dominate.\n kieSlugOrModel: \"gpt-6-astra\",\n vendor: \"openai\",\n // Live-verified 2026-09-06: `text.format: json_schema` is passed through\n // and ENFORCED — the server echoed `strict: true` and returned\n // schema-valid JSON.\n structuredOutputMode: \"responses-json-schema\",\n // text + image + file inputs per KIE's doc. No video/audio — see the\n // image-only LLM_MODALITY_CAPS row below.\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum for this endpoint. No `none` on purpose: the\n // endpoint reasons unconditionally (see thinkingDefaultOn below), so a\n // \"none\" level would be a lie the wire silently overrides.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\"],\n // Live-probed 2026-09-06: `temperature: 0.2` was sent and the request echo\n // stayed at 1.0 — silently IGNORED, so never send it. Same treatment as the\n // GPT-5.6 family and grok-4.6.\n supportsTemperature: false,\n // With NO reasoning param sent, the server echoed effort \"medium\" — it\n // reasons by default (2026-09-06), so reasoning tokens share `max_tokens`\n // on EVERY call, not just effort-bearing ones. Consumers must floor output\n // headroom off this flag or a premium answer truncates into a paid-for\n // empty reply.\n thinkingDefaultOn: true,\n // Measured 2026-09-06, 12 identical requests (developer + user message,\n // reasoning.effort low, text.format json_schema): `stream: false`\n // succeeded 2/6 in 4–5 s and 500'd 4/6 with\n // {\"error\":{\"type\":\"server_error\"}} after 34, 34, 35 and 64 s, while the\n // same body with `stream: true` succeeded 5/6 in the same 4–5 s. An\n // earlier non-stream probe timed out at 90 s with 0 bytes, and a\n // non-stream call WITHOUT a schema 500'd after 65 s — the schema is not\n // the trigger, the non-stream lane is. The very same endpoint serves\n // gpt-5.4/5.5/5.6 non-stream reliably (live-verified 2026-07-14), which is\n // why this is per-model and not a lane-wide flag.\n kieCollapseStream: true,\n },\n // ── GPT-6 Luna / Sol / 6.1 Sol ────────────────────────────────────────────\n // Same KIE endpoint and dialect as gpt-6-astra (codex/v1/responses; the doc\n // pages differ only in the model name). Live-probed 2026-10-08, per model:\n // `text.format` json_schema ENFORCED (echo `strict: true`, schema-valid\n // reply), `temperature: 0.2` echoed back as 1 → silently ignored, no\n // reasoning param → echo \"medium\" (reasons by default), and data-URI vision.\n // Unlike astra, the NON-stream lane served them reliably — luna 10/10 and sol\n // 10/10, 6.1 sol 8/8 at levels other than `none` (incl. 4 long structured\n // calls each, 500–1,500 output tokens) — so none of them is collapsed:\n // `credits_consumed` stays the real provider charge.\n // Their ladder is WIDER than astra's doc-enum one: `none` and `max` were each\n // sent and echoed back by the endpoint (6.1 sol excepted below).\n {\n id: \"gpt-6-luna\",\n displayName: \"GPT-6 Luna\",\n series: \"GPT\",\n desc: \"Fastest GPT-6, high-volume workloads\",\n tier: \"economy\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-6-luna\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n {\n id: \"gpt-6-sol\",\n displayName: \"GPT-6 Sol\",\n series: \"GPT\",\n desc: \"Strong GPT-6, deep reasoning at lower cost\",\n // Premium by decision (2026-10-08), not by unit cost — \"Sol\" is the\n // deep-reasoning rung of the family, and gpt-5.6-sol bills premium too.\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-6-sol\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n {\n id: \"gpt-6.1-sol\",\n displayName: \"GPT-6.1 Sol\",\n series: \"GPT\",\n // Measured slow: 30–76 s for 500–1,100 output tokens (2026-10-08), roughly\n // twice gpt-6-sol on the same request — say so where the picker shows it.\n desc: \"Newest GPT-6 Sol, thorough but slower\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"gpt-6-1-sol\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // NO `none`: every probe at `reasoning.effort: none` failed (502, a 120 s\n // timeout, 502, 429 — 0/4, 2026-10-08) while every other level answered,\n // and the same request at `none` succeeded on luna and sol. Clamping maps a\n // `none` request to nothing sent (Auto) rather than to a level that fails.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n {\n id: \"gpt-6.1-terra\",\n displayName: \"GPT-6.1 Terra\",\n series: \"GPT\",\n desc: \"Fast, efficient GPT-6.1, sharp visual reasoning\",\n tier: \"standard\",\n kieFormat: \"responses\",\n // The GPT-6 wire (codex/v1/responses, derived from `vendor`); KIE's doc is\n // 6.1 Sol's page with the name swapped and `none` added to the effort enum.\n // Live-probed 2026-11-12: non-stream 16/16, `text.format` json_schema\n // ENFORCED (asked for prose, it returned schema JSON with the enum\n // honoured), data-URI vision, SSE deltas. Unlike luna / sol / 6.1 sol it\n // reports REAL top-level `usage.input_tokens` — see `kieInputUntrusted` in\n // backend/src/lib/llm/kie-cost.ts.\n //\n // KIE's endpoint adds its own instructions to every call and counts them as\n // input. The hold and the estimate count them too\n // (backend/src/lib/pricing/llm-cost.ts, `llmLaneAddedInputTokens`). They\n // were several times larger with an effort sent on the morning of\n // 2026-11-12 and the same size either way by that afternoon, so its price\n // does not depend on the effort: not `effortPriced` (re-measure if KIE's\n // reported input jumps again).\n kieSlugOrModel: \"gpt-6-1-terra\",\n vendor: \"openai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // NO `none` (decided 2026-11-12): KIE answers it, but a `none` sent on the\n // wire is answered as an effort (it echoed `medium`) while reasoning no\n // more than Auto. Clamping maps a `none` request to nothing sent (Auto).\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // Same doc as 6.1 Sol: no temperature lever.\n supportsTemperature: false,\n // NO `thinkingDefaultOn`: with no effort sent (and at low / medium / high)\n // the probe reported 0 reasoning tokens; only xhigh (8) and max (27)\n // reasoned, and those already floor the cap (`raiseToReasoningFloor`).\n },\n {\n id: \"grok-4.6\",\n displayName: \"Grok 4.6\",\n series: \"Grok\",\n // Demoted 2026-10-08 when grok-4.7 registered — the flagship copy moved up.\n desc: \"Previous Grok, strong reasoning\",\n tier: \"standard\",\n kieFormat: \"responses\",\n // KIE serves Grok on the responses dialect under its own family path —\n // grok/v1/responses, NOT codex/v1/responses (llm-client derives the path\n // from `vendor`). Live-verified end-to-end 2026-08-18: array `input`,\n // `developer` system role, `input_image` URL vision, `text.format`\n // json_schema enforcement, SSE `response.output_text.delta` stream, and\n // `credits_consumed` actual-cost capture. (grok-4.5 was deferred 2026-07-13\n // because none of this was live; 4.6 is its activation.)\n kieSlugOrModel: \"grok-4-6\",\n vendor: \"xai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum, each level live-verified (echoed back) 2026-08-18.\n // No `none`: the endpoint reasons unconditionally (see thinkingDefaultOn).\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\"],\n // Live-probed 2026-08-18: `temperature` is silently IGNORED (request echo\n // stays at the 0.7 default), so never send it — same treatment as GPT-5.5+.\n supportsTemperature: false,\n // Reasons with NO reasoning param sent (effort defaults to \"low\" server-side\n // — a trivial probe spent 169 of 170 output tokens on reasoning), so every\n // call needs output headroom, not just xhigh.\n thinkingDefaultOn: true,\n },\n {\n id: \"grok-4.7\",\n displayName: \"Grok 4.7\",\n series: \"Grok\",\n desc: \"xAI flagship, strong reasoning\",\n tier: \"standard\",\n kieFormat: \"responses\",\n // Same grok/v1/responses family path and wire as grok-4.6 (the KIE doc\n // pages differ only in the model name). Live-probed 2026-10-08: non-stream\n // 6/6, `text.format` json_schema enforced, data-URI vision, SSE deltas.\n kieSlugOrModel: \"grok-4-7\",\n vendor: \"xai\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // 4.6's ladder. `none` is NOT honoured: the endpoint echoed it back as\n // \"minimal\" and still reasoned (33 of 35 output tokens), so offering it\n // would promise a lever the wire overrides.\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\"],\n // `temperature: 0.2` → echo stayed at the 0.7 default: ignored.\n supportsTemperature: false,\n // \"Capital of France\" with no reasoning param spent 310 of 311 output\n // tokens reasoning.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-sonnet-5\",\n displayName: \"Claude Sonnet 5\",\n series: \"Claude\",\n // Demoted 2026-10-08 when claude-sonnet-5.5 registered.\n desc: \"Previous Sonnet, near-Opus quality\",\n tier: \"standard\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-sonnet-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-sonnet-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n },\n {\n id: \"claude-sonnet-5.5\",\n displayName: \"Claude Sonnet 5.5\",\n series: \"Claude\",\n desc: \"Latest Sonnet, near-Opus quality at Sonnet cost\",\n tier: \"standard\",\n kieFormat: \"messages\",\n // KIE serves it on the Claude-native messages dialect under its plain id\n // (docs.kie.ai/market/claude/claude-sonnet-5-5.md — the page is\n // claude-opus-5's with the model name swapped). Live-probed 2026-10-08 on\n // the streaming wire: plain, effort, and forced/auto+strict tool calls all\n // answered.\n kieSlugOrModel: \"claude-sonnet-5-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n // Anthropic 400s a forced tool_choice on this model. KIE's proxy happened\n // to accept one in the probe, but the direct lane is where every\n // effort-bearing and every streamed structured call goes.\n supportsForcedToolChoice: false,\n conversationBoundThinking: true,\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-sonnet-5-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n // Anthropic rejects non-default sampling values on this model (KIE's proxy\n // accepted temperature: 0.2 in the probe; the direct lane is the contract).\n supportsTemperature: false,\n preferKie: true,\n // Adaptive thinking runs when no thinking param is sent (vendor default).\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-opus-4.8\",\n displayName: \"Claude Opus 4.8\",\n series: \"Claude\",\n desc: \"Previous-gen Opus, long-horizon work\",\n tier: \"premium\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-opus-4-8\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-4-8\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n },\n {\n id: \"claude-opus-5\",\n displayName: \"Claude Opus 5\",\n series: \"Claude\",\n // Demoted 2026-10-08 when claude-opus-5.5 registered.\n desc: \"Previous Opus, deep agentic reasoning\",\n tier: \"premium\",\n kieFormat: \"messages\",\n // KIE serves Opus 5 on the Claude-native messages dialect under the plain\n // id (docs.kie.ai/market/claude/claude-opus-5.md) — same path shape as\n // claude-opus-4-8 / claude-fable-5.\n kieSlugOrModel: \"claude-opus-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n // Opus 5 reasons with NO thinking param sent (vendor default flipped from\n // Opus 4.8/4.7) — so every call needs output headroom, not just xhigh/max.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-opus-5.5\",\n displayName: \"Claude Opus 5.5\",\n series: \"Claude\",\n // Positioned as Fable-class (decided 2026-10-08: offered wherever Fable is).\n desc: \"Latest Opus, frontier-class reasoning\",\n tier: \"premium\",\n kieFormat: \"messages\",\n // KIE plain id on the messages dialect (docs.kie.ai/market/claude/\n // claude-opus-5-5 — claude-opus-5's page with the name swapped).\n // Live-probed 2026-10-08 on the streaming wire (plain + effort); the KIE\n // Claude lane was erroring for claude-opus-5 too during the tool probes.\n kieSlugOrModel: \"claude-opus-5-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n // Forced tool_choice is a 400 on this model (vendor docs) — see the field.\n supportsForcedToolChoice: false,\n conversationBoundThinking: true,\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-opus-5-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n // Thinking cannot be turned off on this model at all (`disabled` is a 400\n // at every effort); with no effort sent it runs adaptive at the vendor's\n // `medium` default. Nothing on our wire sends `disabled`.\n thinkingDefaultOn: true,\n },\n {\n id: \"claude-fable-5\",\n displayName: \"Claude Fable 5\",\n series: \"Claude\",\n desc: \"Frontier Claude above Opus, hardest problems\",\n tier: \"premium\",\n kieFormat: \"messages\",\n kieSlugOrModel: \"claude-fable-5\",\n vendor: \"anthropic\",\n structuredOutputMode: \"anthropic-tool\",\n supportsImages: true,\n maxOutputTokens: 16384,\n directFallbackModel: \"claude-fable-5\",\n reasoningEfforts: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // KIE ignores Claude effort (measured 2026-10-08): an effort call runs direct and bills as Advanced.\n effortRequiresDirect: true,\n supportsTemperature: false,\n preferKie: true,\n // Thinking is always on (vendor docs: `disabled` is not supported), so it\n // shares the output cap on every call.\n thinkingDefaultOn: true,\n },\n // ── Moonshot / DeepSeek ───────────────────────────────────────────────────\n // Both on KIE's THIRD responses family path, openai/v1/responses (llm-client\n // derives it from `vendor`). KIE labels both pages \"Chat only — not adapted\n // for agent use\": fine for single (structured) completions, so neither may\n // back a tool-loop feature.\n {\n id: \"kimi-k3\",\n displayName: \"Kimi K3\",\n series: \"Kimi\",\n desc: \"Moonshot flagship, 1M context, careful reasoning\",\n tier: \"premium\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"kimi-k3\",\n vendor: \"moonshot\",\n // Live-probed 2026-10-08: `text.format` json_schema is ENFORCED — asked to\n // answer \"no json here\" in plain prose, it returned schema-shaped JSON.\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum. The endpoint accepted xhigh/none without error but\n // never echoes an effort back, so nothing beyond the doc is verifiable.\n reasoningEfforts: [\"low\", \"medium\", \"high\"],\n // Decided 2026-11-12: a request below `low` (`none`) is sent as `low`,\n // never as nothing — KIE runs Kimi at its highest level when no effort is\n // sent (K3.1 Pro's no-effort replies echoed `max`). Auto still sends nothing.\n effortBelowLowestSendsLowest: true,\n // The doc lists no `temperature` field at all.\n supportsTemperature: false,\n // \"Reasons by default\" per KIE's doc (its usage reports no reasoning-token\n // split, so this is the doc's word, not a measurement).\n thinkingDefaultOn: true,\n },\n {\n id: \"kimi-k3.1-pro\",\n displayName: \"Kimi K3.1 Pro\",\n series: \"Kimi\",\n desc: \"Kimi tuned for coding and research, 1M context\",\n tier: \"premium\",\n kieFormat: \"responses\",\n // Same openai/v1/responses family path and wire as kimi-k3 (KIE's doc is\n // K3's page with the name and the effort enum changed). Live-probed\n // 2026-11-12: non-stream 9/9, `text.format` json_schema ENFORCED (asked for\n // prose, it returned schema JSON with the enum honoured), data-URI vision,\n // real `usage.input_tokens` and `credits_consumed`. Its stream sends\n // `response.reasoning_text.delta` frames apart from the\n // `response.output_text.delta` ones, and only the latter are the answer.\n kieSlugOrModel: \"kimi-k3-1-pro\",\n vendor: \"moonshot\",\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n maxOutputTokens: 16384,\n // KIE's documented enum (K3's was low / medium / high). Each level was\n // echoed back. An off-enum `medium` answered too (echoed as `high`), so it\n // is not offered: a `medium` request clamps down to `low`.\n reasoningEfforts: [\"low\", \"high\", \"max\"],\n // Decided 2026-11-12: a request below `low` (`none`) is sent as `low`,\n // never as nothing — with no effort sent KIE runs it at `max` (the probe's\n // no-effort replies echoed `max`). Auto still sends nothing.\n effortBelowLowestSendsLowest: true,\n // The doc lists no `temperature` field at all, as K3's.\n supportsTemperature: false,\n // Measured: every probe call reported reasoning tokens (20 to 163), the\n // no-effort ones included (they echoed effort `max`).\n thinkingDefaultOn: true,\n },\n {\n id: \"deepseek-v4.1-flash\",\n displayName: \"DeepSeek V4.1 Flash\",\n series: \"DeepSeek\",\n desc: \"Very cheap and fast, solid reasoning\",\n tier: \"economy\",\n kieFormat: \"responses\",\n kieSlugOrModel: \"deepseek-v4-1-flash\",\n vendor: \"deepseek\",\n // Live-probed 2026-10-08: json_schema echoed `strict: true` and enforced.\n structuredOutputMode: \"responses-json-schema\",\n supportsImages: true,\n // ADVISORY ONLY: KIE documents `max_output_tokens` as \"not supported … no\n // effect\" on this model (a probe sending it was accepted and ignored), so\n // neither this cap nor the reasoning floor binds its output length, and the\n // `incomplete` cap-stop signal cannot fire from our own cap.\n maxOutputTokens: 16384,\n // The endpoint takes none/minimal/low/medium/high/xhigh/max; each of none,\n // low and xhigh was echoed back. `minimal` is not in our ladder.\n reasoningEfforts: [\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n // Documented \"not supported … no effect\".\n supportsTemperature: false,\n thinkingDefaultOn: true,\n },\n] as const\n\nexport const LLM_MODEL_IDS = LLM_MODELS.map((m) => m.id)\n\n/** True when the model is registered but retired (see `LlmModelDef.retired`). */\nexport function isLlmModelRetired(id: string): boolean {\n return getLlmModel(id)?.retired === true\n}\n\n/** The models a picker may OFFER: the registry minus retired entries. The\n * accepted set is still {@link LLM_MODEL_IDS}. */\nexport const PICKABLE_LLM_MODELS: readonly LlmModelDef[] = LLM_MODELS.filter((m) => !m.retired)\n\n/**\n * {@link PICKABLE_LLM_MODELS}, plus `currentId`'s own entry when it is a\n * retired model — for a plain select that has to keep showing a saved node's\n * value as selected. Registry order either way.\n */\nexport function pickableLlmModels(currentId?: string): LlmModelDef[] {\n return LLM_MODELS.filter((m) => !m.retired || m.id === currentId)\n}\n\n/** Vision models that can return GUARANTEED structured output — the\n * describe-to-picker analyzer forces a schema over an image, so its model\n * pickers AND the backend route gate offer exactly these: Anthropic (forced\n * tool), Gemini (KIE `response_format`), and GPT responses-format models\n * (KIE `text.format` json_schema — vision+schema live-verified 2026-07-14).\n * Single source of truth so the picker, the config panel, and the route gate\n * can't drift. */\nexport const STRUCTURED_VISION_MODELS = LLM_MODELS.filter(\n (m) => m.supportsImages && m.structuredOutputMode != null,\n)\n\n/**\n * How a structured call's schema goes on the wire for `model`: its trusted\n * `structuredOutputMode`, else its `structuredOutputHint`; undefined = the\n * schema is not sent at all (a model with neither: plain text, parsed and\n * re-asked). What the request builders read — never a TRUST decision, which\n * reads `structuredOutputMode` alone.\n */\nexport function structuredWireMode(\n model: Pick<LlmModelDef, \"structuredOutputMode\" | \"structuredOutputHint\">,\n): LlmModelDef[\"structuredOutputMode\"] {\n return model.structuredOutputMode ?? model.structuredOutputHint\n}\n\n/**\n * Does a structured call on `modelId` (unset = `feature`'s default model) put\n * its schema on the wire ({@link structuredWireMode})? What a request's size\n * counts the schema by — a schema that is not sent is not read by the model.\n * A model the registry does not know counts as yes (the larger size).\n */\nexport function llmSendsSchema(modelId: string | undefined, feature?: string): boolean {\n const id = modelId || (feature ? LLM_FEATURE_DEFAULTS[feature as LlmFeature] : undefined)\n const model = id ? getLlmModel(id) : undefined\n return !model || structuredWireMode(model) !== undefined\n}\n\n/**\n * Models {@link STRUCTURED_VISION_MODELS} carries that describe-to-picker does\n * NOT offer — now none.\n *\n * Claude Fable 5 was withheld here (production cost audit, 2026-10-20): a\n * legend-sized read cost far above every tier rung. Metered pricing charges\n * each read what it really costs (tokens × the model's rate on the lane that\n * served it), so nothing needs withholding and the set is empty.\n *\n * @deprecated Always empty since metered LLM pricing. Kept exported so existing\n * importers keep compiling; it will be removed in a future major.\n */\nexport const DESCRIBE_TO_PICKER_WITHHELD_MODELS: ReadonlySet<string> = new Set<string>()\n\n/**\n * The same (empty) set for the other legend-sized structured reads:\n * `POST /v1/text-to-picker` and `POST /v1/llm/structured`.\n *\n * @deprecated Always empty since metered LLM pricing; see\n * {@link DESCRIBE_TO_PICKER_WITHHELD_MODELS}.\n */\nexport const LLM_STRUCTURED_WITHHELD_MODELS: ReadonlySet<string> = DESCRIBE_TO_PICKER_WITHHELD_MODELS\n\n/**\n * The models describe-to-picker offers and accepts: the structured vision\n * models minus {@link DESCRIBE_TO_PICKER_WITHHELD_MODELS} (empty — every one). The ONE list the\n * route gate, the config panel and the quick strip read, so a model the route\n * refuses is never offered and a saved node naming one is snapped to the\n * default (the route answers it with a `validation_error`).\n */\nexport const DESCRIBE_TO_PICKER_MODELS = STRUCTURED_VISION_MODELS.filter(\n (m) => !DESCRIBE_TO_PICKER_WITHHELD_MODELS.has(m.id),\n)\n\n/**\n * Vendor presentation order + labels for model pickers. Every LlmVendor MUST\n * appear in the order list (guarded by a registry test) so a new vendor can't\n * ship with its models silently sorted to the end of every menu unlabeled.\n * Alphabetical on purpose: stable, and no vendor-preference fights.\n */\nexport const LLM_VENDOR_ORDER: readonly LlmVendor[] = [\"anthropic\", \"deepseek\", \"google\", \"moonshot\", \"openai\", \"xai\"]\nexport const LLM_VENDOR_LABELS: Record<LlmVendor, string> = {\n anthropic: \"Anthropic\",\n deepseek: \"DeepSeek\",\n google: \"Google\",\n moonshot: \"Moonshot AI\",\n openai: \"OpenAI\",\n xai: \"xAI\",\n}\n\nconst TIER_RANK: Record<LlmTier, number> = { economy: 0, standard: 1, premium: 2 }\n\nexport interface LlmModelGroup {\n vendor: LlmVendor\n /** Display heading for the group (LLM_VENDOR_LABELS[vendor]). */\n label: string\n models: LlmModelDef[]\n}\n\n/**\n * The ONE ordering every LLM model menu renders: grouped by vendor (in\n * LLM_VENDOR_ORDER), and inside each group sorted economy → standard → premium\n * (registry order breaks ties, which keeps family generations adjacent).\n * A flat registry-order dump was genuinely hard to scan at 17 models — every\n * picker (config panel, quick strips, quick toolbar) derives from this so the\n * menus can't drift apart. Groups with no models (after `filter`) are omitted.\n * Retired models are never listed, whatever list is passed in: a menu offers\n * only what can be picked (a saved retired value is labelled by the caller).\n */\nexport function groupLlmModelsByVendor(models: readonly LlmModelDef[] = LLM_MODELS): LlmModelGroup[] {\n const groups: LlmModelGroup[] = []\n for (const vendor of LLM_VENDOR_ORDER) {\n const members = models\n .filter((m) => m.vendor === vendor && !m.retired)\n .sort((a, b) => TIER_RANK[a.tier] - TIER_RANK[b.tier])\n if (members.length > 0) groups.push({ vendor, label: LLM_VENDOR_LABELS[vendor], models: members })\n }\n return groups\n}\n\n/** {@link groupLlmModelsByVendor} flattened — for menus that can't render\n * group headers (e.g. the compact node quick strips) but should still read\n * vendor-clustered and tier-ordered. */\nexport function orderedLlmModels(models: readonly LlmModelDef[] = LLM_MODELS): LlmModelDef[] {\n return groupLlmModelsByVendor(models).flatMap((g) => g.models)\n}\n\nexport type LlmFeature =\n | \"ai-writer\"\n | \"llm-chat\"\n | \"prompt-helper\"\n | \"scene-graph-ai\"\n | \"after-effects\"\n | \"motion-graphics\"\n | \"motion-graphics-lottie\"\n | \"lottie-overlay\"\n | \"3d-title\"\n // Scene3D previz authoring — generate-3d-scene AND edit-3d-scene share one\n // feature: both send the model a scene (the edit sends the WHOLE plan in) and\n // both get back structured geometry, so the token profile is the same shape.\n // The deterministic edit lane never reaches an LLM and bills the separate\n // zero-cost `3d-scene-ops` identifier instead.\n | \"3d-scene\"\n | \"image-to-text\"\n // Per-ad creative analysis on the social scraper nodes (Meta Ads first):\n // one structured vision call per ad, priced per REQUESTED ad by tier and\n // folded into the scrape's own identifier (packages/shared/meta-ads-scrape).\n | \"meta-ads-analysis\"\n | \"describe-to-picker\"\n | \"qa-check\"\n | \"generate-script\"\n | \"translate\"\n | \"image-critic\"\n // Choose Best (reduce) — the pick-best-llm strategy's judge. Its own\n // feature (not ai-writer, which it used to piggyback on) so the model\n // default and the tiered credit ids are the strategy's own.\n | \"pick-best-llm\"\n // In-app Workflow Copilot turns (backend agent loop; metered, reservation\n // ceiling under `STATIC_CREDIT_COSTS[\"workflow-copilot\"]`).\n | \"workflow-copilot\"\n // \"Steal the format\": Content Recipe (why a post worked, one structured\n // call over its analysis) and Content Ideas (recipes + brand → ideas, a\n // call per five ideas). Cloud-only; the implementation is a private plugin.\n // Ideas are priced per batch of five — see content-recipe-ideas.ts.\n | \"content-recipe\"\n | \"content-ideas\"\n\n/** Engine-dependent LlmFeature for the motion-graphics node (design §8: every credit-id site must branch on engine). */\nexport function motionGraphicsFeature(engine?: string): LlmFeature {\n return engine === \"lottie\" ? \"motion-graphics-lottie\" : \"motion-graphics\"\n}\n\n/** Feature → default model when user hasn't selected one */\nexport const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {\n \"ai-writer\": \"claude-sonnet-5.5\",\n \"llm-chat\": \"gemini-3.6-flash\",\n \"prompt-helper\": \"gemini-3.6-flash\",\n \"scene-graph-ai\": \"claude-sonnet-5.5\",\n \"after-effects\": \"claude-sonnet-5.5\",\n \"motion-graphics\": \"claude-sonnet-5.5\",\n \"motion-graphics-lottie\": \"claude-sonnet-5.5\",\n \"lottie-overlay\": \"claude-sonnet-5.5\",\n \"3d-title\": \"claude-sonnet-5.5\",\n \"3d-scene\": \"claude-sonnet-5.5\",\n \"image-to-text\": \"claude-sonnet-5.5\",\n // Economy on purpose: the analysis reads ONE frame + the copy per ad and\n // runs once per returned ad — volume, not depth. Must stay an image-capable\n // structured-output model (STRUCTURED_VISION_MODELS); a registry test pins it.\n \"meta-ads-analysis\": \"gemini-3.6-flash\",\n // Economy by decision (2026-10-20, from a production cost audit): the\n // analyzer's legend-sized prompt made the former default, Opus 5.5 at high\n // on Anthropic's own API, the platform's most expensive read per run. Gemini\n // 3.8 Flash reads it on the aggregator at the cheapest rung; Opus 5.5 at\n // high stays available by choice (LLM_FEATURE_DEFAULT_EFFORTS). Still an\n // image-capable structured model (DESCRIBE_TO_PICKER_MODELS) — a registry\n // test pins it.\n \"describe-to-picker\": \"gemini-3.8-flash\",\n \"qa-check\": \"gemini-3.6-flash\",\n \"generate-script\": \"gemini-3.6-flash\",\n \"translate\": \"gemini-3.6-flash\",\n \"image-critic\": \"claude-sonnet-5.5\",\n \"pick-best-llm\": \"claude-sonnet-5.5\",\n \"workflow-copilot\": \"claude-sonnet-5\",\n // Both economy on purpose — measured: ten ideas in Hebrew took ~1 min here\n // and ~3.5 min (two calls) on claude-sonnet-4.6. The private plugin keeps\n // the same two defaults for API callers that omit the model.\n \"content-recipe\": \"gemini-3.6-flash\",\n \"content-ideas\": \"gemini-3.6-flash\",\n}\n\n/**\n * Billed features with no defaults of their own → the feature whose defaults\n * (model, {@link LLM_FEATURE_DEFAULT_EFFORTS} effort) their route borrows:\n * Generate Structured runs on Generate Text's, Text to Picker on Describe to\n * Picker's, the Choose Best judge on `pick-best-llm`'s. Read it through\n * {@link llmDefaultsFeature}. Structure only — no prices.\n */\nexport const LLM_FEATURE_DEFAULTS_FROM: Readonly<Record<string, LlmFeature>> = {\n \"llm-structured\": \"llm-chat\",\n \"text-to-picker\": \"describe-to-picker\",\n \"reduce:pick-best-llm\": \"pick-best-llm\",\n}\n\n/** The feature whose defaults a call of `feature` runs with: its {@link LLM_FEATURE_DEFAULTS_FROM} entry, else itself. */\nexport function llmDefaultsFeature(feature: string): string {\n return Object.hasOwn(LLM_FEATURE_DEFAULTS_FROM, feature) ? LLM_FEATURE_DEFAULTS_FROM[feature]! : feature\n}\n\n/**\n * The model describe-to-picker re-asks ONCE when a Claude analyzer could not\n * answer for a platform-side reason: its direct lane down or the platform's\n * account refused, and the KIE retry of the same Claude model failing too,\n * answering with nothing valid, or answering empty. KIE's Claude endpoint\n * drops images when tools are sent, so that retry is the weak leg; see\n * backend/src/lib/llm/kie-lane.ts.\n *\n * Gemini because a Claude outage does not touch it: another vendor, on its\n * own lanes. Must stay an image-capable structured-output model\n * (STRUCTURED_VISION_MODELS — a registry test pins it); the route charges an\n * answer from it at this model's own credit price.\n */\nexport const DESCRIBE_TO_PICKER_FALLBACK_MODEL = \"gemini-3.8-flash\"\n\n/**\n * Feature → ONE model with a recipe: the reasoning effort it runs at on that\n * feature when the caller sends none. Read it through\n * {@link defaultReasoningEffort}, never directly: the effort belongs to that\n * model, so a call on any other model — the feature's default included, when\n * it is a different model — must not pick it up.\n */\nexport const LLM_FEATURE_DEFAULT_EFFORTS: Partial<Record<LlmFeature, { model: string; effort: LlmReasoningEffort }>> = {\n // Decided 2026-10-09 from the picker bake-off v2: Opus 5.5 at `high` read\n // 4/4 portraits with the most attributes per image, ~9 s a read. Its effort\n // only takes effect on Anthropic's own API (`effortRequiresDirect`), so a\n // read on it runs direct — and bills as such (`llmServesDirect`). It was the\n // feature's default model until 2026-10-20 (see LLM_FEATURE_DEFAULTS); the\n // recipe stays with the model, so choosing Opus 5.5 still reads at high.\n \"describe-to-picker\": { model: \"claude-opus-5.5\", effort: \"high\" },\n}\n\n/**\n * The reasoning effort a `feature` call runs at when the caller sends none:\n * the recipe effort ({@link LLM_FEATURE_DEFAULT_EFFORTS}), but ONLY while the\n * call runs on the recipe's model — named, or reached because the model was\n * omitted (`undefined` / `\"\"`) and it is the feature's default. A caller on\n * any other model with no effort gets `undefined`: that model's Auto.\n *\n * WHY only on that model: the effort is part of that model's recipe, not a\n * feature policy. Forcing `high` on a Gemini or GPT call that never asked for\n * it would change the timing of every existing workflow that picked one (and,\n * on a Claude model, its lane and its bill) — which is also why the feature's\n * default model gets it only when it IS the recipe's model.\n *\n * The one place the route, the node's credit badge and its effort pickers\n * read, so what runs, what is billed and what is shown cannot disagree.\n */\nexport function defaultReasoningEffort(feature: string, modelId?: string): LlmReasoningEffort | undefined {\n const recipe = LLM_FEATURE_DEFAULT_EFFORTS[feature as LlmFeature]\n if (!recipe) return undefined\n const effective = modelId || LLM_FEATURE_DEFAULTS[feature as LlmFeature]\n return getLlmModel(effective)?.id === recipe.model ? recipe.effort : undefined\n}\n\n/**\n * Per-model multimodal input capabilities. Drives both frontend UI gating\n * and backend route-level filtering for the LLM Chat node references.\n *\n * As of 2026-05: Claude Messages API supports text + image only (no audio,\n * no video). Gemini 2/3 family supports image + video + audio natively.\n * GPT-5.x via KIE chat-completions / responses supports image only — audio\n * input requires a separate audio-capable model we don't route to today.\n */\nexport const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean; audio: boolean }> = {\n \"gemini-3-flash\": { image: true, video: true, audio: true },\n \"gemini-3.6-flash\": { image: true, video: true, audio: true },\n // gemini-3.7-flash is IMAGE-ONLY by DECISION, not omission: full video+audio\n // caps would auto-enroll it in VIDEO_ANALYSIS_LLM_MODELS (derived below) and\n // force a video-analysis tier + pricing decision that is deliberately\n // deferred while the smart-family A/B routes this model internally (#747).\n // Flip these two flags ONLY together with that VA-side decision.\n \"gemini-3.7-flash\": { image: true, video: false, audio: false },\n // gemini-3.8-flash is IMAGE-ONLY by DECISION, not omission — 3.7's rationale\n // exactly: full video+audio caps would auto-enroll it in\n // VIDEO_ANALYSIS_LLM_MODELS (derived below) and force a video-analysis tier +\n // pricing decision that stays deferred until the 3.8-vs-3.7 analysis A/B\n // concludes. Google's own 3.8 lane DOES understand video (agentic video, via\n // the Interactions API we don't wire) — which is precisely why withholding it\n // has to be a decision rather than a gap. Flip these two flags ONLY together\n // with that VA-side decision.\n \"gemini-3.8-flash\": { image: true, video: false, audio: false },\n \"gemini-3.1-pro\": { image: true, video: true, audio: true },\n // gemini-4-argon is IMAGE-ONLY by DECISION, not omission (decided 2026-10-17):\n // the model DOES read video and audio, but full caps would\n // auto-enroll it in VIDEO_ANALYSIS_LLM_MODELS (derived below) and force a\n // video-analysis tier + pricing decision. That waits on a Video Analysis\n // bake-off; flip these two flags ONLY together with its outcome.\n \"gemini-4-argon\": { image: true, video: false, audio: false },\n // gemini-4-carbon is IMAGE-ONLY for now, by decision (2026-11-12): the model\n // reads video and audio, but full caps would auto-enroll it in\n // VIDEO_ANALYSIS_LLM_MODELS (derived below). Its video + audio input comes in\n // a follow-up change that also decides its Video Analysis enrolment; flip\n // these two flags ONLY together with that.\n \"gemini-4-carbon\": { image: true, video: false, audio: false },\n \"claude-haiku-4.5\": { image: true, video: false, audio: false },\n \"claude-haiku-5.5\": { image: true, video: false, audio: false },\n \"claude-sonnet-4.6\": { image: true, video: false, audio: false },\n \"claude-opus-4.7\": { image: true, video: false, audio: false },\n \"gpt-5.2\": { image: true, video: false, audio: false },\n \"gpt-5.4\": { image: true, video: false, audio: false },\n \"gpt-5.5\": { image: true, video: false, audio: false },\n \"gpt-5.6-luna\": { image: true, video: false, audio: false },\n \"gpt-5.6-terra\": { image: true, video: false, audio: false },\n \"gpt-5.6-sol\": { image: true, video: false, audio: false },\n // KIE's GPT-6 doc lists text + image + file inputs only — no video, no audio.\n \"gpt-6-astra\": { image: true, video: false, audio: false },\n // Same KIE doc as astra: text + image + file inputs only.\n \"gpt-6-luna\": { image: true, video: false, audio: false },\n \"gpt-6-sol\": { image: true, video: false, audio: false },\n \"gpt-6.1-sol\": { image: true, video: false, audio: false },\n // KIE's doc also takes files (PDFs, documents); that input is not wired here.\n \"gpt-6.1-terra\": { image: true, video: false, audio: false },\n \"grok-4.6\": { image: true, video: false, audio: false },\n \"grok-4.7\": { image: true, video: false, audio: false },\n \"claude-sonnet-5\": { image: true, video: false, audio: false },\n \"claude-sonnet-5.5\": { image: true, video: false, audio: false },\n \"claude-opus-4.8\": { image: true, video: false, audio: false },\n \"claude-opus-5\": { image: true, video: false, audio: false },\n \"claude-opus-5.5\": { image: true, video: false, audio: false },\n \"claude-fable-5\": { image: true, video: false, audio: false },\n // KIE documents text + image input only for both.\n \"kimi-k3\": { image: true, video: false, audio: false },\n \"kimi-k3.1-pro\": { image: true, video: false, audio: false },\n \"deepseek-v4.1-flash\": { image: true, video: false, audio: false },\n}\n\n/** Capability lookup with safe default — unknown models get image-only. */\nexport function getLlmModalityCaps(modelId: string | undefined): { image: boolean; video: boolean; audio: boolean } {\n if (!modelId) return { image: true, video: false, audio: false }\n return LLM_MODALITY_CAPS[modelId] ?? { image: true, video: false, audio: false }\n}\n\n/**\n * Dash-form aliases resolve to their canonical dot-form ids. Several wire\n * contracts carry dash forms (`PIPELINE_PINNABLE_SCRIPT_LLMS`, provider slugs,\n * configs persisted before the id scheme settled), while `LLM_MODELS` keys the\n * canonical `major.minor` form — an exact-only lookup makes every such caller\n * throw \"Unknown LLM model\" at run time. Normalizing here (instead of editing\n * the enums) keeps stored configs and published-package consumers valid.\n */\nfunction dashAliasToCanonical(id: string): string {\n return id.replace(/-(\\d+)-(\\d+)$/, \"-$1.$2\")\n}\n\n/**\n * Retired provider slugs that still name a registered model — a model whose KIE\n * lane moved to another model's endpoint (`kieServedAs`) no longer carries its\n * old slug, but stored configs and job rows may.\n */\nconst LEGACY_PROVIDER_SLUGS: Readonly<Record<string, string>> = {\n \"gemini-3-7-flash-openai\": \"gemini-3.7-flash\",\n}\n\nexport function getLlmModel(id: string): LlmModelDef | undefined {\n const exact = LLM_MODELS.find((m) => m.id === id)\n if (exact) return exact\n const canonical = dashAliasToCanonical(id)\n if (canonical !== id) {\n const aliased = LLM_MODELS.find((m) => m.id === canonical)\n if (aliased) return aliased\n }\n const legacy = LEGACY_PROVIDER_SLUGS[id]\n if (legacy) return LLM_MODELS.find((m) => m.id === legacy)\n // Last resort: provider slugs double as historical aliases (e.g. the\n // dated Anthropic slugs, the `-preview`-suffixed Google ids) — accept any\n // model whose slug matches exactly, on either lane. A KIE slug borrowed\n // through `kieServedAs` belongs to the model that answers it, so the\n // borrower never matches on it — whatever the registry order.\n return LLM_MODELS.find(\n (m) =>\n (m.kieSlugOrModel === id && !m.kieServedAs) ||\n m.directFallbackModel === id ||\n m.directGeminiModel === id,\n )\n}\n\nexport function getLlmTier(id: string): LlmTier {\n return getLlmModel(id)?.tier ?? \"standard\"\n}\n\n/**\n * Effort levels this model actually accepts on the lane it will be served on.\n *\n * The two lanes do NOT offer the same ladder: the aggregator accepts a narrower\n * set than the vendor's own API does, which is one of the concrete things\n * Advanced mode buys. Kept as one lookup so the UI picker and the wire-side\n * clamp can never disagree about what's selectable.\n */\nexport function availableReasoningEfforts(\n modelId: string | undefined,\n advanced = false,\n): readonly LlmReasoningEffort[] {\n const model = getLlmModel(modelId ?? \"\")\n if (!model) return []\n if (advanced && supportsAdvancedMode(modelId)) {\n return model.directReasoningEfforts ?? model.reasoningEfforts ?? []\n }\n return model.reasoningEfforts ?? []\n}\n\n/**\n * Highest level the model supports that is ≤ the requested level; undefined =\n * treat as Auto. A request below the model's lowest level is dropped (Auto) —\n * except on a model that declares `effortBelowLowestSendsLowest`, where it is\n * sent as that lowest level. No request at all is always Auto.\n */\nexport function effectiveReasoningEffort(\n modelId: string | undefined,\n requested?: string,\n advanced = false,\n): LlmReasoningEffort | undefined {\n if (!requested || !(requested in EFFORT_RANK)) return undefined\n const levels = availableReasoningEfforts(modelId, advanced)\n if (!levels || levels.length === 0) return undefined\n const req = requested as LlmReasoningEffort\n let best: LlmReasoningEffort | undefined\n for (const l of levels) {\n if (EFFORT_RANK[l] <= EFFORT_RANK[req] && (best === undefined || EFFORT_RANK[l] > EFFORT_RANK[best])) best = l\n }\n if (best === undefined && getLlmModel(modelId ?? \"\")?.effortBelowLowestSendsLowest) return levels[0]\n return best\n}\n\n/**\n * Build a composite credit identifier for an LLM feature.\n * - economy tier → \"ai-writer:economy\"\n * - standard tier → \"ai-writer\" (no suffix — backward compatible)\n * - premium tier → \"ai-writer:premium\"\n * A reasoning effort of \"xhigh\" or \"max\" (after clamping to what the model\n * actually supports) bills one tier up (economy→standard, standard→premium;\n * premium stays premium). `high` is the Claude-family server default and\n * never bumps.\n */\n\n/**\n * The sampling defaults each LLM feature's route sends when Advanced mode is\n * OFF — and therefore the values its Advanced panel must seed the sliders with.\n *\n * SINGLE SOURCE because the two used to disagree: the routes hardcoded their\n * own literals while the toggle fell back to 0.7/2048, so the panel displayed\n * a temperature the run never used, and one arrow-key press on 3D Title's Max\n * Tokens silently cut its budget from 3072 to 2048 on a node that emits\n * structured JSON.\n *\n * `structuredOutput` marks the features whose prompt asks the model for JSON —\n * a high temperature measurably degrades schema adherence there, so the panel\n * warns. Absent `temperature` means the route sends none (vendor default).\n */\nexport interface LlmRouteDefaults {\n temperature?: number\n maxTokens?: number\n structuredOutput?: true\n}\n\nexport const LLM_ROUTE_DEFAULTS: Record<string, LlmRouteDefaults> = {\n \"llm-chat\": { temperature: 0.7, maxTokens: 8192 },\n \"ai-writer\": { temperature: 0.7, maxTokens: 8192 },\n \"prompt-helper\": { temperature: 0.7, maxTokens: 8192, structuredOutput: true },\n \"generate-script\": { maxTokens: 16384, structuredOutput: true },\n \"qa-check\": { maxTokens: 1024, structuredOutput: true },\n \"image-critic\": { maxTokens: 1024, structuredOutput: true },\n \"image-to-text\": { maxTokens: 1024 },\n \"describe-to-picker\": { structuredOutput: true },\n \"scene-graph-ai\": { temperature: 0.3, maxTokens: 4096, structuredOutput: true },\n \"after-effects\": { temperature: 0.3, maxTokens: 2048, structuredOutput: true },\n \"lottie-overlay\": { temperature: 0.3, maxTokens: 2048, structuredOutput: true },\n \"motion-graphics\": { temperature: 0.3, maxTokens: 2048, structuredOutput: true },\n \"motion-graphics-lottie\": { temperature: 0.3, maxTokens: 8192, structuredOutput: true },\n \"3d-title\": { temperature: 0.4, maxTokens: 3072, structuredOutput: true },\n // A 100-object plan with keyframe tracks is the biggest structured payload\n // any composer feature emits — 3072 (3d-title's cap) truncates it mid-array.\n \"3d-scene\": { temperature: 0.3, maxTokens: 8192, structuredOutput: true },\n}\n\n/** Route defaults for a feature; `{}` for an unknown one. */\nexport function llmRouteDefaults(feature: string | undefined): LlmRouteDefaults {\n return (feature && LLM_ROUTE_DEFAULTS[feature]) || {}\n}\n\n/** One step up the economy → standard → premium ladder. Premium is the ceiling. */\nfunction bumpTier(tier: LlmTier): LlmTier {\n if (tier === \"economy\") return \"standard\"\n if (tier === \"standard\") return \"premium\"\n return tier\n}\n\n/**\n * Can this model be run in Advanced mode?\n *\n * Advanced mode pins the call to the vendor's own API, which is the only lane\n * where sampling levers (`temperature`, `maxTokens`) and the full effort range\n * actually take effect. Capability-derived from the registry — a model without\n * a direct lane simply cannot offer it, so UI and routes both gate on this\n * rather than on a hand-maintained model list.\n */\nexport function supportsAdvancedMode(modelId: string | undefined): boolean {\n const model = modelId ? getLlmModel(modelId) : undefined\n return Boolean(model?.directGeminiModel || model?.directFallbackModel)\n}\n\n/** User-facing reason a model can't offer Advanced mode. Single-sourced so the\n * config panel's disabled hint and the route's 400 say the same thing. */\nexport const ADVANCED_MODE_UNAVAILABLE_REASON =\n \"Advanced mode is available on Gemini and Claude models — switch the model to enable it.\"\n\n/**\n * Is this call served on the vendor's own API — and therefore billed as such?\n *\n * The rule (decided 2026-10-08): a call is priced on the lane it runs on.\n * It runs direct when Advanced mode is on, when the model is served nowhere\n * else (`directOnly`), or when it carries a reasoning effort on a model whose\n * effort only works there (`effortRequiresDirect` — the Claude family).\n * Everything else runs on the aggregator at its price,\n * falling back to the vendor's API only if the aggregator fails (at no extra\n * charge).\n *\n * The SINGLE decision both the credit identifier and the LLM client's routing\n * read, so what is billed and where it runs cannot disagree. Ignores a stale\n * `advancedMode` on a model with no direct lane, like the bump always has.\n */\nexport function llmServesDirect(\n modelId: string | undefined,\n reasoningEffort?: string,\n advancedMode?: boolean,\n): boolean {\n if (!supportsAdvancedMode(modelId)) return false\n if (advancedMode || getLlmModel(modelId!)?.directOnly) return true\n return Boolean(\n getLlmModel(modelId!)?.effortRequiresDirect && effectiveReasoningEffort(modelId, reasoningEffort) !== undefined,\n )\n}\n\n/**\n * The price key of a metered LLM call — what a client asks\n * `POST /v1/credits/model-costs` (or `GET /v1/credits/model-cost?model=`) for\n * the call's estimated price: `<feature>:<modelId>`, plus `:direct` when the\n * call is served on the vendor's own API ({@link llmServesDirect}), which is\n * priced at the direct rate, or — on a model whose price depends on the effort\n * (`effortPriced`, served on the aggregator) — `:effort-<level>` naming the\n * effort the call sends. On every other model the effort changes the key only\n * through its lane. Read back by {@link parseLlmPriceKeyModel}.\n *\n * With no `reasoningEffort` the default effort of the feature the call\n * borrows its defaults from applies ({@link llmDefaultsFeature},\n * {@link defaultReasoningEffort}) — the effort the call then runs at — so the\n * key names the lane (and, where it matters, the effort) the call is held and\n * charged on.\n *\n * `modelId` must already be resolved: the model the call runs on, never empty\n * (a caller with no model passes the feature's default, `LLM_FEATURE_DEFAULTS`\n * of {@link llmDefaultsFeature}). An empty id throws a `TypeError`.\n */\nexport function llmPriceKey(\n feature: string,\n modelId: string,\n reasoningEffort?: string,\n advancedMode?: boolean,\n): string {\n if (!modelId) throw new TypeError(`llmPriceKey: modelId must be a resolved model id (feature \"${feature}\")`)\n const effort = reasoningEffort ?? defaultReasoningEffort(llmDefaultsFeature(feature), modelId)\n if (llmServesDirect(modelId, effort, advancedMode)) return `${feature}:${modelId}${LLM_PRICE_KEY_DIRECT}`\n // A model whose price depends on the effort (`effortPriced`) names the one\n // the call sends — clamped as the aggregator's wire clamps it, so a level it\n // does not offer is the effort that is really sent (or none). Every other\n // model's key is unchanged.\n const sent = getLlmModel(modelId)?.effortPriced ? effectiveReasoningEffort(modelId, effort) : undefined\n return sent ? `${feature}:${modelId}${LLM_PRICE_KEY_EFFORT}${sent}` : `${feature}:${modelId}`\n}\n\n/** The price-key suffix of a call served on the vendor's own API (see {@link llmPriceKey}). */\nexport const LLM_PRICE_KEY_DIRECT = \":direct\"\n/** The price-key suffix naming the effort a call sends, on an `effortPriced` model: `:effort-<level>`. */\nexport const LLM_PRICE_KEY_EFFORT = \":effort-\"\n\n/** A price key's model part, read back by {@link parseLlmPriceKeyModel}. */\nexport interface LlmPriceKeyModel {\n modelId: string\n /** Present only for a key that names the direct lane. */\n lane?: \"direct\"\n /** Present only for a key that names an effort (an `effortPriced` model's). */\n reasoningEffort?: LlmReasoningEffort\n}\n\nconst REGISTRY_MODEL_IDS: ReadonlySet<string> = new Set(LLM_MODEL_IDS)\n\n/**\n * The part of a price key after its `<feature>:` — `<modelId>`,\n * `<modelId>:direct` or `<modelId>:effort-<level>` — read back, or null for\n * anything that is not a key {@link llmPriceKey} could build: a model that is\n * not a registry id (never a borrowed slug), an effort on a model whose price\n * does not depend on it, a level it does not offer on the aggregator, any\n * other suffix. The one reader both the server and the editor use, so every\n * key names exactly one price.\n */\nexport function parseLlmPriceKeyModel(tail: string): LlmPriceKeyModel | null {\n if (REGISTRY_MODEL_IDS.has(tail)) return { modelId: tail }\n if (tail.endsWith(LLM_PRICE_KEY_DIRECT)) {\n const modelId = tail.slice(0, -LLM_PRICE_KEY_DIRECT.length)\n return REGISTRY_MODEL_IDS.has(modelId) ? { modelId, lane: \"direct\" } : null\n }\n const at = tail.lastIndexOf(LLM_PRICE_KEY_EFFORT)\n if (at <= 0) return null\n const modelId = tail.slice(0, at)\n const level = tail.slice(at + LLM_PRICE_KEY_EFFORT.length) as LlmReasoningEffort\n const model = REGISTRY_MODEL_IDS.has(modelId) ? getLlmModel(modelId) : undefined\n if (!model?.effortPriced || !availableReasoningEfforts(modelId).includes(level)) return null\n return { modelId, reasoningEffort: level }\n}\n\n/**\n * The credit rungs an LLM feature bills on, cheapest first. `premium-direct` is\n * reached only by a premium model served direct (decided 2026-10-08): the bump\n * for running direct moves one rung on THIS ladder, so a premium model has\n * somewhere to go. The effort bump keeps the three-rung ladder.\n */\nexport const LLM_CREDIT_RUNGS = [\"economy\", \"standard\", \"premium\", \"premium-direct\"] as const\nexport type LlmCreditRung = (typeof LLM_CREDIT_RUNGS)[number]\n\n/** The credit identifier for `feature` on one rung — the standard rung is the bare feature id. */\nexport function llmCreditIdForRung(feature: string, rung: LlmCreditRung): string {\n return rung === \"standard\" ? feature : `${feature}:${rung}`\n}\n\n/** Every credit identifier a tier-priced LLM feature can bill under, in rung order. */\nexport function llmTierCreditIds(feature: string): string[] {\n return LLM_CREDIT_RUNGS.map((rung) => llmCreditIdForRung(feature, rung))\n}\n\nexport function buildLlmCreditIdentifier(\n feature: string,\n modelId?: string,\n reasoningEffort?: string,\n advancedMode?: boolean,\n): string {\n if (!modelId) return feature\n return llmCreditIdForRung(feature, llmCreditRung(modelId, reasoningEffort, advancedMode))\n}\n\n/**\n * The rung a call on `modelId` bills on — the half of\n * {@link buildLlmCreditIdentifier} a feature with its own id shape reads (the\n * social scrapers' per-post analysis), so its rung cannot drift from the LLM\n * features'.\n */\nexport function llmCreditRung(modelId: string, reasoningEffort?: string, advancedMode?: boolean): LlmCreditRung {\n let tier = getLlmTier(modelId)\n const eff = effectiveReasoningEffort(modelId, reasoningEffort)\n if (eff !== undefined && EFFORT_TIER_BUMP.has(eff)) tier = bumpTier(tier)\n // A call served on the vendor's own API (Advanced mode, a directOnly model,\n // or an effort on a model whose effort only works there — llmServesDirect)\n // bills materially more per token than the aggregator. It bumps\n // INDEPENDENTLY of the effort bump — the two are separate cost levers and\n // genuinely stack, so a max-effort advanced economy call lands at premium —\n // and on the four-rung ladder, so a premium model served direct lands at\n // `premium-direct`. A stale flag on a model with no direct lane never\n // inflates a bill.\n return llmServesDirect(modelId, reasoningEffort, advancedMode) ? bumpToDirectRung(tier) : tier\n}\n\n/** One rung up the four-rung ladder — the direct-lane bump. */\nfunction bumpToDirectRung(tier: LlmTier): LlmCreditRung {\n return tier === \"premium\" ? \"premium-direct\" : bumpTier(tier)\n}\n\n/**\n * Resolve llmModel (+ reasoningEffort, advancedMode) from raw body for the\n * creditGuard preHandler (before Zod parsing). Returns the credit identifier\n * for the given feature.\n */\nexport function resolveLlmCreditId(feature: string, body: unknown): string {\n const b = body as Record<string, unknown> | undefined\n return buildLlmCreditIdentifier(\n feature,\n b?.llmModel as string | undefined,\n b?.reasoningEffort as string | undefined,\n b?.advancedMode === true,\n )\n}\n\n/** Models capable of video-analysis: capability-derived, never hand-listed (route-enum-sync convention). */\nexport const VIDEO_ANALYSIS_LLM_MODELS: string[] = LLM_MODELS\n .filter((m) => getLlmModalityCaps(m.id).video && getLlmModalityCaps(m.id).audio)\n .map((m) => m.id)\n\n/**\n * Video-analysis quality TIERS — the ONLY analyzer identifiers exposed to users\n * (API, UI, docs). Each maps to an internal analysis model; the underlying\n * vendor/model name is never surfaced. Default is `pro`. The guard test\n * (video-analysis-pricing.test.ts) asserts every tier target is a real\n * VIDEO_ANALYSIS_LLM_MODELS member AND every such model is reachable by a tier,\n * so adding a video model forces a tier decision instead of silently leaking.\n */\nexport const VIDEO_ANALYSIS_TIERS = { fast: \"gemini-3-flash\", pro: \"gemini-3.1-pro\" } as const\nexport type VideoAnalysisModelTier = keyof typeof VIDEO_ANALYSIS_TIERS\n/**\n * Models that PREVIOUSLY backed a tier, mapped to the tier they backed.\n * They stay video+audio-capable (so they remain in VIDEO_ANALYSIS_LLM_MODELS):\n * stored raw `llmModel` values keep resolving via the passthrough in\n * `resolveVideoAnalysisModel` and keep pricing under their own credit family —\n * but no tier reaches them for NEW runs. UIs use this map to reverse a stored\n * raw id to the tier the user originally chose (video-configs fail-safe).\n * The tier guard test requires every video-capable model to be a tier target\n * OR a key here, so replacing a tier's backing model stays an explicit,\n * two-sided decision.\n */\nexport const VIDEO_ANALYSIS_LEGACY_MODELS: Record<string, VideoAnalysisModelTier> = {\n // Backed the fast tier from 2026-07 until 2026-07-29, when the economy tiers\n // moved to the cheaper lane and the older, cheaper flash. It is now the engine\n // behind the `smart` tier — but `smart` is a SENTINEL that never exposes a model\n // id, so as far as this map is concerned it no longer backs a selectable tier and\n // belongs here: stored raw `llmModel` values keep resolving and keep pricing\n // under their own credit family.\n \"gemini-3.6-flash\": \"fast\",\n}\n/**\n * MIXED tiers — advanced multi-engine analysis plans whose identifier resolves\n * to an engine-plan SENTINEL consumed by the analysis engine, never to a single\n * model id. Two variants, same price (one shared `video-analysis:mixed:*`\n * credit family): `mixed` targets maximum result quality; `mixed-fast` targets\n * run-to-run output consistency. What each plan does internally is deliberately\n * NOT published here (Apache irrevocability; only the wire vocabulary below is\n * contract — the engine lives in the private analysis plugin).\n */\nexport const VIDEO_ANALYSIS_MIXED_TIERS = [\"mixed\", \"mixed-fast\", \"smart\"] as const\nexport type VideoAnalysisMixedTier = (typeof VIDEO_ANALYSIS_MIXED_TIERS)[number]\n/**\n * `smart` is an ENGINE-PLAN sentinel like the mixed tiers — it names a plan, not a\n * model — but it is a different SHAPE of plan, and the distinction is the whole\n * reason it exists as a separate tier rather than a repricing of the others.\n *\n * The economy tiers (`fast`, `pro`, `mixed`, `mixed-fast`) run several passes on\n * the cheaper proxied transport and vote. That transport is cheaper per token and\n * additionally does no deep reasoning, which is why they cost less — and also why\n * they are less accurate. `smart` is a HYBRID plan (2026-08-03 re-plan): one\n * native-transport skeleton pass with everything turned up, blended with several\n * economy-transport donor rolls, and the merged result is always refined —\n * `selectionMode` (the `choose`/`combine` toggle the other tiers expose) does not\n * apply to `smart`; it always applies the equivalent of `combine`.\n *\n * As with the mixed sentinels, what the plan does internally is deliberately not\n * published here; only the wire vocabulary is contract.\n */\n/** UI/listing order — recommended (smart) first. */\nexport const VIDEO_ANALYSIS_TIER_ORDER = [\"smart\", \"pro\", \"fast\", \"mixed\", \"mixed-fast\"] as const\nexport type VideoAnalysisTier = (typeof VIDEO_ANALYSIS_TIER_ORDER)[number]\nexport const DEFAULT_VIDEO_ANALYSIS_TIER: VideoAnalysisTier = \"pro\"\nexport const DEFAULT_VIDEO_ANALYSIS_MODEL: string = VIDEO_ANALYSIS_TIERS[DEFAULT_VIDEO_ANALYSIS_TIER]\n/** Neutral, vendor-free display labels for the UI. */\nexport const VIDEO_ANALYSIS_TIER_LABELS: Record<VideoAnalysisTier, string> = {\n smart: \"Smart\",\n fast: \"Fast\",\n pro: \"Pro\",\n mixed: \"Mixed\",\n \"mixed-fast\": \"Mixed (consistent)\",\n}\n\nexport function isVideoAnalysisTier(v: string): v is VideoAnalysisTier {\n return (VIDEO_ANALYSIS_TIER_ORDER as readonly string[]).includes(v)\n}\n\nexport function isVideoAnalysisMixedTier(v: string): v is VideoAnalysisMixedTier {\n return (VIDEO_ANALYSIS_MIXED_TIERS as readonly string[]).includes(v)\n}\n\n/**\n * Resolve a user-supplied tier OR a raw internal model id to the analysis\n * ENGINE IDENTIFIER carried in the worker payload:\n * - model-backed tiers (\"fast\"/\"pro\") → the internal model id;\n * - mixed tiers (\"mixed\"/\"mixed-fast\") → the sentinel ITSELF (the engine\n * expands it to a multi-model roll plan);\n * - raw model ids pass through (back-compat for stored `llmModel` values);\n * - empty/unknown → the default tier's model (never an error).\n */\nexport function resolveVideoAnalysisModel(input?: string | null): string {\n if (input && isVideoAnalysisMixedTier(input)) return input\n if (input && Object.prototype.hasOwnProperty.call(VIDEO_ANALYSIS_TIERS, input)) {\n return VIDEO_ANALYSIS_TIERS[input as VideoAnalysisModelTier]\n }\n if (input && VIDEO_ANALYSIS_LLM_MODELS.includes(input)) return input\n return DEFAULT_VIDEO_ANALYSIS_MODEL\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/credit-identifiers.ts"],"names":["FLUX2_RES_MP","defaultResolutionFor","GPT_IMAGE_2_6_QUALITIES","GPT_IMAGE_2_6_DEFAULT_QUALITY","GPT_IMAGE_2_6_RESOLUTIONS","GPT_IMAGE_2_6_DEFAULT_RESOLUTION","isGptImage26I2i","T2I_TO_I2I_VARIANT","gptImage26PricedFormat","GPT_IMAGE_2_6_MAX_INPUT_IMAGES","seedream55Resolution","isSeedream55I2i","SEEDREAM_5_5_I2I","SEEDREAM_5_5_MAX_INPUT_IMAGES","isFlux2Model","isGptImage26Tiered","isMinimaxH3Image","minimaxH3ImageCreditId","isSeedream55","HIGH_QUALITY_PROVIDERS","TWO_K_RESOLUTION_PROVIDERS","RESOLUTION_2K_4K_TIERED_PROVIDERS","IDEOGRAM_PROVIDERS","autoAspectNeedsSourceImage","normalizeModelInput","snapToNearestDuration","pricedOutputDurationSec","isWan3Provider","normalizeWan3Resolution","isViduQ4Provider","normalizeViduQ4Resolution","isKling4Provider","normalizeKling4Resolution","isKling4FlashProvider","KLING_4_FLASH_RESOLUTION","isGrokVideo15Provider","normalizeGrokVideo15Resolution","isPixverseV6MaxProvider","normalizePixverseV6MaxQuality","canonicalVideoProvider","isTailExtendProvider","DURATION_PRICED_PROVIDERS","isVeoProvider","VEO_RESOLUTION_TIERED_PROVIDERS","isGeminiOmniProvider","isGeminiOmniPerSecondProvider","VIDEO_DURATION_TIERS","MODE_ADDON_PROVIDERS","RESOLUTION_VIDEO_REF_PRICING","MODEL_CATALOG","PRICING_DEFAULT_RESOLUTION","RESOLUTION_DURATION_PRICING","VIDEO_REF_RATE_PROVIDERS","isMinimaxH3Provider","normalizeMinimaxH3Resolution","AUDIO_ADDON_PROVIDERS","videoAudioPricedOn","normalizeVideoRequestParams","uiResolutionFill","VIDEO_DURATION_AUTO","MOTION_DURATION_TIERS"],"mappings":";;;;;;;;AAkGA,SAAS,kBAAA,CAAmB,OAAmB,UAAA,EAA6B;AAC1E,EAAA,MAAM,IAAA,GAAO,CAAC,CAAA,KAAc,CAAA,CAAE,QAAQ,SAAA,EAAW,EAAE,EAAE,IAAA,EAAK;AAC1D,EAAA,MAAM,MAAM,OAAO,UAAA,KAAe,QAAA,GAAW,IAAA,CAAK,UAAU,CAAA,GAAI,EAAA;AAChE,EAAA,IAAI,GAAA,KAAQ,IAAI,OAAO,GAAA;AAIvB,EAAA,MAAM,IAAA,GAAOA,8BAAA,CAAa,IAAA,CAAK,CAAC,CAAA,KAAM,OAAO,CAAC,CAAA,KAAM,MAAA,CAAO,GAAG,CAAC,CAAA;AAC/D,EAAA,OAAO,IAAA,IAAQ,IAAA,CAAKC,sCAAA,CAAqB,KAAK,KAAK,MAAM,CAAA;AAC3D;AAoBA,SAAS,kBAAA,CACP,QAAA,EACA,OA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AA,EAAqC;AACzF,EAAA,MAAM,QAAQ,OAAA,KAAY,OAAA;AAC1B,EAAA,IAAI,IAAA,KAAS,UAAA,EAAY,OAAO,KAAA,GAAQ,oBAAA,GAAuB,cAAA;AAC/D,EAAA,OAAO,QAAQ,4BAAA,GAA+B,sBAAA;AAChD;AAkBO,SAAS,cAAA,CAAe,OAA2B,SAAA,EAA2B;AACnF,EAAA,IAAI,CAAE,8BAAA,CAAqD,QAAA,CAAS,SAAS,CAAA,EAAG;AAC9E,IAAA,OAAO,SAAA;AAAA,EACT;AACA,EAAA,OAAQ,KAAA,IAAS,wBAAA,CAAyB,KAAK,CAAA,IAAM,SAAA;AACvD;AAUO,IAAM,wBAAA,GAA6D;AAAA,EACxE,EAAA,EAAI,SAAA;AAAA,EACJ,OAAA,EAAS,cAAA;AAAA,EACT,OAAA,EAAS,cAAA;AAAA,EACT,IAAA,EAAM,WAAA;AAAA,EACN,EAAA,EAAI;AACN","file":"chunk-GMBDLNLD.cjs","sourcesContent":["/**\n * Build composite credit model identifiers for variable pricing.\n * Shared between frontend and backend.\n */\n\nimport {\n HIGH_QUALITY_PROVIDERS,\n TWO_K_RESOLUTION_PROVIDERS,\n RESOLUTION_2K_4K_TIERED_PROVIDERS,\n IDEOGRAM_PROVIDERS,\n DURATION_PRICED_PROVIDERS,\n AUDIO_ADDON_PROVIDERS,\n MODE_ADDON_PROVIDERS,\n RESOLUTION_VIDEO_REF_PRICING,\n RESOLUTION_DURATION_PRICING,\n VEO_RESOLUTION_TIERED_PROVIDERS,\n VIDEO_DURATION_TIERS,\n pricedOutputDurationSec,\n snapToNearestDuration,\n PRICING_DEFAULT_RESOLUTION,\n MOTION_DURATION_TIERS,\n T2I_TO_I2I_VARIANT,\n isVeoProvider,\n isMinimaxH3Provider,\n isGeminiOmniProvider,\n isGeminiOmniPerSecondProvider,\n isWan3Provider,\n isViduQ4Provider,\n isKling4Provider,\n normalizeKling4Resolution,\n isKling4FlashProvider,\n KLING_4_FLASH_RESOLUTION,\n isGrokVideo15Provider,\n normalizeGrokVideo15Resolution,\n isPixverseV6MaxProvider,\n normalizePixverseV6MaxQuality,\n VIDEO_REF_RATE_PROVIDERS,\n normalizeMinimaxH3Resolution,\n normalizeWan3Resolution,\n normalizeViduQ4Resolution,\n videoAudioPricedOn,\n type VideoAudioRequest,\n canonicalVideoProvider,\n isTailExtendProvider,\n type SeedanceExtendProvider,\n type TailExtendProvider,\n} from \"./model-constants.js\"\nimport { isFlux2Model, FLUX2_RES_MP, type Flux2Model } from \"./flux2-pricing.js\"\nimport {\n GPT_IMAGE_2_6_DEFAULT_QUALITY,\n GPT_IMAGE_2_6_DEFAULT_RESOLUTION,\n GPT_IMAGE_2_6_MAX_INPUT_IMAGES,\n GPT_IMAGE_2_6_QUALITIES,\n GPT_IMAGE_2_6_RESOLUTIONS,\n gptImage26PricedFormat,\n isGptImage26I2i,\n isGptImage26Tiered,\n type GptImage26TieredModel,\n type ImageFormatLevers,\n} from \"./gpt-image-2-6.js\"\nimport { isMinimaxH3Image, minimaxH3ImageCreditId } from \"./minimax-h3-image.js\"\nimport {\n SEEDREAM_5_5_I2I,\n SEEDREAM_5_5_MAX_INPUT_IMAGES,\n isSeedream55,\n isSeedream55I2i,\n seedream55Resolution,\n type Seedream55Model,\n} from \"./seedream-5-5.js\"\nimport { VIDEO_DURATION_AUTO } from \"./video-duration-auto.js\"\nimport { uiResolutionFill } from \"./video-ui-defaults.js\"\nimport { MODEL_CATALOG, autoAspectNeedsSourceImage, normalizeModelInput, normalizeVideoRequestParams, defaultResolutionFor, type ModelInputAdjustment, type SourceImageSize } from \"./model-catalog.js\"\n\n/**\n * The megapixel tier a Flux 2 credit identifier is keyed on, for ANY incoming\n * `resolution` value.\n *\n * Flux 2 is the only family whose identifier INTERPOLATES the resolution\n * instead of matching it against a known set, and its callers are not\n * guaranteed to hand it a Flux 2 value:\n * - the multi-provider cost preview prices one node's data against EVERY\n * selected provider (`frontend/src/ee/hooks/use-providers-credits-sum.ts`),\n * so a node whose `resolution` is \"2K\" (the flux / nano-banana-pro value\n * space) reaches this branch verbatim;\n * - node data written straight into workflow JSON by an agent, an import or\n * a template never ran the config panel's provider-change fail-safe.\n * Interpolating that produced the off-grid id `flux-2-pro:2KMP:0ref`, which no\n * pricing row can answer — every cost badge 503'd `price_not_configured`\n * (18 production app-reports, 2026-09-07..14).\n *\n * A value off the grid snaps to the model's DEFAULT tier — the same `preferred`\n * value `normalizeModelInput` uses — so the preview asks for exactly the id the\n * route will reserve (both routes and the orchestrator normalize through\n * `resolveNormalizedImageGen` first, which makes this snap a no-op for them).\n * An ABSENT resolution keeps its long-standing meaning (\"this caller has no\n * resolution dimension at all\") and stays on 1 MP rather than moving to the\n * model default, which would silently re-price every resolution-less node.\n */\nfunction flux2MegapixelTier(model: Flux2Model, resolution?: string): string {\n const bare = (v: string) => v.replace(/\\s*MP$/i, \"\").trim()\n const raw = typeof resolution === \"string\" ? bare(resolution) : \"\"\n if (raw === \"\") return \"1\"\n // Numeric match so \"2.0\"/\" 2 MP\" land on the same grid point as \"2\", and the\n // GRID's own spelling is what gets emitted — returning the caller's \"2.0\"\n // would build \":2.0MP:\", another id no pricing row carries.\n const tier = FLUX2_RES_MP.find((t) => Number(t) === Number(raw))\n return tier ?? bare(defaultResolutionFor(model) ?? \"1 MP\")\n}\n\n/**\n * The price id of a GPT Image 2.6 Flare or Sunburst run: `<id>:<quality>:<size>`,\n * and on an edit `<id>:<quality>:<size>:<N>ref`, N being the input images.\n * PNG, JPEG and WebP cost the same, so they share those ids. Only a format that\n * prices differently adds a part of its own:\n * - a GIF takes no size (it is 512 pixels a frame) and is priced by its band\n * of frames: `<id>:<quality>:gif-<band>`, on an edit `…:gif-<band>:<N>ref`\n * (`gpt-image-2-6-flare:medium:gif-9-12`);\n * - an SVG is priced at its size and its level of detail:\n * `<id>:<quality>:<size>:svg-<level>`, on an edit `…:svg-<level>:<N>ref`\n * (`gpt-image-2-6-flare-i2i:high:2K:svg-detailed:3ref`).\n *\n * A value off the grid (a stored node, the multi-provider preview pricing one\n * node's data against every model) lands on the default rather than building\n * an id no row answers. A text-to-image id sent input images runs on the edit\n * endpoint, so a caller that does not swap the model first (the entity routes,\n * a pipeline pin) is priced there too. An edit always has at least its source.\n */\nfunction gptImage26CreditId(\n provider: GptImage26TieredModel,\n quality: string | undefined,\n resolution: string | undefined,\n referenceImageCount: number | undefined,\n imageFormat: ImageFormatLevers | undefined,\n): string {\n const q = (GPT_IMAGE_2_6_QUALITIES as readonly string[]).includes(quality ?? \"\") ? quality : GPT_IMAGE_2_6_DEFAULT_QUALITY\n const r = (GPT_IMAGE_2_6_RESOLUTIONS as readonly string[]).includes(resolution ?? \"\") ? resolution : GPT_IMAGE_2_6_DEFAULT_RESOLUTION\n const images = Math.trunc(referenceImageCount ?? 0)\n const model = !isGptImage26I2i(provider) && images > 0 ? T2I_TO_I2I_VARIANT[provider]! : provider\n const format = gptImage26PricedFormat(imageFormat)\n const base = format?.kind === \"gif\"\n ? `${model}:${q}:gif-${format.band}`\n : format?.kind === \"svg\"\n ? `${model}:${q}:${r}:svg-${format.level}`\n : `${model}:${q}:${r}`\n if (!isGptImage26I2i(model)) return base\n return `${base}:${Math.min(Math.max(1, images), GPT_IMAGE_2_6_MAX_INPUT_IMAGES)}ref`\n}\n\n/**\n * The price id of a Seedream 5.5 run: `seedream-5-5:<size>`, and on an edit\n * `seedream-5-5-i2i:<size>:<N>ref`, N being the input images (1 to 10). Each\n * size has its own id, 1K and 1.5K at the same price.\n *\n * A size off its list (a stored node, the multi-provider preview pricing one\n * node's data against every model) or none lands on the default, 2K, which is\n * what the provider renders with none. A text-to-image id sent input images\n * runs on the edit endpoint (the provider swaps it), so a caller that does not\n * swap the model first (the entity routes, a pipeline pin) is priced there too.\n * An edit always has at least its source, and is priced for at most the images\n * the provider takes (what a request holds past it is not sent).\n */\nfunction seedream55CreditId(\n provider: Seedream55Model,\n resolution: string | undefined,\n referenceImageCount: number | undefined,\n): string {\n const size = seedream55Resolution(resolution)\n const images = Math.trunc(referenceImageCount ?? 0)\n const model = !isSeedream55I2i(provider) && images > 0 ? SEEDREAM_5_5_I2I : provider\n if (!isSeedream55I2i(model)) return `${model}:${size}`\n return `${model}:${size}:${Math.min(Math.max(1, images), SEEDREAM_5_5_MAX_INPUT_IMAGES)}ref`\n}\n\n/**\n * Compute composite model identifier for variable credit pricing.\n * Examples: \"gpt-image:high\", \"flux:2K\", \"nano-banana-pro:4K\", \"ideogram:TURBO\",\n * \"flux-2-pro:2MP\", \"flux-2-max:2MP:1ref\" (Flux 2 — billed per megapixel).\n *\n * For image models, uses quality/resolution/renderingSpeed and (Flux 2) the output\n * megapixel count plus (Flux 2 Max) the number of reference images attached at request time.\n * For video models, uses duration/sound params when the model has variable pricing.\n */\nexport function buildCreditModelIdentifier(\n provider: string,\n quality?: string,\n resolution?: string,\n renderingSpeed?: string,\n targetResolution?: string,\n referenceImageCount?: number,\n /** The output format, a GIF's frames and an SVG's level: read only by a model whose price depends on them (GPT Image 2.6). */\n imageFormat?: ImageFormatLevers,\n): string {\n // Flux 2 family: billed per output megapixel AND per reference image (each\n // ref counts as input megapixels). Resolution arrives as \"N MP\" strings (the\n // UI value space); strip the unit. ALL three models encode the ref count\n // (capped at 8): Pro/Klein i2i always carry the source image as a ref and\n // their cost formula charges per input MP, so the reserved identifier must\n // reflect refs (there is no metered true-up to correct an under-reserved tier).\n if (isFlux2Model(provider)) {\n return `${provider}:${flux2MegapixelTier(provider, resolution)}MP:${Math.min(referenceImageCount ?? 0, 8)}ref`\n }\n if (isGptImage26Tiered(provider)) {\n return gptImage26CreditId(provider, quality, resolution, referenceImageCount, imageFormat)\n }\n // MiniMax H3 Image: by size, and on an edit by its reference images\n // (`minimax-h3-image:2K`, `minimax-h3-image-i2i:4K:3ref`).\n if (isMinimaxH3Image(provider)) {\n return minimaxH3ImageCreditId(provider, resolution, referenceImageCount)\n }\n if (isSeedream55(provider)) {\n return seedream55CreditId(provider, resolution, referenceImageCount)\n }\n if (HIGH_QUALITY_PROVIDERS.has(provider) && quality === \"high\") {\n return `${provider}:high`\n }\n if (TWO_K_RESOLUTION_PROVIDERS.has(provider) && resolution === \"2K\") {\n return `${provider}:2K`\n }\n if (provider === \"nano-banana-pro\" && resolution === \"4K\") {\n return `${provider}:4K`\n }\n if (RESOLUTION_2K_4K_TIERED_PROVIDERS.has(provider) && (resolution === \"2K\" || resolution === \"4K\")) {\n return `${provider}:${resolution}`\n }\n // Topaz Image Upscale: 2K is default (no suffix), 4K/8K get composite identifiers\n if (provider === \"topaz-image-upscale\" && targetResolution && targetResolution !== \"2K\") {\n return `${provider}:${targetResolution}`\n }\n if (IDEOGRAM_PROVIDERS.has(provider)) {\n if (renderingSpeed === \"TURBO\") return `${provider}:TURBO`\n if (renderingSpeed === \"QUALITY\") return `${provider}:QUALITY`\n }\n return provider\n}\n\n/**\n * An image request's catalog-snapped parameters PLUS the credit identifier\n * priced off them.\n *\n * `adjustments` is the disclosure channel: every lever this changed, why, and\n * to what. Routes return it in the 200 body so a caller learns their value was\n * corrected instead of silently getting something else.\n */\nexport interface NormalizedImageGen {\n /** Credit identifier, priced off the SNAPPED `resolution` / `quality`. */\n identifier: string\n /** The catalog model id the params were snapped against (post T2I→I2I swap). */\n modelId: string\n aspectRatio?: string\n resolution?: string\n quality?: string\n background?: string\n /** The file the run writes (`outputFormat`); undefined is PNG. */\n outputFormat?: string\n /** A GIF's frames and the time each shows (ms); set only for a GIF. */\n gifFrames?: number\n gifFrameDurationMs?: number\n /** An SVG's level of detail; set only for an SVG. */\n svgLevel?: string\n /** Empty when the caller's values were already valid for `modelId`. */\n adjustments: ModelInputAdjustment[]\n}\n\n/**\n * The catalog model `resolveNormalizedImageGen` snaps against: the provider\n * (Nano Banana when none is named), or — with `swapToI2i` and references\n * attached — its i2i sibling, the model the generate-image route and the\n * workflow payload builder then send. That sibling has its OWN catalog entry\n * and lever lists. Exported so a caller that has to decide something about\n * those lists before the snap (whether a photo's size is worth reading) asks\n * about the same model the snap will use.\n */\nexport function normalizedImageGenModelId(opts: {\n provider: unknown\n refCount: number\n swapToI2i?: boolean\n}): string {\n const provider = typeof opts.provider === \"string\" && opts.provider.length > 0 ? opts.provider : \"nano-banana\"\n return opts.swapToI2i && opts.refCount > 0 ? (T2I_TO_I2I_VARIANT[provider] ?? provider) : provider\n}\n\n/**\n * Whether \"auto\" on a Generate Image request can need its photo's size: the\n * model the snap runs against (`normalizedImageGenModelId` with the swap on)\n * has no native auto. Given the ASSEMBLED reference count, it asks about exactly\n * that model; without one — a write boundary, or a run before its references\n * assemble — about both the provider and its i2i sibling, since references may\n * yet attach.\n */\nexport function imageGenAutoAspectNeedsSourceImage(opts: {\n provider: unknown\n aspectRatio: unknown\n refCount?: number\n}): boolean {\n const asks = (refCount: number) =>\n autoAspectNeedsSourceImage(normalizedImageGenModelId({ provider: opts.provider, refCount, swapToI2i: true }), opts.aspectRatio)\n return opts.refCount === undefined ? asks(0) || asks(1) : asks(opts.refCount)\n}\n\n/**\n * The output-format levers of a request body or a node's data, typed for\n * `normalizeModelInput`: a non-string format or level is no value, and a GIF's\n * numbers may arrive as numeric strings (a form field, a FieldMapping).\n */\nexport function imageFormatInputOf(source: object): { outputFormat?: string; gifFrames?: number; gifFrameDurationMs?: number; svgLevel?: string } {\n const record = source as Record<string, unknown>\n const str = (v: unknown): string | undefined => (typeof v === \"string\" && v.length > 0 ? v : undefined)\n const num = (v: unknown): number | undefined => {\n const n = typeof v === \"number\" ? v : typeof v === \"string\" && v.trim() !== \"\" ? Number(v) : Number.NaN\n return Number.isFinite(n) ? n : undefined\n }\n return {\n outputFormat: str(record.outputFormat),\n gifFrames: num(record.gifFrames),\n gifFrameDurationMs: num(record.gifFrameDurationMs),\n svgLevel: str(record.svgLevel),\n }\n}\n\n/**\n * Snap an image request's catalog-governed levers to a combination the model\n * actually accepts, and price the credit identifier off the SNAPPED values.\n *\n * WHY THE SNAP LIVES HERE and not at the call site. Both image routes compute\n * their credit identifier TWICE — once in the `creditGuard` preHandler (the\n * CHECK) and once at the handler's `reserveCreditsForJob` (the DEBIT) — and a\n * dedicated test asserts the two stay byte-identical (see\n * `backend/src/routes/__tests__/generate-image.test.ts`, \"CHECK === DEBIT\").\n * `resolution` and `quality` are pricing dimensions, so a snap applied at only\n * one of those sites breaks that invariant, and `commit_credits` never collects\n * an upward delta — the reserve IS the charge. Putting the snap inside the\n * primitive makes CHECK, DEBIT and the workflow orchestrator agree by\n * construction rather than by everyone remembering to call a normalizer.\n *\n * Inputs are typed `unknown` on purpose: the preHandler runs BEFORE Zod, so a\n * caller can put a number or an object in `resolution`. Non-strings become\n * `undefined` rather than reaching `normalizeModelInput` as a lie.\n *\n * Unknown model ids pass through untouched (same contract as\n * `normalizeModelInput`) — the route's provider enum is the gate for those.\n *\n * `sourceImage` is the size of the photo the request transforms or is drawn\n * from (an image-to-image / edit source, or Generate Image's first wired\n * reference). It decides \"auto\" on a model without a native auto, and the\n * ratio is not a pricing dimension on any such model (pinned across the catalog\n * by `auto-aspect-source.test.ts`). With `masked` on a model whose masked edit\n * follows its photo (`maskEditMatchesSource`) it also decides the SIZE, a\n * pricing dimension: the CHECK and the DEBIT must then both be given it (the\n * image-to-image route reads it once, before its credit check).\n */\nexport function resolveNormalizedImageGen(opts: {\n provider: string | undefined\n aspectRatio?: unknown\n quality?: unknown\n resolution?: unknown\n renderingSpeed?: unknown\n /** Does not price on its own, but a transparent background can move the size. */\n background?: unknown\n /** The file the run writes, and a GIF's frames and speed or an SVG's level: a GIF and an SVG price differently. */\n outputFormat?: unknown\n gifFrames?: unknown\n gifFrameDurationMs?: unknown\n svgLevel?: unknown\n refCount: number\n swapToI2i?: boolean\n sourceImage?: SourceImageSize\n /** The request carries an inpainting mask: on a model whose masked edit follows its photo, the photo's size decides the ratio and the priced size. */\n masked?: boolean\n}): NormalizedImageGen {\n const str = (v: unknown): string | undefined =>\n typeof v === \"string\" && v.length > 0 ? v : undefined\n\n const modelId = normalizedImageGenModelId(opts)\n\n const n = normalizeModelInput(\n modelId,\n {\n aspectRatio: str(opts.aspectRatio),\n resolution: str(opts.resolution),\n quality: str(opts.quality),\n background: str(opts.background),\n ...imageFormatInputOf(opts),\n },\n { sourceImage: opts.sourceImage, masked: opts.masked },\n )\n\n return {\n identifier: buildCreditModelIdentifier(\n modelId,\n n.quality,\n n.resolution,\n str(opts.renderingSpeed),\n undefined,\n opts.refCount,\n { outputFormat: n.outputFormat, gifFrames: n.gifFrames, svgLevel: n.svgLevel },\n ),\n modelId,\n aspectRatio: n.aspectRatio,\n resolution: n.resolution,\n quality: n.quality,\n background: n.background,\n outputFormat: n.outputFormat,\n gifFrames: n.gifFrames,\n gifFrameDurationMs: n.gifFrameDurationMs,\n svgLevel: n.svgLevel,\n adjustments: n.adjustments,\n }\n}\n\n/**\n * Reference-aware image-generation credit identifier — the SINGLE source of\n * truth shared by the single-node routes (`/v1/generate-image`,\n * `/v1/image-to-image`) and the workflow orchestrator\n * (`payload-builder.ts`). It centralises the two pricing dimensions that must\n * match across both paths or a Flux 2 generation is billed the wrong tier\n * (Flux 2 commits non-metered / has no upward true-up, so the reserved\n * identifier IS the final charge):\n * - `refCount`: the number of reference images sent to the provider (Flux 2\n * bills per ref). generate-image passes the assembled count (0 for pure\n * text-to-image); image-to-image passes 1 (the primary `imageUrl`) + extras.\n * - `swapToI2i`: generate-image auto-swaps a bare T2I provider to its i2i\n * sibling (`T2I_TO_I2I_VARIANT`) when refs are attached, so the credit id\n * matches the variant actually invoked. image-to-image is already an i2i\n * provider → pass `false`.\n *\n * The LoRA short-circuit (`flux-lora-character`) stays at the call site because\n * the routing decision needs a DB lookup the routes/orchestrator own.\n */\nexport function resolveImageGenCreditIdentifier(opts: {\n provider: string | undefined\n quality?: string\n resolution?: string\n renderingSpeed?: string\n outputFormat?: unknown\n gifFrames?: unknown\n svgLevel?: unknown\n refCount: number\n swapToI2i?: boolean\n}): string {\n return resolveNormalizedImageGen(opts).identifier\n}\n\n// T2V-specific credit overrides: some providers have different costs for T2V\n// vs I2V/V2V due to different default resolutions or colliding with image model names.\nconst T2V_CREDIT_OVERRIDES: Record<string, string> = {\n \"grok\": \"grok-i2v\", // T2V grok, same as I2V grok (not image grok = 4 cr)\n \"wan\": \"wan-t2v\", // T2V wan 1080p = (V2V wan 720p = 70 cr)\n \"wan-turbo\": \"wan-turbo-t2v\", // T2V wan-turbo 720p = (I2V wan-turbo 480p = 40 cr)\n}\n\n/**\n * Compute composite model identifier for video models with duration/audio-based pricing.\n * Examples: \"kling-3.0:5s\", \"kling-3.0:10s:audio\", \"seedance-2:8s:720p-ref\"\n *\n * @param provider - Video model key (e.g., \"kling-3.0\")\n * @param duration - Video duration in seconds\n * @param sound - The request's audio: its `sound` flag, or the whole audio\n * request (`{ sound, generateAudio }`) — read through `videoAudioIntent`, the\n * same reading the provider runner sends the model's switch from\n * @param nodeType - Node type for T2V-specific cost overrides\n * @param mode - Quality variant that affects pricing\n * @param resolution - Output resolution (used by Seedance 2 for 480p/720p pricing)\n * @param hasVideoRef - Whether a reference video is connected (Seedance 2 uses a lower per-second rate when true)\n */\n/**\n * LTX 2.3 (Lightricks via Replicate) credit tiers: priced by\n * (resolution-band × duration-seconds). Keys mirror STATIC_CREDIT_COSTS /\n * model_pricing EXACTLY (lowercase band + raw seconds + \"s\"), e.g.\n * \"ltx-2.3-pro:1080p:6s\". This map is the source of truth for the nearest-tier\n * snap below, so an off-catalog (resolution, duration) from a direct API/SDK\n * call maps to a SEEDED price instead of hard-failing (price_not_configured\n * 503). Pro: 6/8/10s at every band. Fast: up to 20s at 1080p, 6/8/10s at 2k/4k.\n */\nconst LTX_DURATION_TIERS: Record<string, Record<string, number[]>> = {\n \"ltx-2.3-pro\": { \"1080p\": [6, 8, 10], \"2k\": [6, 8, 10], \"4k\": [6, 8, 10] },\n \"ltx-2.3-fast\": { \"1080p\": [6, 8, 10, 12, 14, 16, 18, 20], \"2k\": [6, 8, 10], \"4k\": [6, 8, 10] },\n}\n\n/**\n * The (band, duration) tier the LTX pricing ladder charges for a request, or\n * `undefined` for a non-LTX provider. Extracted so\n * `buildVideoCreditModelIdentifier` and `pricedVideoSelection` read the ladder\n * ONCE — the routes must send the tier they reserved, and a second copy of this\n * math is exactly how the two drift apart.\n *\n * An unknown/absent band falls back to 1080p (LTX's own default, and the band\n * `snapLtxInput` snaps to at the Replicate call), and an off-tier duration\n * snaps to the NEAREST seeded one so the emitted composite always prices.\n */\nfunction ltxPricedTier(\n provider: string,\n resolution?: string,\n duration?: number | string,\n): { band: string; duration: number } | undefined {\n const bands = LTX_DURATION_TIERS[provider]\n if (!bands) return undefined\n const band = bands[String(resolution)] ? String(resolution) : \"1080p\"\n const allowed = bands[band]!\n // The model's own default (catalog `defaultDuration`) when unset, then the\n // nearest rung of THIS band's ladder — the length LTX renders.\n const dur = snapToNearestDuration(pricedOutputDurationSec(provider, duration), allowed)\n return { band, duration: dur }\n}\n\n/**\n * The resolution a provider whose runner NORMALIZES the lever actually renders,\n * in the lowercase spelling of its credit composites — billing collapses\n * through the very normalizer the runner sends, so render == billed for every\n * spelling. `undefined` passes through untouched for every other provider.\n */\nfunction wireNormalizedResolution(provider: string, resolution: string | undefined): string | undefined {\n if (isWan3Provider(provider)) return normalizeWan3Resolution(resolution).toLowerCase()\n if (isViduQ4Provider(provider)) return normalizeViduQ4Resolution(resolution)\n if (isKling4Provider(provider)) return normalizeKling4Resolution(resolution)\n // Kling 4.0 Flash renders 720p whatever it is asked (its runner sends 720p).\n if (isKling4FlashProvider(provider)) return KLING_4_FLASH_RESOLUTION\n if (isGrokVideo15Provider(provider)) return normalizeGrokVideo15Resolution(resolution)\n if (isPixverseV6MaxProvider(provider)) return normalizePixverseV6MaxQuality(resolution)\n return resolution\n}\n\nexport function buildVideoCreditModelIdentifier(\n rawProvider: string,\n duration?: number | string,\n sound?: boolean | VideoAudioRequest,\n nodeType?: \"image-to-video\" | \"text-to-video\",\n mode?: string,\n resolution?: string,\n hasVideoRef?: boolean,\n): string {\n const audio: VideoAudioRequest = typeof sound === \"object\" && sound !== null ? sound : { sound }\n // A retired model (RETIRED_VIDEO_PROVIDERS) is priced as the model it runs as.\n const provider = canonicalVideoProvider(rawProvider) as string\n // A tail-recipe Extend Video provider (Seedance 2.5 / 2.0, Kling 4) is\n // priced on its own rows — the one builder every surface that prices an\n // extend reads.\n if (isTailExtendProvider(provider)) return tailExtendCreditId(provider, duration, resolution)\n // T2V overrides: some providers have different base costs for text-to-video\n let effectiveProvider = provider\n if (nodeType === \"text-to-video\") {\n const override = T2V_CREDIT_OVERRIDES[provider]\n if (override) {\n // If override target also has duration pricing, use it as effective provider\n if (DURATION_PRICED_PROVIDERS.has(override)) {\n effectiveProvider = override\n } else {\n return override\n }\n }\n }\n\n // VEO 3.x resolution-tiered pricing: 720p is the base (no suffix), 1080p gets\n // \":1080p\" (Fast/Lite only), and 4K gets \":4k\" for ALL three tiers — direct-4K\n // generation chains KIE's get-4k-video off the base generation (the base runs\n // at 1080p). Duration is fixed at 8s for VEO so the duration-tier path below\n // does not apply.\n if (isVeoProvider(effectiveProvider)) {\n if (resolution === \"4k\") return `${effectiveProvider}:4k`\n // 1080p tier is Fast/Lite only (Quality has no 1080p surcharge).\n if (resolution === \"1080p\" && VEO_RESOLUTION_TIERED_PROVIDERS.has(effectiveProvider)) return `${effectiveProvider}:1080p`\n return effectiveProvider\n }\n\n // Gemini Omni family (gemini-omni-video + gemini-omni-flash): priced by\n // (resolution-band × duration), with a flat per-generation rate when a source\n // video is supplied (V2V). Lowercase \"4k\". The prefix is TEMPLATED from the\n // provider id, so a further Omni SKU needs no edit here — it only has to join\n // GEMINI_OMNI_PROVIDERS and seed its rows. These models are deliberately NOT\n // in DURATION_PRICED_PROVIDERS; this branch early-returns before that gate.\n // A per-second SKU (Omni Flash 1.2) prices on the `:<N>s:<res>` ladder below.\n if (isGeminiOmniProvider(effectiveProvider) && !isGeminiOmniPerSecondProvider(effectiveProvider)) {\n if (hasVideoRef) {\n return resolution === \"4k\" ? `${effectiveProvider}:4k:vref` : `${effectiveProvider}:vref`\n }\n // The rendered length through the catalog funnel (nearest legal tier, the\n // model's own default when unset) so the composite is always a SEEDED one.\n const d = pricedOutputDurationSec(effectiveProvider, duration)\n return resolution === \"4k\" ? `${effectiveProvider}:4k:${d}` : `${effectiveProvider}:${d}`\n }\n\n // LTX 2.3: priced by (resolution-band × duration-seconds). The RESERVE must be\n // the correct composite — commit_credits (migration 176) only refunds a surplus\n // (actual < reserved) and NEVER collects an upward delta, so an under-reserved\n // LTX run (the bare-id default = cheapest 1080p:6s tier) stays under-charged\n // even with meteredCost:true. Snap to a seeded tier so the id always prices.\n const ltxTier = ltxPricedTier(effectiveProvider, resolution, duration)\n if (ltxTier) {\n return `${effectiveProvider}:${ltxTier.band}:${ltxTier.duration}s`\n }\n\n if (!DURATION_PRICED_PROVIDERS.has(effectiveProvider)) {\n return effectiveProvider\n }\n\n // A named-provider request with NO duration renders the model's own default\n // (kie/models.ts extraParams), so price that default — not the global 5s —\n // for providers whose per-second tiers wouldn't snap 5 up to it\n // (minimax-h3, seedance-2-5). One helper, shared with the dynamic\n // reference-video reservations, so the tier and the scaled reserve agree.\n const durationSec = pricedOutputDurationSec(effectiveProvider, duration)\n const tiers = VIDEO_DURATION_TIERS[effectiveProvider]\n if (!tiers) return effectiveProvider\n\n // Find the matching duration tier\n const tier = tiers.find(t => durationSec <= t.maxSeconds) ?? tiers[tiers.length - 1]\n let identifier = `${effectiveProvider}:${tier.suffix}`\n\n // Append mode suffix for providers with quality-tiered pricing\n // \"high\" comes from I2V videoSize field, \"pro\" comes from T2V mode field\n if (MODE_ADDON_PROVIDERS.has(effectiveProvider) && (mode === \"high\" || mode === \"pro\")) {\n identifier += \":high\"\n }\n\n // Seedance 2.0 family: per-second billing with resolution + video-ref dimensions.\n // KIE accepts 480p / 720p / 1080p natively; per-second rates rise non-linearly\n // so each tier gets its own composite identifier.\n if (RESOLUTION_VIDEO_REF_PRICING.has(effectiveProvider)) {\n // Clamp to the model's catalog resolutions (single source of truth): e.g.\n // seedance-2-mini exposes only 480p/720p, so a stale/explicit 1080p (or 4k)\n // maps to its top priced tier instead of emitting an unpriced composite\n // (which the hard-fail credit guard would 503 on at runtime).\n const supported = MODEL_CATALOG[effectiveProvider]?.resolutions ?? [\"480p\", \"720p\", \"1080p\"]\n // An OMITTED resolution renders the model's KIE-side default, so price that\n // default rather than the cheapest tier — otherwise an intent-less request\n // reserves 480p against a 720p render and commit_credits (refund-only) can\n // never collect the delta. Providers without an entry keep the historical\n // 480p fallback, so this cannot reprice anything already live.\n const requested = resolution ?? PRICING_DEFAULT_RESOLUTION[effectiveProvider]\n const want = requested === \"4k\" ? \"4k\" : requested === \"1080p\" ? \"1080p\" : requested === \"720p\" ? \"720p\" : \"480p\"\n // Unsupported (e.g. a stale 1080p on seedance-2-mini) clamps to the model's\n // top priced tier so the emitted composite is always seeded.\n const res = supported.includes(want) ? want : (supported[supported.length - 1] ?? \"480p\")\n identifier += `:${res}`\n if (hasVideoRef) identifier += \"-ref\"\n }\n\n // Duration × resolution pricing without a -ref dimension. Resolutions\n // outside the provider's priced tiers (or undefined) collapse to the first\n // (default) tier so the emitted composite is always seeded — the hard-fail\n // guard fuzzes the whole resolution space.\n const resTiers = RESOLUTION_DURATION_PRICING[effectiveProvider]\n if (resTiers) {\n // The \"default tier\" is the provider's DECLARED default when it has one\n // (PRICING_DEFAULT_RESOLUTION — wan-3 renders 720p, not the cheapest tier),\n // otherwise the first listed tier. Declaring it explicitly means a cosmetic\n // reorder of the tier list can never reprice a live model, and an OMITTED\n // *or* unsupported resolution both land on what actually renders instead of\n // on the cheapest row (commit_credits refunds a surplus but can never\n // collect a shortfall). Behaviour-neutral for every member without a\n // declared default.\n const declaredDefault = PRICING_DEFAULT_RESOLUTION[effectiveProvider]\n const fallback = declaredDefault && resTiers.includes(declaredDefault) ? declaredDefault : resTiers[0]!\n // Wan 3.0 renders through `normalizeWan3Resolution`, which is CASE-INSENSITIVE\n // (\"1080P\" — KIE's own OpenAPI enum spelling, and the natural value for an\n // integrator reading the provider docs — renders 1080P). The tier list here is\n // lowercase and `Array.includes` is case-sensitive, so without this the render\n // path and the billing path disagree: \"1080P\" rendered the top tier and billed\n // the 720p row, a shortfall `commit_credits` (refund-only) can never collect.\n // Collapsing through the SAME normalizer the runner uses makes render == billed\n // by construction for every spelling, including garbage (→ the declared 720p).\n // Scoped to the families whose runner normalizes on purpose (Wan 3.0, Vidu\n // Q4, Kling 4.0, Grok Imagine Video 1.5, PixVerse V6 Max): the other RESOLUTION_DURATION_PRICING members pass `resolution` to\n // their wire verbatim, so case-folding their billing without probing their\n // wire would reprice live models.\n const requested = wireNormalizedResolution(effectiveProvider, resolution)\n const res = requested && resTiers.includes(requested) ? requested : fallback\n identifier += `:${res}`\n // A reference VIDEO bills at its own per-second rate (Kling 4.0).\n if (hasVideoRef && VIDEO_REF_RATE_PROVIDERS.has(effectiveProvider)) identifier += \"-ref\"\n }\n\n // MiniMax Hailuo 3 (768P lever, 2026-08-03): bare duration composites stay\n // the 2K (default) rate — byte-identical to the pre-lever seeded rows, so\n // existing workflows and admin overrides keep their ids — and only a\n // verified 768P selection appends \":768p\". normalizeMinimaxH3Resolution\n // collapses anything else to 2K, matching what KIE renders for an\n // omitted/unknown value, so billing can never undercut the render.\n if (isMinimaxH3Provider(effectiveProvider) && normalizeMinimaxH3Resolution(resolution) === \"768P\") {\n identifier += \":768p\"\n }\n\n // Append the audio suffix LAST, after every other dimension\n // (`kling-3.0:10s:audio`, `pixverse-v6-max:5s:720p:audio`). The request's\n // audio is read by `videoAudioIntent` — the reading `applyVideoAudioToggle`\n // sends the model's switch from — and with no intent falls back to the\n // model's own default (capability `defaultOn` — kling-3.0 and PixVerse V6 Max\n // generate audio unless explicitly disabled), so a request is billed for the\n // audio it actually produces.\n if (AUDIO_ADDON_PROVIDERS.has(effectiveProvider) && videoAudioPricedOn(effectiveProvider, audio)) {\n identifier += \":audio\"\n }\n\n return identifier\n}\n\n/**\n * The credit identifier a video GENERATION node is quoted at — Generate Video\n * (and the legacy Image/Text to Video nodes) and the Video to Video Seedance\n * edit lane, on every surface that quotes one: the node's cost pill, the\n * editor's run estimate, the prompt modal and the backend pre-run estimator.\n *\n * It applies the request levers the run applies BEFORE it prices\n * (payload-builder's `resolveVideoRequestNorm`): the model's UI resolution fill\n * when the node names none (`uiResolutionFill` — what the run sends), then the\n * catalog normalizer `normalizeVideoRequestParams`, which also owns the Seedance\n * Draft rule (a draft is priced AND sent at 480p whatever resolution came with\n * it). Without that, a node with no resolution was quoted at the identifier's\n * own default band (720p on Seedance 2.5) while the run sent and reserved 480p.\n *\n * `hasVideoRef` must come from the GRAPH (a wired reference-video edge, e.g.\n * `countRefModalityEdges(edges, id, \"video\") > 0`), never node data: nothing\n * writes `referenceVideoUrls` into a video node, so reading it there always\n * quoted the plain ladder for a run that reserves on the `-ref` one.\n */\nexport function videoGenerationCreditId(args: {\n provider: string\n duration?: number | string\n sound?: boolean\n /** The request's `generateAudio`, read after `sound` where the model reads it (`videoAudioIntent`). */\n generateAudio?: boolean\n nodeType?: \"image-to-video\" | \"text-to-video\"\n mode?: string\n resolution?: string\n draft?: boolean\n hasVideoRef?: boolean\n}): string {\n const { resolution } = normalizeVideoRequestParams(args.provider, {\n resolution: args.resolution ?? uiResolutionFill(args.provider),\n draft: args.draft === true,\n })\n return buildVideoCreditModelIdentifier(\n args.provider,\n args.duration,\n { sound: args.sound, generateAudio: args.generateAudio },\n args.nodeType ?? \"image-to-video\",\n args.mode,\n resolution,\n args.hasVideoRef === true,\n )\n}\n\n/**\n * The credit identifier a Video to Video node's Seedance EDIT lane reserves\n * under. Seedance has no v2v endpoint — the lane is a text-to-video job in edit\n * shape with the source clip as reference video 1 — so it prices on the\n * REFERENCE-VIDEO ladder at the model's LONGEST clip (Auto duration), and the\n * measured settlement refunds down to what was actually delivered.\n *\n * A thin call into {@link videoGenerationCreditId}, so a Generate Video node\n * making the same KIE call (Seedance, Auto, a wired reference video) is quoted\n * the same id. FOUR surfaces must agree on it exactly: the orchestrator's\n * reservation (payload-builder.ts), the backend pre-run estimator\n * (ee/billing/credits.ts), the node's cost pill, and the frontend run-level\n * estimate (config-panels/helpers.ts). A quote that disagrees with the reserve\n * is the documented `price_not_configured` / blank-pill trap.\n *\n * `resolution` is the node's one `v2vResolution` field; when unset the model's\n * own UI fill is priced, which is what the lane will send. `draft` is the\n * node's Seedance Draft toggle (priced at 480p).\n */\nexport function seedanceVideoEditCreditId(provider: string, resolution?: string, draft?: boolean): string {\n return videoGenerationCreditId({\n provider,\n duration: VIDEO_DURATION_AUTO,\n nodeType: \"text-to-video\",\n resolution,\n draft,\n hasVideoRef: true,\n })\n}\n\n/** The resolution a tail-recipe extend that names none, or one it does not offer, is priced and run at (every one offers it). */\nconst TAIL_EXTEND_DEFAULT_RESOLUTION = \"720p\"\n\n/**\n * The resolution a tail-recipe Extend Video run (Seedance 2.5 / 2.0, Kling 4)\n * is priced at, and so the one it must render at: the requested one when it is\n * among the provider's catalog `resolutions`, else 720p (also when none is\n * named). The workflow run queues it and the worker holds the job to it, so a\n * stored or sent resolution the model does not offer (`4k`, or `480p` on Kling\n * 4) can never render above, or bill apart from, the row it reserved.\n */\nexport function tailExtendResolution(provider: TailExtendProvider, resolution?: unknown): string {\n return typeof resolution === \"string\" && MODEL_CATALOG[provider]?.resolutions?.includes(resolution)\n ? resolution\n : TAIL_EXTEND_DEFAULT_RESOLUTION\n}\n\n/**\n * The credit identifier one tail-recipe Extend Video run is priced at — the\n * one builder every surface that prices it reads (the route's guard and\n * reservation, the workflow reservation and estimate, the editor), so none of\n * them can name a different row.\n *\n * The seconds added snap into the provider's catalog `durations` (its catalog\n * `defaultDuration` when unset, through {@link pricedOutputDurationSec}); the\n * resolution is {@link tailExtendResolution}'s. Each provider has its own\n * rows, one per second of its window and resolution: `<provider>:<N>s:<res>`\n * (`seedance-2-5-extend` 4–30 s, `seedance-2-0-extend` 4–15 s, both at\n * 480p / 720p / 1080p; `kling-4-extend` 3–30 s at 720p / 1080p).\n *\n * A retired id (`seedance-2-extend`) is not a {@link TailExtendProvider}:\n * pass a stored or sent provider through `canonicalVideoProvider` first.\n */\nexport function tailExtendCreditId(\n provider: TailExtendProvider,\n duration?: number | string,\n resolution?: string,\n): string {\n return `${provider}:${pricedOutputDurationSec(provider, duration)}s:${tailExtendResolution(provider, resolution)}`\n}\n\n/** @deprecated Use {@link tailExtendResolution}, which also answers for Kling 4 Extend. */\nexport function seedanceExtendResolution(provider: SeedanceExtendProvider, resolution?: unknown): string {\n return tailExtendResolution(provider, resolution)\n}\n\n/** @deprecated Use {@link tailExtendCreditId}, which also answers for Kling 4 Extend. */\nexport function seedanceExtendCreditId(\n provider: SeedanceExtendProvider,\n duration?: number | string,\n resolution?: string,\n): string {\n return tailExtendCreditId(provider, duration, resolution)\n}\n\n/** What the video credit identifier PRICES for a request, for the levers whose\n * priced value must also be the value we SEND. */\nexport interface PricedVideoSelection {\n /** The resolution band the reservation is priced at when the request omitted\n * one — and only where the platform DECLARES that band as the provider's own\n * default. `undefined` means \"leave `resolution` exactly as the request had\n * it\": either the caller supplied one, or the provider's real default is not\n * known to be the band the identifier assumes. */\n resolution?: string\n /** The length the reservation is priced at and the wire carries, for a\n * provider whose price follows the clip length (LTX's seeded tier, the KIE\n * ladders, Gemini Omni). `undefined` for every other provider, and for Auto:\n * their duration passes through. */\n duration?: number\n /** Non-empty only for a lever the caller ASKED for and did not get (a 7s\n * request snapped to the 6s tier). Filling an omitted lever is a disclosure of\n * the price already being charged, not a correction, so it reports nothing. */\n adjustments: ModelInputAdjustment[]\n}\n\n/**\n * The other half of the video money path: `normalizeVideoRequestParams` snaps a\n * value the CATALOG governs; this returns the value the PRICE ladder governs.\n *\n * Two defects it closes, both of the same shape — the identifier prices one\n * thing and the wire carries another, and `commit_credits` (migration 176) only\n * ever refunds a surplus, so the reservation is the final charge:\n *\n * 1. **Absent resolution.** `buildVideoCreditModelIdentifier` prices an omitted\n * `resolution` as a concrete band (LTX → 1080p; a\n * {@link PRICING_DEFAULT_RESOLUTION} member → its declared default). Leaving\n * the key unset then lets the provider pick — documented for the KIE members\n * (their `extraParams` pin the same band) but UNDOCUMENTED for LTX on\n * Replicate. Sending the band we priced makes the two agree by construction.\n *\n * The fill is deliberately limited to providers with a DECLARED default.\n * `buildVideoCreditModelIdentifier` also has un-declared fallbacks — the\n * cheapest tier for a resolution-priced provider with no\n * `PRICING_DEFAULT_RESOLUTION` row — and those are a HEDGE, not a verified\n * provider default: seedance-2 / -fast / -mini pin `resolution: \"720p\"`\n * KIE-side while the identifier prices 480p, so filling 480p would downgrade\n * the render to match a price we already know is wrong. That mismatch is a\n * pre-existing identifier bug and is fixed by seeding the row, not here.\n *\n * 2. **Duration.** Every provider whose price follows the clip length is\n * charged at the length it RENDERS: its own default when the request named\n * none (catalog `defaultDuration`), the nearest length it offers otherwise\n * (`pricedOutputDurationSec` — the runners' own snap rule). The LTX ladder is\n * seeded per (band × seconds), so a 7s request snaps onto the 6s tier;\n * sending 7s would bill six and render seven. The same value is returned for\n * the other length-priced providers (the KIE ladders, Gemini Omni), so what\n * is priced is what is sent. Auto (-1) is the model's call and is untouched.\n *\n * Pure, and IDEMPOTENT against the identifier: feeding its output back in\n * cannot move the reserved tier. `video-request-normalize.test.ts` proves that\n * over every provider × resolution × duration.\n */\nexport function pricedVideoSelection(opts: {\n provider: string\n resolution?: string\n duration?: number | string\n}): PricedVideoSelection {\n const adjustments: ModelInputAdjustment[] = []\n const ltx = ltxPricedTier(opts.provider, opts.resolution, opts.duration)\n\n // The band the request will be priced AND rendered at. An explicit value\n // always wins — this only ever fills an omission.\n const resolution = opts.resolution\n ?? (ltx ? ltx.band : PRICING_DEFAULT_RESOLUTION[opts.provider])\n\n const requested = typeof opts.duration === \"string\" ? parseInt(opts.duration, 10) : opts.duration\n const asked = requested !== undefined && !Number.isNaN(requested)\n\n // Every provider whose price follows the clip length sends the length it is\n // CHARGED at (the catalog funnel: its own default when unset, the nearest\n // legal length otherwise). Auto (-1) is the model's call and is left alone.\n const lengthPriced = !!ltx || DURATION_PRICED_PROVIDERS.has(opts.provider) || isGeminiOmniProvider(opts.provider)\n if (!lengthPriced || (!ltx && asked && requested! <= 0)) return { resolution, adjustments }\n\n const duration = ltx ? ltx.duration : pricedOutputDurationSec(opts.provider, opts.duration)\n if (asked && requested !== duration) {\n adjustments.push({\n field: \"duration\",\n from: requested!,\n to: duration,\n reason: ltx\n ? `LTX renders ${ltx.band} in ${ltx.duration}s steps — using ${ltx.duration}s instead of ${requested}s.`\n : `${opts.provider} renders ${duration}s clips at the nearest length it offers — using ${duration}s instead of ${requested}s.`,\n })\n }\n return { resolution, duration, adjustments }\n}\n\n/**\n * Compute composite model identifier for motion control with duration-tiered pricing.\n * Examples: \"kling-3.0-motion:10s\", \"kling-3.0-motion:1080p:15s\", \"motion-transfer:5s\"\n *\n * Wan Animate providers use resolution-tiered pricing (not per-second):\n * \"wan-animate-move\" (480p default), \"wan-animate-move:580p\", \"wan-animate-move:720p\"\n *\n * @param provider - Motion control provider key (\"kling\" for 2.6, \"kling-3.0\", \"wan-animate-move\", \"wan-animate-replace\")\n * @param resolution - \"720p\" or \"1080p\" (Kling), \"480p\" or \"580p\" or \"720p\" (Wan Animate); a size the\n * model does not have is priced as the size it runs at (`motionTransferResolution`: Wan Animate's 1080p as 720p)\n * @param videoDuration - Reference video duration in seconds (defaults to 10s, unused for Wan Animate)\n */\nexport function buildMotionCreditModelIdentifier(\n provider: string,\n resolution: string,\n videoDuration?: number,\n): string {\n return motionCreditIdentifier(provider, motionTransferResolution(provider, resolution).resolution, videoDuration)\n}\n\n/** The catalog model a Motion Transfer option runs: the base of the id it is billed under. */\nfunction motionModelOf(provider: string): string {\n return motionCreditIdentifier(provider, \"720p\").split(\":\")[0]!\n}\n\n/**\n * Motion models still SENT at a size their catalog entry does not list, as\n * before Wan Animate had entries: Kling 2.6 and Kling 3.0 Motion Control\n * (720p and 1080p). Their price is the same either way (any size but 1080p is\n * charged on the 720p rows), and Kling 3.0's provider already sends such a\n * size as 720p; whether Kling 2.6 should too is not decided. Only shrinks.\n */\nconst MOTION_MODELS_SENT_AS_NAMED: ReadonlySet<string> = new Set([\"motion-transfer\", \"kling-3.0-motion\"])\n\n/** The size a Motion Transfer run is sent and charged at, and what moved. */\nexport interface MotionTransferResolution {\n resolution: string\n /** Empty when the size it names is the one it runs at. */\n adjustments: ModelInputAdjustment[]\n}\n\n/**\n * The size a Motion Transfer run is sent and charged at (decided 2026-11-12):\n * the size it names, held to the catalog entry of the model its option runs\n * (`normalizeModelInput`), so a size that model does not have moves to the\n * entry's `defaultResolution` — a Wan Animate request at 1080p runs, and is\n * charged, as 720p. The route, the workflow build, the MCP workflow writes and\n * every price (through `buildMotionCreditModelIdentifier`) read this one rule.\n */\nexport function motionTransferResolution(provider: string, resolution: string): MotionTransferResolution {\n const model = motionModelOf(provider)\n if (MOTION_MODELS_SENT_AS_NAMED.has(model)) return { resolution, adjustments: [] }\n const normalized = normalizeModelInput(model, { resolution })\n if (normalized.resolution === undefined) return { resolution, adjustments: [] }\n return { resolution: normalized.resolution, adjustments: normalized.adjustments }\n}\n\nfunction motionCreditIdentifier(\n provider: string,\n resolution: string,\n videoDuration?: number,\n): string {\n // Wan Animate providers use resolution-tiered pricing (not duration-based)\n if (provider === \"wan-animate-move\" || provider === \"wan-animate-replace\") {\n // 480p is the default (base identifier), 580p and 720p get composite suffix\n if (resolution === \"580p\" || resolution === \"720p\") {\n return `${provider}:${resolution}`\n }\n return provider\n }\n\n const raw = videoDuration ?? 10\n const durationSec = Math.floor(Number.isNaN(raw) ? 10 : raw) // default 10s; floor to match KIE per-second billing\n const tier = MOTION_DURATION_TIERS.find(t => durationSec <= t.maxSeconds)\n ?? MOTION_DURATION_TIERS[MOTION_DURATION_TIERS.length - 1]\n\n const base = provider === \"kling-3.0\" ? \"kling-3.0-motion\" : \"motion-transfer\"\n const resSuffix = resolution === \"1080p\" ? \":1080p\" : \"\"\n return `${base}${resSuffix}:${tier.suffix}`\n}\n\n/**\n * The Suno operations whose credit key depends on the model VERSION.\n *\n * `/v1/suno/generate`, `/cover` and `/extend` resolve their creditGuard\n * identifier through `sunoCreditType(model, <operation>)` (routes/suno.ts\n * :247-249, :335-337, :407-409). EVERY other Suno route charges a flat\n * per-operation key and ignores the version the node carries — mashup (:648),\n * add-instrumental (:852), add-vocals (:907), upload-extend (:1016),\n * replace-section (:710), style-boost (:771), convert-wav (:962),\n * lyrics (:482), music-video (:594), voice (:1218).\n *\n * Anything that QUOTES a Suno price — a dropdown row, a node badge, the\n * workflow-credit estimator — must follow the same split, or it displays a\n * credit key the route never charges.\n */\nexport const SUNO_VERSION_PRICED_OPERATIONS = [\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n] as const\n\n/**\n * The seven Suno operations that appear behind a select/dropdown UI (model\n * pickers, node badges, the credit estimator) — the three version-priced\n * operations above, plus the four flat-key operations exercised by\n * `sunoCreditType`'s own test suite. A readonly tuple so later tasks (the\n * model dropdowns, node badges) can iterate or count it without redeclaring\n * the list and drifting from this one.\n */\nexport const SUNO_SELECT_OPERATIONS = [\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-mashup\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-upload-extend\",\n] as const\n\n/**\n * Adjust Speed's price id: motion-compensated (\"smooth\") interpolation is its\n * own, dearer tier. The route, the workflow run, and the editor's badge and\n * run estimate all price through this, so none of them can quote the fast tier\n * for a smooth run.\n */\nexport function speedRampCreditId(quality: unknown): \"speed-ramp\" | \"speed-ramp:smooth\" {\n return quality === \"smooth\" ? \"speed-ramp:smooth\" : \"speed-ramp\"\n}\n\n/**\n * Apply EDL's price id: a `proxy` render (the 720p preview) is its own,\n * cheaper per-output-minute row; a `final` render keeps the bare id. One id per\n * QUALITY, for a video and an audio output alike (decided 2026-10-04). Anything\n * that is not exactly \"proxy\" is the final, as the route and the node default\n * it. The route, the workflow run, and the editor's badge and run estimate all\n * price through this; the job itself is always named `apply-edl`.\n */\nexport function applyEdlCreditId(quality: unknown): \"apply-edl\" | \"apply-edl:proxy\" {\n return quality === \"proxy\" ? \"apply-edl:proxy\" : \"apply-edl\"\n}\n\n/**\n * Speaker View's price tiers (decided 2026-10-10, C4): a render is priced by\n * how many speakers it composites at once. `standard` — at most two tiles on\n * any segment and no zoom; `complex` — three to six tiles, or any zoom. Which\n * tier a render is in is the render rule's to say (the app's\n * `@nodaro/render-rules`), never this vocabulary's.\n */\nexport const SPEAKER_VIEW_PRICE_TIERS = [\"standard\", \"complex\"] as const\nexport type SpeakerViewPriceTier = (typeof SPEAKER_VIEW_PRICE_TIERS)[number]\n\nexport type SpeakerViewCreditId = \"speaker-view\" | \"speaker-view:proxy\" | \"speaker-view:complex\" | \"speaker-view:complex:proxy\"\n\n/** Every id `speakerViewCreditId` can name. */\nexport const SPEAKER_VIEW_CREDIT_IDS: readonly SpeakerViewCreditId[] = Object.freeze([\n \"speaker-view\",\n \"speaker-view:proxy\",\n \"speaker-view:complex\",\n \"speaker-view:complex:proxy\",\n] as const)\n\n/**\n * The credit id of a Speaker View render (F4, decided 2026-09-23; tiers\n * decided 2026-10-10): a Preview (`quality` \"proxy\") reserves on its own row,\n * anything else on the final's, and each in its price tier — `standard` on\n * `speaker-view` / `speaker-view:proxy`, `complex` on `speaker-view:complex` /\n * `speaker-view:complex:proxy`. A tier that is not exactly `standard` (absent\n * included) names the `complex` row: a caller that cannot tell quotes high,\n * never low. The job is always named `speaker-view`; only its credit id\n * follows the quality and the tier.\n */\nexport function speakerViewCreditId(quality: unknown, tier?: unknown): SpeakerViewCreditId {\n const proxy = quality === \"proxy\"\n if (tier === \"standard\") return proxy ? \"speaker-view:proxy\" : \"speaker-view\"\n return proxy ? \"speaker-view:complex:proxy\" : \"speaker-view:complex\"\n}\n\n/**\n * OUR Nodaro credit key for a Suno operation, given the model version and the\n * operation (which is also the node type and the BullMQ job name).\n *\n * This is the single source of truth for the Suno pricing contract, shared by\n * the reservation path (routes/suno.ts creditGuard), the egress seam\n * (workers/handlers/suno.ts `modelKey`, which must match what was reserved),\n * both workflow-credit estimators (ee/billing/credits.ts and the frontend\n * config-panels/helpers.ts), the seven Suno model dropdowns and the three Suno\n * node badges. It is a billing key — NEVER a KIE provider id — which is what\n * satisfies the B3 egress invariant.\n *\n * The version → key map is {@link SUNO_VERSION_CREDIT_KEYS}; a version with no\n * entry (V4 / V4_5 / V4_5ALL / V4_5PLUS) falls back to the operation key, and a\n * non-version-priced operation is returned unchanged.\n */\nexport function sunoCreditType(model: string | undefined, operation: string): string {\n if (!(SUNO_VERSION_PRICED_OPERATIONS as readonly string[]).includes(operation)) {\n return operation\n }\n return (model && SUNO_VERSION_CREDIT_KEYS[model]) || operation\n}\n\n/**\n * Suno version → Nodaro credit key for the version-priced operations. One row\n * per version that has its own `model_pricing` row / `STATIC_CREDIT_COSTS`\n * entry / `MODEL_CATALOG` pricing row, so an admin can reprice one version\n * without touching code. Every ACTIVE version MUST have a row here — guarded\n * by `__tests__/suno-credit-type.test.ts` (a new active version with no key\n * would silently bill at the operation key).\n */\nexport const SUNO_VERSION_CREDIT_KEYS: Readonly<Record<string, string>> = {\n V6: \"suno-v6\",\n V6_WILD: \"suno-v6_wild\",\n V6_MINI: \"suno-v6_mini\",\n V5_5: \"suno-v5_5\",\n V5: \"suno-v5\",\n}\n"]}