@nodaro/shared 3.62.0 → 3.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/{chunk-C7POAYFE.js → chunk-36VWLB4J.js} +3 -3
  2. package/dist/{chunk-C7POAYFE.js.map → chunk-36VWLB4J.js.map} +1 -1
  3. package/dist/{chunk-S24ZBUB4.js → chunk-3AYM47GW.js} +6 -32
  4. package/dist/chunk-3AYM47GW.js.map +1 -0
  5. package/dist/{chunk-YCXRSWCQ.js → chunk-3KTWYYCN.js} +8 -5
  6. package/dist/chunk-3KTWYYCN.js.map +1 -0
  7. package/dist/{chunk-ZES6EZC4.js → chunk-4IUE2JB7.js} +3 -3
  8. package/dist/{chunk-ZES6EZC4.js.map → chunk-4IUE2JB7.js.map} +1 -1
  9. package/dist/{chunk-MYJQELFN.cjs → chunk-5OBTGNUQ.cjs} +547 -29
  10. package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
  11. package/dist/{chunk-TWF2OSH4.cjs → chunk-67CMMTLN.cjs} +4 -4
  12. package/dist/{chunk-TWF2OSH4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-S5TMRJMX.js → chunk-6YIV37V7.js} +4 -4
  16. package/dist/{chunk-S5TMRJMX.js.map → chunk-6YIV37V7.js.map} +1 -1
  17. package/dist/{chunk-3M4BNKFJ.cjs → chunk-7AJGUI7L.cjs} +202 -16
  18. package/dist/chunk-7AJGUI7L.cjs.map +1 -0
  19. package/dist/{chunk-JZGZ26YB.js → chunk-7KQ6W5DS.js} +4 -4
  20. package/dist/{chunk-JZGZ26YB.js.map → chunk-7KQ6W5DS.js.map} +1 -1
  21. package/dist/{chunk-IWWVPR3W.cjs → chunk-ACZZHHFZ.cjs} +149 -34
  22. package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
  23. package/dist/{chunk-2W745U4A.cjs → chunk-AZNZ5WNZ.cjs} +42 -70
  24. package/dist/chunk-AZNZ5WNZ.cjs.map +1 -0
  25. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  26. package/dist/chunk-BQYCZLMF.js.map +1 -0
  27. package/dist/chunk-CHS2SIP6.cjs +504 -0
  28. package/dist/chunk-CHS2SIP6.cjs.map +1 -0
  29. package/dist/{chunk-CIPPPT7E.cjs → chunk-CHTZZRAL.cjs} +6 -6
  30. package/dist/{chunk-CIPPPT7E.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
  31. package/dist/{chunk-AOJ6B7K4.cjs → chunk-D4KWNDPH.cjs} +12 -12
  32. package/dist/chunk-D4KWNDPH.cjs.map +1 -0
  33. package/dist/{chunk-5YYN5X57.js → chunk-DZ4IOP3Q.js} +536 -30
  34. package/dist/chunk-DZ4IOP3Q.js.map +1 -0
  35. package/dist/{chunk-VACPZPUA.cjs → chunk-EXEVT6D2.cjs} +15 -5
  36. package/dist/chunk-EXEVT6D2.cjs.map +1 -0
  37. package/dist/{chunk-5M43XMRB.cjs → chunk-FHGRKQVZ.cjs} +8 -8
  38. package/dist/{chunk-5M43XMRB.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
  39. package/dist/{chunk-KJSRPHJ2.cjs → chunk-GTWUS6MQ.cjs} +165 -54
  40. package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
  41. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  42. package/dist/chunk-H5KHWTAE.js.map +1 -0
  43. package/dist/{chunk-G3KVK7OU.cjs → chunk-HDPJNNMF.cjs} +21 -21
  44. package/dist/{chunk-G3KVK7OU.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
  45. package/dist/{chunk-3OYO3XCC.js → chunk-IYSOVS7O.js} +118 -24
  46. package/dist/chunk-IYSOVS7O.js.map +1 -0
  47. package/dist/{chunk-AFYTX4AI.cjs → chunk-J6B7J73J.cjs} +110 -50
  48. package/dist/chunk-J6B7J73J.cjs.map +1 -0
  49. package/dist/{chunk-I2RQB7VG.js → chunk-KB2SQAR3.js} +3 -3
  50. package/dist/{chunk-I2RQB7VG.js.map → chunk-KB2SQAR3.js.map} +1 -1
  51. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  52. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  53. package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
  54. package/dist/chunk-NIAFR5EE.js.map +1 -0
  55. package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
  56. package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
  57. package/dist/{chunk-IDTKF5EX.cjs → chunk-O4RPXBDZ.cjs} +12 -8
  58. package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
  59. package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
  60. package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
  61. package/dist/{chunk-PTD6EDUU.js → chunk-OBOOHG3N.js} +13 -4
  62. package/dist/chunk-OBOOHG3N.js.map +1 -0
  63. package/dist/{chunk-2D5LQFV4.cjs → chunk-OOZW2MM6.cjs} +9 -9
  64. package/dist/{chunk-2D5LQFV4.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
  65. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  66. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  67. package/dist/{chunk-G4U3HW6W.js → chunk-PJJAZQVZ.js} +3 -3
  68. package/dist/{chunk-G4U3HW6W.js.map → chunk-PJJAZQVZ.js.map} +1 -1
  69. package/dist/{chunk-E2HZTGYX.js → chunk-Q2Y4JHF7.js} +7 -7
  70. package/dist/chunk-Q2Y4JHF7.js.map +1 -0
  71. package/dist/{chunk-FVII3KHN.js → chunk-QYU7J5EQ.js} +198 -17
  72. package/dist/chunk-QYU7J5EQ.js.map +1 -0
  73. package/dist/{chunk-JJNNM23P.js → chunk-S3UGLZSF.js} +3 -3
  74. package/dist/{chunk-JJNNM23P.js.map → chunk-S3UGLZSF.js.map} +1 -1
  75. package/dist/{chunk-CC4V2B7S.js → chunk-SHH2T4CR.js} +3 -3
  76. package/dist/{chunk-CC4V2B7S.js.map → chunk-SHH2T4CR.js.map} +1 -1
  77. package/dist/{chunk-4ZEFP2FQ.cjs → chunk-SPAHI7DY.cjs} +4 -4
  78. package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
  79. package/dist/{chunk-Y6X7UJSD.js → chunk-SXHHLZ22.js} +122 -15
  80. package/dist/chunk-SXHHLZ22.js.map +1 -0
  81. package/dist/{chunk-HRY7KGAE.cjs → chunk-T2OVDF2M.cjs} +6 -6
  82. package/dist/{chunk-HRY7KGAE.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
  83. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  84. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  85. package/dist/{chunk-NGKKNSK6.js → chunk-TPQJKS7D.js} +139 -16
  86. package/dist/chunk-TPQJKS7D.js.map +1 -0
  87. package/dist/{chunk-N7OUQK7E.cjs → chunk-TQW3R44P.cjs} +8 -8
  88. package/dist/{chunk-N7OUQK7E.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
  89. package/dist/{chunk-GSFB537T.js → chunk-TTGZ2L3O.js} +23 -4
  90. package/dist/chunk-TTGZ2L3O.js.map +1 -0
  91. package/dist/{chunk-SYWR5G3T.js → chunk-VPTA4Z7G.js} +54 -7
  92. package/dist/chunk-VPTA4Z7G.js.map +1 -0
  93. package/dist/{chunk-2HZGDZZN.cjs → chunk-VZ6TE23U.cjs} +6 -6
  94. package/dist/{chunk-2HZGDZZN.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
  95. package/dist/{chunk-TRVWMKNE.cjs → chunk-W6VJAUGM.cjs} +285 -64
  96. package/dist/chunk-W6VJAUGM.cjs.map +1 -0
  97. package/dist/{chunk-UDDVDQMF.js → chunk-W7KHHNZR.js} +235 -37
  98. package/dist/chunk-W7KHHNZR.js.map +1 -0
  99. package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
  100. package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
  101. package/dist/{chunk-6CSXMWL4.cjs → chunk-YQV53HRR.cjs} +27 -4
  102. package/dist/chunk-YQV53HRR.cjs.map +1 -0
  103. package/dist/{chunk-7FCTCWHD.js → chunk-ZI3QDUHO.js} +3 -3
  104. package/dist/{chunk-7FCTCWHD.js.map → chunk-ZI3QDUHO.js.map} +1 -1
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.js +8 -7
  107. package/dist/entries/captions.cjs +38 -30
  108. package/dist/entries/captions.d.cts +47 -1
  109. package/dist/entries/captions.d.ts +47 -1
  110. package/dist/entries/captions.js +1 -1
  111. package/dist/entries/credits.cjs +354 -174
  112. package/dist/entries/credits.d.cts +378 -27
  113. package/dist/entries/credits.d.ts +378 -27
  114. package/dist/entries/credits.js +11 -11
  115. package/dist/entries/llm-models.cjs +77 -57
  116. package/dist/entries/llm-models.d.cts +108 -7
  117. package/dist/entries/llm-models.d.ts +108 -7
  118. package/dist/entries/llm-models.js +2 -2
  119. package/dist/entries/media.cjs +63 -63
  120. package/dist/entries/media.d.cts +8 -0
  121. package/dist/entries/media.d.ts +8 -0
  122. package/dist/entries/media.js +1 -1
  123. package/dist/entries/model-catalog.cjs +161 -105
  124. package/dist/entries/model-catalog.d.cts +109 -22
  125. package/dist/entries/model-catalog.d.ts +109 -22
  126. package/dist/entries/model-catalog.js +4 -4
  127. package/dist/entries/models.cjs +466 -322
  128. package/dist/entries/models.d.cts +71 -5
  129. package/dist/entries/models.d.ts +71 -5
  130. package/dist/entries/models.js +5 -5
  131. package/dist/entries/nodes.cjs +226 -209
  132. package/dist/entries/nodes.d.cts +66 -7
  133. package/dist/entries/nodes.d.ts +66 -7
  134. package/dist/entries/nodes.js +10 -9
  135. package/dist/entries/pipeline.cjs +156 -152
  136. package/dist/entries/pipeline.d.cts +14 -4
  137. package/dist/entries/pipeline.d.ts +14 -4
  138. package/dist/entries/pipeline.js +3 -3
  139. package/dist/entries/runtime-config.cjs +29 -29
  140. package/dist/entries/runtime-config.d.cts +10 -7
  141. package/dist/entries/runtime-config.d.ts +10 -7
  142. package/dist/entries/runtime-config.js +1 -1
  143. package/dist/entries/social.cjs +177 -177
  144. package/dist/entries/social.js +2 -2
  145. package/dist/entries/types.d.cts +8 -0
  146. package/dist/entries/types.d.ts +8 -0
  147. package/dist/entries/ugc.cjs +71 -71
  148. package/dist/entries/ugc.js +4 -4
  149. package/dist/entries/video.cjs +154 -150
  150. package/dist/entries/video.d.cts +11 -2
  151. package/dist/entries/video.d.ts +11 -2
  152. package/dist/entries/video.js +6 -6
  153. package/dist/entries/workflow.cjs +150 -150
  154. package/dist/entries/workflow.d.cts +1 -1
  155. package/dist/entries/workflow.d.ts +1 -1
  156. package/dist/entries/workflow.js +2 -2
  157. package/dist/index.cjs +2136 -1704
  158. package/dist/index.d.cts +10 -10
  159. package/dist/index.d.ts +10 -10
  160. package/dist/index.js +27 -27
  161. package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-Cf9fkEUp.d.cts} +45 -2
  162. package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-Cf9fkEUp.d.ts} +45 -2
  163. package/dist/{model-constants-B88p6XR0.d.ts → model-constants-BxjiWVQ9.d.ts} +215 -32
  164. package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-C_Nyft_i.d.cts} +215 -32
  165. package/package.json +1 -1
  166. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  167. package/src/__tests__/credit-identifiers.test.ts +29 -0
  168. package/src/__tests__/extend-providers.test.ts +359 -39
  169. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  170. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  171. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  172. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  173. package/src/__tests__/flux-3-klein.test.ts +203 -0
  174. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  175. package/src/__tests__/gvp-supported-providers.test.ts +27 -2
  176. package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
  177. package/src/__tests__/lip-sync-levers.test.ts +31 -0
  178. package/src/__tests__/llm-models.test.ts +139 -12
  179. package/src/__tests__/llm-price-key.test.ts +164 -1
  180. package/src/__tests__/model-makers.test.ts +3 -0
  181. package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
  182. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  183. package/src/__tests__/normalize-node-params.test.ts +172 -1
  184. package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
  185. package/src/__tests__/prompt-length-limits.test.ts +4 -0
  186. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  187. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  188. package/src/__tests__/seedance-task-type.test.ts +13 -3
  189. package/src/__tests__/sequence-execution.test.ts +22 -1
  190. package/src/__tests__/suno-credit-type.test.ts +21 -2
  191. package/src/__tests__/transcribe-capabilities.test.ts +41 -2
  192. package/src/__tests__/transcribe-preflight.test.ts +50 -1
  193. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  194. package/src/__tests__/video-analysis-pricing.test.ts +10 -9
  195. package/src/__tests__/video-audio-capability.test.ts +35 -6
  196. package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
  197. package/src/__tests__/video-upscale-params.test.ts +62 -0
  198. package/src/caption-styles.ts +62 -0
  199. package/src/catalog-projection.ts +8 -0
  200. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  201. package/src/credit-estimators/index.ts +20 -0
  202. package/src/credit-estimators/nemotron-transcribe.ts +87 -0
  203. package/src/credit-identifiers.ts +351 -41
  204. package/src/entries/captions.ts +2 -0
  205. package/src/entries/credits.ts +37 -2
  206. package/src/entries/llm-models.ts +6 -0
  207. package/src/entries/model-catalog.ts +22 -0
  208. package/src/entries/models.ts +50 -0
  209. package/src/entries/nodes.ts +4 -0
  210. package/src/entries/pipeline.ts +1 -1
  211. package/src/entries/video.ts +1 -1
  212. package/src/flux-3-klein.ts +69 -0
  213. package/src/freecut-protocol.ts +8 -0
  214. package/src/input-image-pricing.ts +23 -6
  215. package/src/lip-sync-levers.ts +56 -0
  216. package/src/lip-sync-pricing.ts +91 -1
  217. package/src/llm-models.ts +305 -16
  218. package/src/model-catalog.ts +529 -28
  219. package/src/model-constants.ts +417 -41
  220. package/src/model-tree.ts +2 -1
  221. package/src/nodaro-video-upscale.ts +48 -0
  222. package/src/node-default-mappings.ts +6 -0
  223. package/src/node-runtime-keys.ts +3 -0
  224. package/src/normalize-node-params.ts +172 -3
  225. package/src/runtime-config/contract.ts +10 -7
  226. package/src/seedance-draft.ts +2 -1
  227. package/src/seedance-extend-rate.ts +116 -0
  228. package/src/sequence-execution.ts +24 -0
  229. package/src/transcribe-preflight.ts +81 -7
  230. package/src/video-analysis-pricing.ts +28 -15
  231. package/src/video-duration.ts +9 -0
  232. package/src/video-ui-defaults.ts +5 -3
  233. package/src/video-upscale-params.ts +67 -0
  234. package/dist/chunk-2W745U4A.cjs.map +0 -1
  235. package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
  236. package/dist/chunk-3OYO3XCC.js.map +0 -1
  237. package/dist/chunk-5YYN5X57.js.map +0 -1
  238. package/dist/chunk-6CSXMWL4.cjs.map +0 -1
  239. package/dist/chunk-6G7NN4S4.js.map +0 -1
  240. package/dist/chunk-AFYTX4AI.cjs.map +0 -1
  241. package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
  242. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  243. package/dist/chunk-E2HZTGYX.js.map +0 -1
  244. package/dist/chunk-FVII3KHN.js.map +0 -1
  245. package/dist/chunk-GSFB537T.js.map +0 -1
  246. package/dist/chunk-HSHCCBIV.js.map +0 -1
  247. package/dist/chunk-IDTKF5EX.cjs.map +0 -1
  248. package/dist/chunk-IWWVPR3W.cjs.map +0 -1
  249. package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
  250. package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
  251. package/dist/chunk-MYJQELFN.cjs.map +0 -1
  252. package/dist/chunk-NGKKNSK6.js.map +0 -1
  253. package/dist/chunk-PTD6EDUU.js.map +0 -1
  254. package/dist/chunk-Q6IES3U2.js.map +0 -1
  255. package/dist/chunk-QWYFHQYK.cjs +0 -357
  256. package/dist/chunk-QWYFHQYK.cjs.map +0 -1
  257. package/dist/chunk-S24ZBUB4.js.map +0 -1
  258. package/dist/chunk-SYWR5G3T.js.map +0 -1
  259. package/dist/chunk-TRVWMKNE.cjs.map +0 -1
  260. package/dist/chunk-UDDVDQMF.js.map +0 -1
  261. package/dist/chunk-VACPZPUA.cjs.map +0 -1
  262. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  263. package/dist/chunk-Y6X7UJSD.js.map +0 -1
  264. package/dist/chunk-YCXRSWCQ.js.map +0 -1
package/src/llm-models.ts CHANGED
@@ -75,6 +75,38 @@ export interface LlmModelDef {
75
75
  * Capability-driven so `llmCompleteStructured` never hardcodes provider ids.
76
76
  */
77
77
  structuredOutputMode?: "anthropic-tool" | "kie-response-format" | "responses-json-schema"
78
+ /**
79
+ * For a model with NO trusted `structuredOutputMode`: the wire field a
80
+ * structured call still sends its schema in, as a hint the model reads but
81
+ * the provider was not found to hold its answer to. Read through
82
+ * {@link structuredWireMode}, which every request builder uses; everything
83
+ * that decides TRUST (STRUCTURED_VISION_MODELS, the structured-model
84
+ * filters) keeps reading `structuredOutputMode` alone, so a hinted model is
85
+ * never offered where guaranteed structured output is required. Every answer
86
+ * is still parsed, validated and re-asked by `llmCompleteStructured`, as for
87
+ * any model. Never set together with `structuredOutputMode` (registry test).
88
+ */
89
+ structuredOutputHint?: "kie-response-format" | "responses-json-schema"
90
+ /**
91
+ * The KIE lane sends this model's structured calls NO `response_format`: the
92
+ * schema rides the system prompt instead (the one-object rule and the schema,
93
+ * as the KIE Claude lane's prompt-JSON), in the wire form `response_format`
94
+ * sent (keyword-named properties aliased and restored on the answer; Google's
95
+ * compact form), and `llmCompleteStructured` parses, validates and re-asks the
96
+ * answer as it does for any model. When every KIE answer of an unpinned call
97
+ * fails validation, the direct lane, which enforces the schema, is asked once
98
+ * before the call fails. For a model whose KIE endpoint fails a request that
99
+ * carries `response_format`.
100
+ *
101
+ * Per LANE, not per model: `structuredOutputMode` stays, so the trust readers
102
+ * (STRUCTURED_VISION_MODELS, the structured-model filters) and the direct
103
+ * lane's enforced `responseJsonSchema` are unchanged. Nothing reads trust to
104
+ * skip validation, and only an `anthropic-tool` model streams partial values,
105
+ * so a KIE-served answer here is checked like any untrusted one. Only on a
106
+ * `kieFormat: "chat-completions"` model whose wire mode is
107
+ * `kie-response-format` (registry test).
108
+ */
109
+ kieSchemaInPrompt?: true
78
110
  /** If set, fallback to direct Anthropic SDK with this model ID when KIE.ai fails */
79
111
  directFallbackModel?: string
80
112
  /**
@@ -118,6 +150,27 @@ export interface LlmModelDef {
118
150
  directOnly?: true
119
151
  /** Effort levels this model accepts (ascending). Absent/empty = no effort lever, picker hidden. */
120
152
  reasoningEfforts?: readonly LlmReasoningEffort[]
153
+ /**
154
+ * true = a REQUESTED effort below this model's lowest level is sent as that
155
+ * lowest level, never as nothing ({@link effectiveReasoningEffort}): with no
156
+ * effort on the wire the provider runs this model at its HIGHEST level, so
157
+ * dropping a `none` request would buy the most reasoning instead of the
158
+ * least. Auto — no effort requested at all — still sends nothing. Absent =
159
+ * a request below the lowest level is dropped (Auto), the usual rule.
160
+ */
161
+ effortBelowLowestSendsLowest?: true
162
+ /**
163
+ * true = the PRICE of a call on this model depends on whether it sends a
164
+ * reasoning effort, not only on its lane: the aggregator adds input of its
165
+ * own to every call, whose size depends on it. So the model's price key
166
+ * names the effort a call sends ({@link llmPriceKey}: `:effort-<level>`),
167
+ * and every estimate surface quotes that call. The sizes themselves are
168
+ * backend data (`backend/src/lib/pricing/llm-cost.ts`), held to this flag by
169
+ * a backend test. No model sets it today (GPT-6.1 Terra did for part of
170
+ * 2026-11-12, until its aggregator's added input stopped depending on the
171
+ * effort).
172
+ */
173
+ effortPriced?: true
121
174
  /**
122
175
  * Effort levels available on the DIRECT lane, when the vendor's own API
123
176
  * accepts more than the aggregator does. Absent = the direct lane offers the
@@ -317,6 +370,9 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
317
370
  retired: true,
318
371
  vendor: "google",
319
372
  structuredOutputMode: "kie-response-format",
373
+ // The KIE endpoint is 3.8's, so it takes 3.8's rule: no `response_format`
374
+ // there, the schema in the prompt (see gemini-3.8-flash below).
375
+ kieSchemaInPrompt: true,
320
376
  supportsImages: true,
321
377
  // Google's own cap is 65,536, but the field feeds BOTH lanes and the KIE
322
378
  // flash endpoints cap at 8192 (the measured 3.6 posture) — stay at the
@@ -339,8 +395,9 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
339
395
  series: "Gemini",
340
396
  // Inherits "Newest" from 3.7 (demoted above). Deliberately does NOT name
341
397
  // agentic video: that capability exists only on the direct Google lane
342
- // (Interactions API, not wired here) and the modality caps below withhold
343
- // video — a picker desc must not promise a lever this entry cannot expose.
398
+ // (Interactions API, not wired here). Plain video + audio input is wired
399
+ // (LLM_MODALITY_CAPS below) — a picker desc must not promise a lever this
400
+ // entry cannot expose.
344
401
  desc: "Newest fast Gemini, agentic-tuned",
345
402
  tier: "economy",
346
403
  kieFormat: "chat-completions",
@@ -354,6 +411,16 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
354
411
  // is ENFORCED (the reply came back exact-schema valid, credits_consumed
355
412
  // present) — not merely accepted-and-ignored.
356
413
  structuredOutputMode: "kie-response-format",
414
+ // Since 2026-11-13 the KIE endpoint answers ANY request carrying
415
+ // `response_format` (json_schema strict or not, json_object; any effort or
416
+ // none; with or without media) with HTTP 200 and an in-band
417
+ // `{"code":500}` after ~34 s, while the same request without it answers;
418
+ // 3.6 Flash, 3.1 Pro and Carbon take the same body. So the KIE lane sends
419
+ // the schema in the prompt (measured: a real Video Analysis roll, video
420
+ // included, answered schema-valid that way). The direct lane keeps its
421
+ // enforced `responseJsonSchema` (asked once when a call's KIE answers never
422
+ // validate), and the trust this mode carries stays.
423
+ kieSchemaInPrompt: true,
357
424
  supportsImages: true,
358
425
  // 16384 here, NOT the 8192 its 3.6 / 3.7 siblings sit at. Those two stay at
359
426
  // the KIE-safe intersection because nobody measured their endpoints past
@@ -564,6 +631,54 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
564
631
  // ended early (one declined the task, one stopped on RECITATION).
565
632
  thinkingDefaultOn: true,
566
633
  },
634
+ {
635
+ id: "gemini-4-carbon",
636
+ displayName: "Gemini 4 Carbon",
637
+ series: "Gemini",
638
+ desc: "Deepest-reasoning Gemini, 1M context",
639
+ tier: "premium",
640
+ kieFormat: "chat-completions",
641
+ // KIE serves it on the OpenAI-compatible dialect under this slug
642
+ // (docs.kie.ai/market/gemini/gemini-4-carbon-openai — Argon's page with the
643
+ // name swapped). Unlike Argon's, this lane passed its probe (2026-11-12):
644
+ // every call answered, images read, a stream ended cleanly, no empty 200,
645
+ // no negative counts, no code-execution fences. KIE flags it "Chat only",
646
+ // like Argon: it may not back a tool-loop feature (none does today).
647
+ kieSlugOrModel: "gemini-4-carbon-openai",
648
+ vendor: "google",
649
+ // NO trusted `structuredOutputMode` (decided 2026-11-12): KIE did NOT
650
+ // enforce a `response_format` json_schema — both probe calls came back as
651
+ // JSON holding an off-enum value in the enum field ("cheerful and
652
+ // energized" for happy | sad). So it is not a STRUCTURED_VISION_MODELS
653
+ // member (not offered by describe-to-picker), and every answer is parsed,
654
+ // validated and re-asked by `llmCompleteStructured`.
655
+ // The schema still goes on the wire, as a hint (`structuredOutputHint`): as
656
+ // `response_format` on KIE (the probe's replies followed its shape, only the
657
+ // enum slipped) and as `responseJsonSchema` on the direct Google lane,
658
+ // which enforced it in the probe — on every attempt, the re-ask included.
659
+ structuredOutputHint: "kie-response-format",
660
+ supportsImages: true,
661
+ // The registry's usual 16384, as Argon. Every call is floored to the
662
+ // default 32768 (`thinkingDefaultOn`, below): Google lists an output cap of
663
+ // 32,768 (models.list) and accepted maxOutputTokens 65536; KIE's doc
664
+ // states up to 65,536 tokens, thinking included.
665
+ maxOutputTokens: 16384,
666
+ // KIE first, Google as the reliability fallback (and Advanced mode) — no
667
+ // `preferDirect`, no `directOnly`. Google serves `models/gemini-4-carbon`
668
+ // beside Argon (models.list, 2026-11-12).
669
+ directGeminiModel: "gemini-4-carbon",
670
+ // KIE's documented `reasoning_effort` enum, and the direct lane's ladder
671
+ // too: Google 400s thinkingLevel MINIMAL on this model ("not supported")
672
+ // and answers LOW / MEDIUM / HIGH (probed 2026-11-12) — Argon's shape. So
673
+ // no `none` (it maps to MINIMAL in the direct client) and no
674
+ // `directReasoningEfforts`: a `none` request clamps to Auto on both lanes.
675
+ reasoningEfforts: ["low", "medium", "high"],
676
+ // Reasons with no thinking param sent on both lanes: KIE's `total_tokens`
677
+ // ran well past prompt + completion on every no-effort call (its dialect
678
+ // reports no reasoning split), and Google's no-level call reported thought
679
+ // tokens. No `reasoningOutputFloor`: both lanes take the default 32768.
680
+ thinkingDefaultOn: true,
681
+ },
567
682
  {
568
683
  id: "claude-opus-4.7",
569
684
  displayName: "Claude Opus 4.7",
@@ -807,6 +922,43 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
807
922
  supportsTemperature: false,
808
923
  thinkingDefaultOn: true,
809
924
  },
925
+ {
926
+ id: "gpt-6.1-terra",
927
+ displayName: "GPT-6.1 Terra",
928
+ series: "GPT",
929
+ desc: "Fast, efficient GPT-6.1, sharp visual reasoning",
930
+ tier: "standard",
931
+ kieFormat: "responses",
932
+ // The GPT-6 wire (codex/v1/responses, derived from `vendor`); KIE's doc is
933
+ // 6.1 Sol's page with the name swapped and `none` added to the effort enum.
934
+ // Live-probed 2026-11-12: non-stream 16/16, `text.format` json_schema
935
+ // ENFORCED (asked for prose, it returned schema JSON with the enum
936
+ // honoured), data-URI vision, SSE deltas. Unlike luna / sol / 6.1 sol it
937
+ // reports REAL top-level `usage.input_tokens` — see `kieInputUntrusted` in
938
+ // backend/src/lib/llm/kie-cost.ts.
939
+ //
940
+ // KIE's endpoint adds its own instructions to every call and counts them as
941
+ // input. The hold and the estimate count them too
942
+ // (backend/src/lib/pricing/llm-cost.ts, `llmLaneAddedInputTokens`). They
943
+ // were several times larger with an effort sent on the morning of
944
+ // 2026-11-12 and the same size either way by that afternoon, so its price
945
+ // does not depend on the effort: not `effortPriced` (re-measure if KIE's
946
+ // reported input jumps again).
947
+ kieSlugOrModel: "gpt-6-1-terra",
948
+ vendor: "openai",
949
+ structuredOutputMode: "responses-json-schema",
950
+ supportsImages: true,
951
+ maxOutputTokens: 16384,
952
+ // NO `none` (decided 2026-11-12): KIE answers it, but a `none` sent on the
953
+ // wire is answered as an effort (it echoed `medium`) while reasoning no
954
+ // more than Auto. Clamping maps a `none` request to nothing sent (Auto).
955
+ reasoningEfforts: ["low", "medium", "high", "xhigh", "max"],
956
+ // Same doc as 6.1 Sol: no temperature lever.
957
+ supportsTemperature: false,
958
+ // NO `thinkingDefaultOn`: with no effort sent (and at low / medium / high)
959
+ // the probe reported 0 reasoning tokens; only xhigh (8) and max (27)
960
+ // reasoned, and those already floor the cap (`raiseToReasoningFloor`).
961
+ },
810
962
  {
811
963
  id: "grok-4.6",
812
964
  displayName: "Grok 4.6",
@@ -1036,12 +1188,49 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
1036
1188
  // KIE's documented enum. The endpoint accepted xhigh/none without error but
1037
1189
  // never echoes an effort back, so nothing beyond the doc is verifiable.
1038
1190
  reasoningEfforts: ["low", "medium", "high"],
1191
+ // Decided 2026-11-12: a request below `low` (`none`) is sent as `low`,
1192
+ // never as nothing — KIE runs Kimi at its highest level when no effort is
1193
+ // sent (K3.1 Pro's no-effort replies echoed `max`). Auto still sends nothing.
1194
+ effortBelowLowestSendsLowest: true,
1039
1195
  // The doc lists no `temperature` field at all.
1040
1196
  supportsTemperature: false,
1041
1197
  // "Reasons by default" per KIE's doc (its usage reports no reasoning-token
1042
1198
  // split, so this is the doc's word, not a measurement).
1043
1199
  thinkingDefaultOn: true,
1044
1200
  },
1201
+ {
1202
+ id: "kimi-k3.1-pro",
1203
+ displayName: "Kimi K3.1 Pro",
1204
+ series: "Kimi",
1205
+ desc: "Kimi tuned for coding and research, 1M context",
1206
+ tier: "premium",
1207
+ kieFormat: "responses",
1208
+ // Same openai/v1/responses family path and wire as kimi-k3 (KIE's doc is
1209
+ // K3's page with the name and the effort enum changed). Live-probed
1210
+ // 2026-11-12: non-stream 9/9, `text.format` json_schema ENFORCED (asked for
1211
+ // prose, it returned schema JSON with the enum honoured), data-URI vision,
1212
+ // real `usage.input_tokens` and `credits_consumed`. Its stream sends
1213
+ // `response.reasoning_text.delta` frames apart from the
1214
+ // `response.output_text.delta` ones, and only the latter are the answer.
1215
+ kieSlugOrModel: "kimi-k3-1-pro",
1216
+ vendor: "moonshot",
1217
+ structuredOutputMode: "responses-json-schema",
1218
+ supportsImages: true,
1219
+ maxOutputTokens: 16384,
1220
+ // KIE's documented enum (K3's was low / medium / high). Each level was
1221
+ // echoed back. An off-enum `medium` answered too (echoed as `high`), so it
1222
+ // is not offered: a `medium` request clamps down to `low`.
1223
+ reasoningEfforts: ["low", "high", "max"],
1224
+ // Decided 2026-11-12: a request below `low` (`none`) is sent as `low`,
1225
+ // never as nothing — with no effort sent KIE runs it at `max` (the probe's
1226
+ // no-effort replies echoed `max`). Auto still sends nothing.
1227
+ effortBelowLowestSendsLowest: true,
1228
+ // The doc lists no `temperature` field at all, as K3's.
1229
+ supportsTemperature: false,
1230
+ // Measured: every probe call reported reasoning tokens (20 to 163), the
1231
+ // no-effort ones included (they echoed effort `max`).
1232
+ thinkingDefaultOn: true,
1233
+ },
1045
1234
  {
1046
1235
  id: "deepseek-v4.1-flash",
1047
1236
  displayName: "DeepSeek V4.1 Flash",
@@ -1099,6 +1288,33 @@ export const STRUCTURED_VISION_MODELS = LLM_MODELS.filter(
1099
1288
  (m) => m.supportsImages && m.structuredOutputMode != null,
1100
1289
  )
1101
1290
 
1291
+ /**
1292
+ * How a structured call's schema goes on the wire for `model`: its trusted
1293
+ * `structuredOutputMode`, else its `structuredOutputHint`; undefined = the
1294
+ * schema is not sent at all (a model with neither: plain text, parsed and
1295
+ * re-asked). What the request builders read — never a TRUST decision, which
1296
+ * reads `structuredOutputMode` alone.
1297
+ */
1298
+ export function structuredWireMode(
1299
+ model: Pick<LlmModelDef, "structuredOutputMode" | "structuredOutputHint">,
1300
+ ): LlmModelDef["structuredOutputMode"] {
1301
+ return model.structuredOutputMode ?? model.structuredOutputHint
1302
+ }
1303
+
1304
+ /**
1305
+ * Does a structured call on `modelId` (unset = `feature`'s default model) send
1306
+ * its schema ({@link structuredWireMode})? On the wire, or in the system prompt
1307
+ * on a lane that carries it there (`kieSchemaInPrompt`): either way the model
1308
+ * reads it, so a request's size counts it. A schema that is not sent is not
1309
+ * read by the model. A model the registry does not know counts as yes (the
1310
+ * larger size).
1311
+ */
1312
+ export function llmSendsSchema(modelId: string | undefined, feature?: string): boolean {
1313
+ const id = modelId || (feature ? LLM_FEATURE_DEFAULTS[feature as LlmFeature] : undefined)
1314
+ const model = id ? getLlmModel(id) : undefined
1315
+ return !model || structuredWireMode(model) !== undefined
1316
+ }
1317
+
1102
1318
  /**
1103
1319
  * Models {@link STRUCTURED_VISION_MODELS} carries that describe-to-picker does
1104
1320
  * NOT offer — now none.
@@ -1352,6 +1568,10 @@ export function defaultReasoningEffort(feature: string, modelId?: string): LlmRe
1352
1568
  * input requires a separate audio-capable model we don't route to today.
1353
1569
  */
1354
1570
  export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean; audio: boolean }> = {
1571
+ // Keeps full caps after KIE dropped its channel (2026-11-13): it stays a
1572
+ // VIDEO_ANALYSIS_LLM_MODELS member as the legacy `fast` backing (below), so a
1573
+ // stored raw `llmModel: "gemini-3-flash"` still resolves and prices under its
1574
+ // own credit family.
1355
1575
  "gemini-3-flash": { image: true, video: true, audio: true },
1356
1576
  "gemini-3.6-flash": { image: true, video: true, audio: true },
1357
1577
  // gemini-3.7-flash is IMAGE-ONLY by DECISION, not omission: full video+audio
@@ -1360,15 +1580,13 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1360
1580
  // deferred while the smart-family A/B routes this model internally (#747).
1361
1581
  // Flip these two flags ONLY together with that VA-side decision.
1362
1582
  "gemini-3.7-flash": { image: true, video: false, audio: false },
1363
- // gemini-3.8-flash is IMAGE-ONLY by DECISION, not omission — 3.7's rationale
1364
- // exactly: full video+audio caps would auto-enroll it in
1365
- // VIDEO_ANALYSIS_LLM_MODELS (derived below) and force a video-analysis tier +
1366
- // pricing decision that stays deferred until the 3.8-vs-3.7 analysis A/B
1367
- // concludes. Google's own 3.8 lane DOES understand video (agentic video, via
1368
- // the Interactions API we don't wire) — which is precisely why withholding it
1369
- // has to be a decision rather than a gap. Flip these two flags ONLY together
1370
- // with that VA-side decision.
1371
- "gemini-3.8-flash": { image: true, video: false, audio: false },
1583
+ // gemini-3.8-flash takes video + audio (decided 2026-11-13): it backs the
1584
+ // video-analysis `fast` tier (VIDEO_ANALYSIS_TIERS below) since KIE dropped
1585
+ // gemini-3-flash's channel, which is what enrols it in
1586
+ // VIDEO_ANALYSIS_LLM_MODELS. Its KIE lane reads a video URL sent as an
1587
+ // `image_url` part, the same channel gemini-3-flash used (live-verified
1588
+ // 2026-11-13 with the analysis request: prompt tokens include the clip).
1589
+ "gemini-3.8-flash": { image: true, video: true, audio: true },
1372
1590
  "gemini-3.1-pro": { image: true, video: true, audio: true },
1373
1591
  // gemini-4-argon is IMAGE-ONLY by DECISION, not omission (decided 2026-10-17):
1374
1592
  // the model DOES read video and audio, but full caps would
@@ -1376,6 +1594,12 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1376
1594
  // video-analysis tier + pricing decision. That waits on a Video Analysis
1377
1595
  // bake-off; flip these two flags ONLY together with its outcome.
1378
1596
  "gemini-4-argon": { image: true, video: false, audio: false },
1597
+ // gemini-4-carbon is IMAGE-ONLY for now, by decision (2026-11-12): the model
1598
+ // reads video and audio, but full caps would auto-enroll it in
1599
+ // VIDEO_ANALYSIS_LLM_MODELS (derived below). Its video + audio input comes in
1600
+ // a follow-up change that also decides its Video Analysis enrolment; flip
1601
+ // these two flags ONLY together with that.
1602
+ "gemini-4-carbon": { image: true, video: false, audio: false },
1379
1603
  "claude-haiku-4.5": { image: true, video: false, audio: false },
1380
1604
  "claude-haiku-5.5": { image: true, video: false, audio: false },
1381
1605
  "claude-sonnet-4.6": { image: true, video: false, audio: false },
@@ -1392,6 +1616,8 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1392
1616
  "gpt-6-luna": { image: true, video: false, audio: false },
1393
1617
  "gpt-6-sol": { image: true, video: false, audio: false },
1394
1618
  "gpt-6.1-sol": { image: true, video: false, audio: false },
1619
+ // KIE's doc also takes files (PDFs, documents); that input is not wired here.
1620
+ "gpt-6.1-terra": { image: true, video: false, audio: false },
1395
1621
  "grok-4.6": { image: true, video: false, audio: false },
1396
1622
  "grok-4.7": { image: true, video: false, audio: false },
1397
1623
  "claude-sonnet-5": { image: true, video: false, audio: false },
@@ -1402,6 +1628,7 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1402
1628
  "claude-fable-5": { image: true, video: false, audio: false },
1403
1629
  // KIE documents text + image input only for both.
1404
1630
  "kimi-k3": { image: true, video: false, audio: false },
1631
+ "kimi-k3.1-pro": { image: true, video: false, audio: false },
1405
1632
  "deepseek-v4.1-flash": { image: true, video: false, audio: false },
1406
1633
  }
1407
1634
 
@@ -1479,7 +1706,12 @@ export function availableReasoningEfforts(
1479
1706
  return model.reasoningEfforts ?? []
1480
1707
  }
1481
1708
 
1482
- /** Highest level the model supports that is ≤ the requested level; undefined = treat as Auto. */
1709
+ /**
1710
+ * Highest level the model supports that is ≤ the requested level; undefined =
1711
+ * treat as Auto. A request below the model's lowest level is dropped (Auto) —
1712
+ * except on a model that declares `effortBelowLowestSendsLowest`, where it is
1713
+ * sent as that lowest level. No request at all is always Auto.
1714
+ */
1483
1715
  export function effectiveReasoningEffort(
1484
1716
  modelId: string | undefined,
1485
1717
  requested?: string,
@@ -1493,6 +1725,7 @@ export function effectiveReasoningEffort(
1493
1725
  for (const l of levels) {
1494
1726
  if (EFFORT_RANK[l] <= EFFORT_RANK[req] && (best === undefined || EFFORT_RANK[l] > EFFORT_RANK[best])) best = l
1495
1727
  }
1728
+ if (best === undefined && getLlmModel(modelId ?? "")?.effortBelowLowestSendsLowest) return levels[0]
1496
1729
  return best
1497
1730
  }
1498
1731
 
@@ -1610,12 +1843,16 @@ export function llmServesDirect(
1610
1843
  * `POST /v1/credits/model-costs` (or `GET /v1/credits/model-cost?model=`) for
1611
1844
  * the call's estimated price: `<feature>:<modelId>`, plus `:direct` when the
1612
1845
  * call is served on the vendor's own API ({@link llmServesDirect}), which is
1613
- * priced at the direct rate.
1846
+ * priced at the direct rate, or — on a model whose price depends on the effort
1847
+ * (`effortPriced`, served on the aggregator) — `:effort-<level>` naming the
1848
+ * effort the call sends. On every other model the effort changes the key only
1849
+ * through its lane. Read back by {@link parseLlmPriceKeyModel}.
1614
1850
  *
1615
1851
  * With no `reasoningEffort` the default effort of the feature the call
1616
1852
  * borrows its defaults from applies ({@link llmDefaultsFeature},
1617
1853
  * {@link defaultReasoningEffort}) — the effort the call then runs at — so the
1618
- * key names the lane the call is held and charged on.
1854
+ * key names the lane (and, where it matters, the effort) the call is held and
1855
+ * charged on.
1619
1856
  *
1620
1857
  * `modelId` must already be resolved: the model the call runs on, never empty
1621
1858
  * (a caller with no model passes the feature's default, `LLM_FEATURE_DEFAULTS`
@@ -1629,7 +1866,53 @@ export function llmPriceKey(
1629
1866
  ): string {
1630
1867
  if (!modelId) throw new TypeError(`llmPriceKey: modelId must be a resolved model id (feature "${feature}")`)
1631
1868
  const effort = reasoningEffort ?? defaultReasoningEffort(llmDefaultsFeature(feature), modelId)
1632
- return llmServesDirect(modelId, effort, advancedMode) ? `${feature}:${modelId}:direct` : `${feature}:${modelId}`
1869
+ if (llmServesDirect(modelId, effort, advancedMode)) return `${feature}:${modelId}${LLM_PRICE_KEY_DIRECT}`
1870
+ // A model whose price depends on the effort (`effortPriced`) names the one
1871
+ // the call sends — clamped as the aggregator's wire clamps it, so a level it
1872
+ // does not offer is the effort that is really sent (or none). Every other
1873
+ // model's key is unchanged.
1874
+ const sent = getLlmModel(modelId)?.effortPriced ? effectiveReasoningEffort(modelId, effort) : undefined
1875
+ return sent ? `${feature}:${modelId}${LLM_PRICE_KEY_EFFORT}${sent}` : `${feature}:${modelId}`
1876
+ }
1877
+
1878
+ /** The price-key suffix of a call served on the vendor's own API (see {@link llmPriceKey}). */
1879
+ export const LLM_PRICE_KEY_DIRECT = ":direct"
1880
+ /** The price-key suffix naming the effort a call sends, on an `effortPriced` model: `:effort-<level>`. */
1881
+ export const LLM_PRICE_KEY_EFFORT = ":effort-"
1882
+
1883
+ /** A price key's model part, read back by {@link parseLlmPriceKeyModel}. */
1884
+ export interface LlmPriceKeyModel {
1885
+ modelId: string
1886
+ /** Present only for a key that names the direct lane. */
1887
+ lane?: "direct"
1888
+ /** Present only for a key that names an effort (an `effortPriced` model's). */
1889
+ reasoningEffort?: LlmReasoningEffort
1890
+ }
1891
+
1892
+ const REGISTRY_MODEL_IDS: ReadonlySet<string> = new Set(LLM_MODEL_IDS)
1893
+
1894
+ /**
1895
+ * The part of a price key after its `<feature>:` — `<modelId>`,
1896
+ * `<modelId>:direct` or `<modelId>:effort-<level>` — read back, or null for
1897
+ * anything that is not a key {@link llmPriceKey} could build: a model that is
1898
+ * not a registry id (never a borrowed slug), an effort on a model whose price
1899
+ * does not depend on it, a level it does not offer on the aggregator, any
1900
+ * other suffix. The one reader both the server and the editor use, so every
1901
+ * key names exactly one price.
1902
+ */
1903
+ export function parseLlmPriceKeyModel(tail: string): LlmPriceKeyModel | null {
1904
+ if (REGISTRY_MODEL_IDS.has(tail)) return { modelId: tail }
1905
+ if (tail.endsWith(LLM_PRICE_KEY_DIRECT)) {
1906
+ const modelId = tail.slice(0, -LLM_PRICE_KEY_DIRECT.length)
1907
+ return REGISTRY_MODEL_IDS.has(modelId) ? { modelId, lane: "direct" } : null
1908
+ }
1909
+ const at = tail.lastIndexOf(LLM_PRICE_KEY_EFFORT)
1910
+ if (at <= 0) return null
1911
+ const modelId = tail.slice(0, at)
1912
+ const level = tail.slice(at + LLM_PRICE_KEY_EFFORT.length) as LlmReasoningEffort
1913
+ const model = REGISTRY_MODEL_IDS.has(modelId) ? getLlmModel(modelId) : undefined
1914
+ if (!model?.effortPriced || !availableReasoningEfforts(modelId).includes(level)) return null
1915
+ return { modelId, reasoningEffort: level }
1633
1916
  }
1634
1917
 
1635
1918
  /**
@@ -1715,7 +1998,7 @@ export const VIDEO_ANALYSIS_LLM_MODELS: string[] = LLM_MODELS
1715
1998
  * VIDEO_ANALYSIS_LLM_MODELS member AND every such model is reachable by a tier,
1716
1999
  * so adding a video model forces a tier decision instead of silently leaking.
1717
2000
  */
1718
- export const VIDEO_ANALYSIS_TIERS = { fast: "gemini-3-flash", pro: "gemini-3.1-pro" } as const
2001
+ export const VIDEO_ANALYSIS_TIERS = { fast: "gemini-3.8-flash", pro: "gemini-3.1-pro" } as const
1719
2002
  export type VideoAnalysisModelTier = keyof typeof VIDEO_ANALYSIS_TIERS
1720
2003
  /**
1721
2004
  * Models that PREVIOUSLY backed a tier, mapped to the tier they backed.
@@ -1736,6 +2019,12 @@ export const VIDEO_ANALYSIS_LEGACY_MODELS: Record<string, VideoAnalysisModelTier
1736
2019
  // belongs here: stored raw `llmModel` values keep resolving and keep pricing
1737
2020
  // under their own credit family.
1738
2021
  "gemini-3.6-flash": "fast",
2022
+ // Backed the fast tier from 2026-07-29 until 2026-11-13, when KIE dropped its
2023
+ // channel (every call answers `code 422 "The channel is not supported"`) and
2024
+ // the fast tier moved to gemini-3.8-flash. Stored raw `llmModel` values keep
2025
+ // resolving and keep pricing under their own credit family; the analysis
2026
+ // engine serves their rolls with the current fast model.
2027
+ "gemini-3-flash": "fast",
1739
2028
  }
1740
2029
  /**
1741
2030
  * MIXED tiers — advanced multi-engine analysis plans whose identifier resolves