@nodaro/shared 3.33.0 → 3.36.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 (266) hide show
  1. package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
  2. package/dist/chunk-2HIDE3QV.js.map +1 -0
  3. package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
  4. package/dist/chunk-2HVFF5SS.js.map +1 -0
  5. package/dist/{chunk-PVJBAPYJ.js → chunk-56VQ7V3V.js} +8 -5
  6. package/dist/chunk-56VQ7V3V.js.map +1 -0
  7. package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
  8. package/dist/chunk-6F6GGX2W.cjs.map +1 -0
  9. package/dist/{chunk-HKFMXNVQ.cjs → chunk-75ZMA34U.cjs} +11 -11
  10. package/dist/{chunk-HKFMXNVQ.cjs.map → chunk-75ZMA34U.cjs.map} +1 -1
  11. package/dist/{chunk-6WZ2VN7V.js → chunk-7AB3AE5L.js} +6 -6
  12. package/dist/{chunk-6WZ2VN7V.js.map → chunk-7AB3AE5L.js.map} +1 -1
  13. package/dist/{chunk-VXPLKQWY.cjs → chunk-7VQPHLZ5.cjs} +30 -40
  14. package/dist/chunk-7VQPHLZ5.cjs.map +1 -0
  15. package/dist/{chunk-BG5D5CZ6.js → chunk-ANOQWAMU.js} +23 -6
  16. package/dist/chunk-ANOQWAMU.js.map +1 -0
  17. package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
  18. package/dist/chunk-AWWOQH46.cjs.map +1 -0
  19. package/dist/{chunk-PXFQVLBX.js → chunk-AXUW64ZY.js} +26 -36
  20. package/dist/chunk-AXUW64ZY.js.map +1 -0
  21. package/dist/{chunk-FT5CF6IA.js → chunk-AZBIXGM5.js} +3 -3
  22. package/dist/{chunk-FT5CF6IA.js.map → chunk-AZBIXGM5.js.map} +1 -1
  23. package/dist/{chunk-D6GNRSCV.cjs → chunk-BBLE4UTG.cjs} +23 -6
  24. package/dist/chunk-BBLE4UTG.cjs.map +1 -0
  25. package/dist/{chunk-HUR6ZJ7S.cjs → chunk-BSQCKTXH.cjs} +6 -6
  26. package/dist/{chunk-HUR6ZJ7S.cjs.map → chunk-BSQCKTXH.cjs.map} +1 -1
  27. package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
  28. package/dist/chunk-BVVKMQKR.cjs.map +1 -0
  29. package/dist/{chunk-SAW5OK36.cjs → chunk-BYP62B7F.cjs} +6 -6
  30. package/dist/{chunk-SAW5OK36.cjs.map → chunk-BYP62B7F.cjs.map} +1 -1
  31. package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
  32. package/dist/chunk-C4R7BTBQ.js.map +1 -0
  33. package/dist/{chunk-UCFWI6D4.js → chunk-CMH2ACOX.js} +3 -3
  34. package/dist/{chunk-UCFWI6D4.js.map → chunk-CMH2ACOX.js.map} +1 -1
  35. package/dist/{chunk-WD6HJRBG.cjs → chunk-DE3PEIIP.cjs} +21 -21
  36. package/dist/{chunk-WD6HJRBG.cjs.map → chunk-DE3PEIIP.cjs.map} +1 -1
  37. package/dist/{chunk-SFW3UB2P.js → chunk-DKTRVOU5.js} +4 -4
  38. package/dist/{chunk-SFW3UB2P.js.map → chunk-DKTRVOU5.js.map} +1 -1
  39. package/dist/{chunk-YBPBK5KI.js → chunk-FKQJYMCO.js} +97 -23
  40. package/dist/chunk-FKQJYMCO.js.map +1 -0
  41. package/dist/{chunk-ZDFHA2EC.js → chunk-FVKCNAEQ.js} +51 -7
  42. package/dist/chunk-FVKCNAEQ.js.map +1 -0
  43. package/dist/{chunk-OZSACQ2V.js → chunk-GW54ANCH.js} +3 -3
  44. package/dist/{chunk-OZSACQ2V.js.map → chunk-GW54ANCH.js.map} +1 -1
  45. package/dist/chunk-GZH2SIOF.cjs +99 -0
  46. package/dist/chunk-GZH2SIOF.cjs.map +1 -0
  47. package/dist/{chunk-M7GQBRZU.cjs → chunk-HABDAHZR.cjs} +153 -24
  48. package/dist/chunk-HABDAHZR.cjs.map +1 -0
  49. package/dist/{chunk-CUH22J4D.js → chunk-IIGKJYWL.js} +3 -3
  50. package/dist/{chunk-CUH22J4D.js.map → chunk-IIGKJYWL.js.map} +1 -1
  51. package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
  52. package/dist/chunk-J65CAOUV.cjs.map +1 -0
  53. package/dist/{chunk-HRXEZ3SX.cjs → chunk-JABZNRXL.cjs} +4 -4
  54. package/dist/{chunk-HRXEZ3SX.cjs.map → chunk-JABZNRXL.cjs.map} +1 -1
  55. package/dist/{chunk-5RYLK3MQ.js → chunk-JMUHMLJP.js} +11 -6
  56. package/dist/chunk-JMUHMLJP.js.map +1 -0
  57. package/dist/{chunk-K3LLGRK7.cjs → chunk-KOP7UTQR.cjs} +72 -15
  58. package/dist/chunk-KOP7UTQR.cjs.map +1 -0
  59. package/dist/{chunk-HC7VKIV5.cjs → chunk-LT5IJO4Y.cjs} +49 -46
  60. package/dist/chunk-LT5IJO4Y.cjs.map +1 -0
  61. package/dist/{chunk-VA42637J.cjs → chunk-MSDECC3A.cjs} +46 -41
  62. package/dist/chunk-MSDECC3A.cjs.map +1 -0
  63. package/dist/{chunk-JFS3NWZ5.cjs → chunk-MSIIC6MY.cjs} +7 -4
  64. package/dist/chunk-MSIIC6MY.cjs.map +1 -0
  65. package/dist/{chunk-D26ENTN2.cjs → chunk-NITAUX3A.cjs} +80 -52
  66. package/dist/chunk-NITAUX3A.cjs.map +1 -0
  67. package/dist/{chunk-23FJQTEA.js → chunk-NTHRTRQK.js} +38 -15
  68. package/dist/chunk-NTHRTRQK.js.map +1 -0
  69. package/dist/{chunk-OTATNBMD.js → chunk-NYMOHNYV.js} +3 -3
  70. package/dist/{chunk-OTATNBMD.js.map → chunk-NYMOHNYV.js.map} +1 -1
  71. package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
  72. package/dist/chunk-OHSIVNJO.js.map +1 -0
  73. package/dist/{chunk-7Z5LUTGU.js → chunk-QXTCIJP5.js} +6 -3
  74. package/dist/{chunk-JFS3NWZ5.cjs.map → chunk-QXTCIJP5.js.map} +1 -1
  75. package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
  76. package/dist/chunk-R2VF5NQG.cjs.map +1 -0
  77. package/dist/{chunk-UTQSSKSG.js → chunk-SPP6HQMM.js} +4 -4
  78. package/dist/{chunk-UTQSSKSG.js.map → chunk-SPP6HQMM.js.map} +1 -1
  79. package/dist/chunk-TCBHVIMD.js +89 -0
  80. package/dist/chunk-TCBHVIMD.js.map +1 -0
  81. package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
  82. package/dist/chunk-UJJUX6NW.cjs.map +1 -0
  83. package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
  84. package/dist/chunk-V3N56Z2S.cjs.map +1 -0
  85. package/dist/{chunk-PHZ23DP3.js → chunk-VRLRPGO7.js} +125 -12
  86. package/dist/chunk-VRLRPGO7.js.map +1 -0
  87. package/dist/{chunk-WKOIGLQX.cjs → chunk-VRUN5TG2.cjs} +8 -8
  88. package/dist/{chunk-WKOIGLQX.cjs.map → chunk-VRUN5TG2.cjs.map} +1 -1
  89. package/dist/{chunk-QA3MVQ32.js → chunk-W4GABGRD.js} +6 -6
  90. package/dist/chunk-W4GABGRD.js.map +1 -0
  91. package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
  92. package/dist/chunk-WXNQMJ67.js.map +1 -0
  93. package/dist/chunk-XJ3HJSO5.cjs +25 -0
  94. package/dist/chunk-XJ3HJSO5.cjs.map +1 -0
  95. package/dist/{chunk-XGFTL5XY.js → chunk-YHCG3HOR.js} +3 -3
  96. package/dist/{chunk-XGFTL5XY.js.map → chunk-YHCG3HOR.js.map} +1 -1
  97. package/dist/{chunk-VNQRI2RO.cjs → chunk-YN6AXDN5.cjs} +16 -16
  98. package/dist/{chunk-VNQRI2RO.cjs.map → chunk-YN6AXDN5.cjs.map} +1 -1
  99. package/dist/{chunk-2NQLSLSN.cjs → chunk-YNJ44IAL.cjs} +5 -5
  100. package/dist/{chunk-2NQLSLSN.cjs.map → chunk-YNJ44IAL.cjs.map} +1 -1
  101. package/dist/{chunk-ZL7UM6PU.cjs → chunk-YSEM7JDE.cjs} +4 -4
  102. package/dist/{chunk-ZL7UM6PU.cjs.map → chunk-YSEM7JDE.cjs.map} +1 -1
  103. package/dist/{chunk-ZO5PBBFX.js → chunk-ZG4XSEZV.js} +72 -15
  104. package/dist/chunk-ZG4XSEZV.js.map +1 -0
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.d.cts +2 -2
  107. package/dist/entries/apps.d.ts +2 -2
  108. package/dist/entries/apps.js +8 -7
  109. package/dist/entries/catalogs.d.cts +1 -1
  110. package/dist/entries/catalogs.d.ts +1 -1
  111. package/dist/entries/credits.cjs +153 -153
  112. package/dist/entries/credits.d.cts +1 -1
  113. package/dist/entries/credits.d.ts +1 -1
  114. package/dist/entries/credits.js +8 -8
  115. package/dist/entries/edl.cjs +130 -102
  116. package/dist/entries/edl.d.cts +74 -3
  117. package/dist/entries/edl.d.ts +74 -3
  118. package/dist/entries/edl.js +2 -2
  119. package/dist/entries/entities.cjs +126 -122
  120. package/dist/entries/entities.d.cts +2 -2
  121. package/dist/entries/entities.d.ts +2 -2
  122. package/dist/entries/entities.js +1 -1
  123. package/dist/entries/i18n.cjs +11 -11
  124. package/dist/entries/i18n.d.cts +2 -2
  125. package/dist/entries/i18n.d.ts +2 -2
  126. package/dist/entries/i18n.js +1 -1
  127. package/dist/entries/llm-models.cjs +63 -43
  128. package/dist/entries/llm-models.d.cts +71 -4
  129. package/dist/entries/llm-models.d.ts +71 -4
  130. package/dist/entries/llm-models.js +1 -1
  131. package/dist/entries/media.cjs +45 -41
  132. package/dist/entries/media.d.cts +39 -1
  133. package/dist/entries/media.d.ts +39 -1
  134. package/dist/entries/media.js +1 -1
  135. package/dist/entries/model-catalog.cjs +66 -66
  136. package/dist/entries/model-catalog.d.cts +2 -2
  137. package/dist/entries/model-catalog.d.ts +2 -2
  138. package/dist/entries/model-catalog.js +4 -4
  139. package/dist/entries/models.cjs +274 -210
  140. package/dist/entries/models.d.cts +3 -3
  141. package/dist/entries/models.d.ts +3 -3
  142. package/dist/entries/models.js +5 -5
  143. package/dist/entries/nodes.cjs +222 -201
  144. package/dist/entries/nodes.d.cts +48 -8
  145. package/dist/entries/nodes.d.ts +48 -8
  146. package/dist/entries/nodes.js +10 -9
  147. package/dist/entries/pipeline.cjs +149 -149
  148. package/dist/entries/pipeline.d.cts +8 -4
  149. package/dist/entries/pipeline.d.ts +8 -4
  150. package/dist/entries/pipeline.js +3 -3
  151. package/dist/entries/social.cjs +174 -174
  152. package/dist/entries/social.d.cts +13 -5
  153. package/dist/entries/social.d.ts +13 -5
  154. package/dist/entries/social.js +2 -2
  155. package/dist/entries/types.d.cts +1 -1
  156. package/dist/entries/types.d.ts +1 -1
  157. package/dist/entries/ugc.cjs +71 -71
  158. package/dist/entries/ugc.js +4 -4
  159. package/dist/entries/video.cjs +115 -115
  160. package/dist/entries/video.d.cts +4 -3
  161. package/dist/entries/video.d.ts +4 -3
  162. package/dist/entries/video.js +4 -4
  163. package/dist/entries/workflow.cjs +96 -95
  164. package/dist/entries/workflow.d.cts +7 -18
  165. package/dist/entries/workflow.d.ts +7 -18
  166. package/dist/entries/workflow.js +2 -1
  167. package/dist/index.cjs +1708 -1567
  168. package/dist/index.d.cts +9 -9
  169. package/dist/index.d.ts +9 -9
  170. package/dist/index.js +26 -25
  171. package/dist/{model-catalog-V-ZNzRSd.d.ts → model-catalog-I48SvalA.d.cts} +25 -0
  172. package/dist/{model-catalog-V-ZNzRSd.d.cts → model-catalog-I48SvalA.d.ts} +25 -0
  173. package/dist/{presentation-utils-D0kxsWf9.d.cts → presentation-utils-A4i92SYo.d.cts} +1 -1
  174. package/dist/{presentation-utils-pZwlEAzo.d.ts → presentation-utils-DjdPtM9k.d.ts} +1 -1
  175. package/dist/{scene-node-types-C3kl_zyK.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
  176. package/dist/{scene-node-types-C3kl_zyK.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
  177. package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.cts} +0 -5
  178. package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.ts} +0 -5
  179. package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.cts} +8 -1
  180. package/dist/{types-BRlFPEru.d.cts → types-DzUBR7yr.d.ts} +8 -1
  181. package/package.json +1 -1
  182. package/src/__tests__/camera-switch-contract.test.ts +33 -1
  183. package/src/__tests__/character-mention-slug.test.ts +0 -8
  184. package/src/__tests__/effective-tier.test.ts +3 -14
  185. package/src/__tests__/fixtures/camera-switch-speaker-map-parity.json +178 -0
  186. package/src/__tests__/fixtures/root-exports.baseline.json +21 -0
  187. package/src/__tests__/fixtures/speaker-map-camera-ids.json +26 -0
  188. package/src/__tests__/gvp-supported-providers.test.ts +1 -0
  189. package/src/__tests__/i18n-locale-completeness.test.ts +38 -3
  190. package/src/__tests__/llm-models.test.ts +200 -20
  191. package/src/__tests__/node-preset-extract.test.ts +10 -0
  192. package/src/__tests__/preview-gate-use-case.test.ts +16 -1
  193. package/src/__tests__/producer-types.test.ts +19 -0
  194. package/src/__tests__/run-continuation.test.ts +4 -1
  195. package/src/__tests__/speaker-map-contract.test.ts +48 -0
  196. package/src/__tests__/unit-contract-compose.test.ts +129 -0
  197. package/src/__tests__/unit-contracts.test.ts +134 -0
  198. package/src/__tests__/use-case-types.test.ts +33 -0
  199. package/src/__tests__/video-catalog-totality.test.ts +15 -1
  200. package/src/__tests__/video-collapse-parity.test.ts +10 -0
  201. package/src/__tests__/video-frame-slot.test.ts +85 -0
  202. package/src/__tests__/video-mode-aliases.test.ts +1 -0
  203. package/src/__tests__/video-reference-only.test.ts +117 -0
  204. package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
  205. package/src/camera-switch-contract.ts +36 -2
  206. package/src/credit-identifiers.ts +19 -6
  207. package/src/entity-asset-types.ts +13 -0
  208. package/src/entries/edl.ts +2 -0
  209. package/src/entries/llm-models.ts +5 -0
  210. package/src/entries/media.ts +1 -0
  211. package/src/entries/models.ts +25 -0
  212. package/src/entries/nodes.ts +5 -1
  213. package/src/fan-out-rows.ts +36 -3
  214. package/src/generate-mask.ts +40 -0
  215. package/src/generated/unit-contracts.ts +58 -0
  216. package/src/i18n/types.ts +13 -2
  217. package/src/json-kinds.ts +24 -4
  218. package/src/llm-models.ts +184 -31
  219. package/src/meta-ads-scrape.ts +16 -8
  220. package/src/model-catalog.ts +91 -13
  221. package/src/model-constants.ts +260 -5
  222. package/src/node-default-mappings.ts +3 -0
  223. package/src/node-preset-extract.ts +8 -0
  224. package/src/pipeline-types.ts +3 -0
  225. package/src/presentation-utils.ts +12 -12
  226. package/src/preview-gate.ts +4 -2
  227. package/src/producer-types.ts +19 -19
  228. package/src/run-continuation.ts +26 -4
  229. package/src/speaker-layouts.ts +8 -3
  230. package/src/speaker-map-contract.ts +77 -0
  231. package/src/unit-contract-compose.ts +55 -0
  232. package/src/use-case-types.ts +19 -0
  233. package/src/video-ui-defaults.ts +7 -5
  234. package/dist/chunk-23FJQTEA.js.map +0 -1
  235. package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
  236. package/dist/chunk-5RYLK3MQ.js.map +0 -1
  237. package/dist/chunk-7Z5LUTGU.js.map +0 -1
  238. package/dist/chunk-BG5D5CZ6.js.map +0 -1
  239. package/dist/chunk-CK3GK34R.js.map +0 -1
  240. package/dist/chunk-D26ENTN2.cjs.map +0 -1
  241. package/dist/chunk-D6GNRSCV.cjs.map +0 -1
  242. package/dist/chunk-HC7VKIV5.cjs.map +0 -1
  243. package/dist/chunk-HGC5JNVA.cjs.map +0 -1
  244. package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
  245. package/dist/chunk-K3LLGRK7.cjs.map +0 -1
  246. package/dist/chunk-M36G6SRP.js.map +0 -1
  247. package/dist/chunk-M7GQBRZU.cjs.map +0 -1
  248. package/dist/chunk-PHZ23DP3.js.map +0 -1
  249. package/dist/chunk-PQHS255G.js.map +0 -1
  250. package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
  251. package/dist/chunk-PVJBAPYJ.js.map +0 -1
  252. package/dist/chunk-PXFQVLBX.js.map +0 -1
  253. package/dist/chunk-QA3MVQ32.js.map +0 -1
  254. package/dist/chunk-SES6GDBQ.cjs.map +0 -1
  255. package/dist/chunk-TU33KYKW.cjs +0 -25
  256. package/dist/chunk-TU33KYKW.cjs.map +0 -1
  257. package/dist/chunk-VA42637J.cjs.map +0 -1
  258. package/dist/chunk-VXPLKQWY.cjs.map +0 -1
  259. package/dist/chunk-WDIBOWAA.js.map +0 -1
  260. package/dist/chunk-YBPBK5KI.js.map +0 -1
  261. package/dist/chunk-YYV35XOS.js.map +0 -1
  262. package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
  263. package/dist/chunk-ZDFHA2EC.js.map +0 -1
  264. package/dist/chunk-ZO5PBBFX.js.map +0 -1
  265. package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
  266. package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
package/src/llm-models.ts CHANGED
@@ -33,6 +33,24 @@ export interface LlmModelDef {
33
33
  * For messages: the model id sent in the body (e.g. "claude-haiku-4-5-v1messages").
34
34
  * For responses: the model id sent in the body (e.g. "gpt-5-4"). */
35
35
  kieSlugOrModel: string
36
+ /**
37
+ * The registry id of the model the aggregator ACTUALLY answers this id's KIE
38
+ * lane with, when that is a different model. Set together with borrowing
39
+ * that model's `kieSlugOrModel`, so the wire names what really runs. Only
40
+ * the KIE lane is affected: the direct lane still serves `directGeminiModel`.
41
+ * The KIE lane is costed on that model's KIE rate row. A lookup by the
42
+ * borrowed slug ({@link getLlmModel}) always resolves to its owner, never
43
+ * to the borrower. Absent = KIE serves this id as itself.
44
+ */
45
+ kieServedAs?: string
46
+ /**
47
+ * true = no longer offered: every model menu and advertised list leaves it
48
+ * out ({@link PICKABLE_LLM_MODELS}, {@link groupLlmModelsByVendor}), while
49
+ * the id stays in {@link LLM_MODEL_IDS}, so a saved node or API call that
50
+ * names it keeps validating, resolving and running exactly as before. No
51
+ * default may point at a retired model (registry test).
52
+ */
53
+ retired?: true
36
54
  vendor: LlmVendor
37
55
  supportsImages: boolean
38
56
  maxOutputTokens: number
@@ -77,6 +95,20 @@ export interface LlmModelDef {
77
95
  * idea. Guarded by a registry test so the two can't both be set.
78
96
  */
79
97
  preferDirect?: true
98
+ /**
99
+ * true = served ONLY on the vendor's own API (`directGeminiModel`): KIE is
100
+ * never called for this model — not as the primary lane, not as a failure
101
+ * or exhausted-account fallback, not on a pin. `kieSlugOrModel` still names
102
+ * the aggregator's endpoint, for the record and for a later re-enable after
103
+ * a re-probe; nothing sends to it.
104
+ *
105
+ * Every call therefore runs direct, so {@link llmServesDirect} is true for it
106
+ * and it bills on the direct rung by default, Advanced mode or not. Without a
107
+ * direct key the call fails as provider-unavailable rather than reaching KIE.
108
+ * Stronger than `preferDirect` (which keeps KIE as the fallback); the two are
109
+ * mutually exclusive, as are `directOnly` and `preferKie` (registry test).
110
+ */
111
+ directOnly?: true
80
112
  /** Effort levels this model accepts (ascending). Absent/empty = no effort lever, picker hidden. */
81
113
  reasoningEfforts?: readonly LlmReasoningEffort[]
82
114
  /**
@@ -265,10 +297,14 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
265
297
  desc: "Fast Gemini, agentic-tuned",
266
298
  tier: "economy",
267
299
  kieFormat: "chat-completions",
268
- // KIE serves it on the OpenAI-compatible dialect under this slug
269
- // (docs.kie.ai/market/gemini/gemini-3-7-flash-openai.md) — same
270
- // chat-completions path shape as gemini-3.6-flash.
271
- kieSlugOrModel: "gemini-3-7-flash-openai",
300
+ // Retired 2026-10-19: the aggregator answers this model's own endpoint
301
+ // (`gemini-3-7-flash-openai`) with 3.8, so the KIE lane now names 3.8's
302
+ // endpoint outright and says so. The direct Google lane below still serves
303
+ // real 3.7, Advanced mode included. The entry leaves every picker; saved
304
+ // nodes and API callers that name the id keep running unchanged.
305
+ kieSlugOrModel: "gemini-3-8-flash-openai",
306
+ kieServedAs: "gemini-3.8-flash",
307
+ retired: true,
272
308
  vendor: "google",
273
309
  structuredOutputMode: "kie-response-format",
274
310
  supportsImages: true,
@@ -462,6 +498,55 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
462
498
  thinkingDefaultOn: true,
463
499
  reasoningOutputFloor: 16384,
464
500
  },
501
+ {
502
+ id: "gemini-4-argon",
503
+ displayName: "Gemini 4 Argon",
504
+ desc: "Newest premium Gemini, 1M context",
505
+ tier: "premium",
506
+ kieFormat: "chat-completions",
507
+ // DIRECT-ONLY (decided 2026-10-17): KIE serves it on the OpenAI-compatible
508
+ // dialect under this slug (docs.kie.ai/market/gemini/gemini-4-argon-openai.md,
509
+ // byte-identical to the 3.8 Flash spec apart from the name), but that lane
510
+ // failed its probe the same day — of 15 completed calls, 6 came back HTTP 200
511
+ // `finish_reason: stop` with an EMPTY reply (both image calls among them,
512
+ // each still charged), `completion_tokens` was NEGATIVE on reasoning calls
513
+ // (-33, -38), replies leaked code-execution fences (```python?code_reference),
514
+ // `response_format` json_schema left an enum field holding prose, and an
515
+ // off-enum `reasoning_effort: medium` was an empty 200 rather than an error.
516
+ // So no call reaches KIE (`directOnly`); the slug is kept for the record.
517
+ // Re-enable it only after a re-probe of that lane comes back clean.
518
+ // KIE also flags the page "Chat only — not yet adapted for agent use", like
519
+ // kimi-k3 / deepseek below: it may not back a tool-loop feature. No registry
520
+ // gate enforces that today — the only tool loops (Workflow Copilot, the
521
+ // pipeline stage calls) are Claude-only by construction.
522
+ kieSlugOrModel: "gemini-4-argon-openai",
523
+ vendor: "google",
524
+ // The direct lane enforces `responseJsonSchema` (an enum field came back
525
+ // in-enum, 2026-10-17). This mode is what turns that schema on there.
526
+ structuredOutputMode: "kie-response-format",
527
+ supportsImages: true,
528
+ // The registry's usual 16384 default. Google's own cap is 32,768
529
+ // (models.list); every call is floored to that (`thinkingDefaultOn`, below).
530
+ maxOutputTokens: 16384,
531
+ directGeminiModel: "gemini-4-argon",
532
+ directOnly: true,
533
+ // The direct lane's ladder, and the only one: every call runs there.
534
+ // Google rejects thinkingLevel MINIMAL on this model with a 400 ("not
535
+ // supported for this model") and accepts LOW / MEDIUM / HIGH (probed
536
+ // 2026-10-17) — 3.1 Pro's shape, not the flash one. `none` maps to MINIMAL
537
+ // in the direct client, so it is not offered; a `none` request clamps to
538
+ // Auto.
539
+ reasoningEfforts: ["low", "medium", "high"],
540
+ // Gemini's documented default (dynamic thinking with no param sent). The no-param
541
+ // call reported no thought tokens on a two-part puzzle (HIGH reported 452),
542
+ // so this is the vendor default rather than a measurement — kept because it
543
+ // only raises the output ceiling. No `reasoningOutputFloor`: its one lane
544
+ // is Google's, whose cap IS the default 32768 (models.list), and calls sent
545
+ // maxOutputTokens 32768 / 65536 were served, not refused (2026-10-17). How
546
+ // much output it gives at that cap is unmeasured — both long-output probes
547
+ // ended early (one declined the task, one stopped on RECITATION).
548
+ thinkingDefaultOn: true,
549
+ },
465
550
  {
466
551
  id: "claude-opus-4.7",
467
552
  displayName: "Claude Opus 4.7",
@@ -948,6 +1033,24 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
948
1033
 
949
1034
  export const LLM_MODEL_IDS = LLM_MODELS.map((m) => m.id)
950
1035
 
1036
+ /** True when the model is registered but retired (see `LlmModelDef.retired`). */
1037
+ export function isLlmModelRetired(id: string): boolean {
1038
+ return getLlmModel(id)?.retired === true
1039
+ }
1040
+
1041
+ /** The models a picker may OFFER: the registry minus retired entries. The
1042
+ * accepted set is still {@link LLM_MODEL_IDS}. */
1043
+ export const PICKABLE_LLM_MODELS: readonly LlmModelDef[] = LLM_MODELS.filter((m) => !m.retired)
1044
+
1045
+ /**
1046
+ * {@link PICKABLE_LLM_MODELS}, plus `currentId`'s own entry when it is a
1047
+ * retired model — for a plain select that has to keep showing a saved node's
1048
+ * value as selected. Registry order either way.
1049
+ */
1050
+ export function pickableLlmModels(currentId?: string): LlmModelDef[] {
1051
+ return LLM_MODELS.filter((m) => !m.retired || m.id === currentId)
1052
+ }
1053
+
951
1054
  /** Vision models that can return GUARANTEED structured output — the
952
1055
  * describe-to-picker analyzer forces a schema over an image, so its model
953
1056
  * pickers AND the backend route gate offer exactly these: Anthropic (forced
@@ -991,12 +1094,14 @@ export interface LlmModelGroup {
991
1094
  * A flat registry-order dump was genuinely hard to scan at 17 models — every
992
1095
  * picker (config panel, quick strips, quick toolbar) derives from this so the
993
1096
  * menus can't drift apart. Groups with no models (after `filter`) are omitted.
1097
+ * Retired models are never listed, whatever list is passed in: a menu offers
1098
+ * only what can be picked (a saved retired value is labelled by the caller).
994
1099
  */
995
1100
  export function groupLlmModelsByVendor(models: readonly LlmModelDef[] = LLM_MODELS): LlmModelGroup[] {
996
1101
  const groups: LlmModelGroup[] = []
997
1102
  for (const vendor of LLM_VENDOR_ORDER) {
998
1103
  const members = models
999
- .filter((m) => m.vendor === vendor)
1104
+ .filter((m) => m.vendor === vendor && !m.retired)
1000
1105
  .sort((a, b) => TIER_RANK[a.tier] - TIER_RANK[b.tier])
1001
1106
  if (members.length > 0) groups.push({ vendor, label: LLM_VENDOR_LABELS[vendor], models: members })
1002
1107
  }
@@ -1057,17 +1162,17 @@ export function motionGraphicsFeature(engine?: string): LlmFeature {
1057
1162
 
1058
1163
  /** Feature → default model when user hasn't selected one */
1059
1164
  export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1060
- "ai-writer": "claude-sonnet-4.6",
1165
+ "ai-writer": "claude-sonnet-5.5",
1061
1166
  "llm-chat": "gemini-3.6-flash",
1062
1167
  "prompt-helper": "gemini-3.6-flash",
1063
- "scene-graph-ai": "claude-sonnet-4.6",
1064
- "after-effects": "claude-sonnet-4.6",
1065
- "motion-graphics": "claude-sonnet-4.6",
1066
- "motion-graphics-lottie": "claude-sonnet-4.6",
1067
- "lottie-overlay": "claude-sonnet-4.6",
1068
- "3d-title": "claude-sonnet-4.6",
1069
- "3d-scene": "claude-sonnet-4.6",
1070
- "image-to-text": "claude-sonnet-4.6",
1168
+ "scene-graph-ai": "claude-sonnet-5.5",
1169
+ "after-effects": "claude-sonnet-5.5",
1170
+ "motion-graphics": "claude-sonnet-5.5",
1171
+ "motion-graphics-lottie": "claude-sonnet-5.5",
1172
+ "lottie-overlay": "claude-sonnet-5.5",
1173
+ "3d-title": "claude-sonnet-5.5",
1174
+ "3d-scene": "claude-sonnet-5.5",
1175
+ "image-to-text": "claude-sonnet-5.5",
1071
1176
  // Economy on purpose: the analysis reads ONE frame + the copy per ad and
1072
1177
  // runs once per returned ad — volume, not depth. Must stay an image-capable
1073
1178
  // structured-output model (STRUCTURED_VISION_MODELS); a registry test pins it.
@@ -1078,8 +1183,8 @@ export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1078
1183
  "qa-check": "gemini-3.6-flash",
1079
1184
  "generate-script": "gemini-3.6-flash",
1080
1185
  "translate": "gemini-3.6-flash",
1081
- "image-critic": "claude-sonnet-4.6",
1082
- "pick-best-llm": "claude-sonnet-4.6",
1186
+ "image-critic": "claude-sonnet-5.5",
1187
+ "pick-best-llm": "claude-sonnet-5.5",
1083
1188
  "workflow-copilot": "claude-sonnet-5",
1084
1189
  // Both economy on purpose — measured: ten ideas in Hebrew took ~1 min here
1085
1190
  // and ~3.5 min (two calls) on claude-sonnet-4.6. The private plugin keeps
@@ -1088,6 +1193,21 @@ export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1088
1193
  "content-ideas": "gemini-3.6-flash",
1089
1194
  }
1090
1195
 
1196
+ /**
1197
+ * The model describe-to-picker re-asks ONCE when a Claude analyzer could not
1198
+ * answer for a platform-side reason: its direct lane down or the platform's
1199
+ * account refused, and the KIE retry of the same Claude model failing too,
1200
+ * answering with nothing valid, or answering empty. KIE's Claude endpoint
1201
+ * drops images when tools are sent, so that retry is the weak leg; see
1202
+ * backend/src/lib/llm/kie-lane.ts.
1203
+ *
1204
+ * Gemini because a Claude outage does not touch it: another vendor, on its
1205
+ * own lanes. Must stay an image-capable structured-output model
1206
+ * (STRUCTURED_VISION_MODELS — a registry test pins it); the route charges an
1207
+ * answer from it at this model's own credit price.
1208
+ */
1209
+ export const DESCRIBE_TO_PICKER_FALLBACK_MODEL = "gemini-3.8-flash"
1210
+
1091
1211
  /**
1092
1212
  * Feature → the reasoning effort its DEFAULT model runs at when the caller
1093
1213
  * sends none. Read it through {@link defaultReasoningEffort}, never directly:
@@ -1152,6 +1272,12 @@ export const LLM_MODALITY_CAPS: Record<string, { image: boolean; video: boolean;
1152
1272
  // with that VA-side decision.
1153
1273
  "gemini-3.8-flash": { image: true, video: false, audio: false },
1154
1274
  "gemini-3.1-pro": { image: true, video: true, audio: true },
1275
+ // gemini-4-argon is IMAGE-ONLY by DECISION, not omission (decided 2026-10-17):
1276
+ // the model DOES read video and audio, but full caps would
1277
+ // auto-enroll it in VIDEO_ANALYSIS_LLM_MODELS (derived below) and force a
1278
+ // video-analysis tier + pricing decision. That waits on a Video Analysis
1279
+ // bake-off; flip these two flags ONLY together with its outcome.
1280
+ "gemini-4-argon": { image: true, video: false, audio: false },
1155
1281
  "claude-haiku-4.5": { image: true, video: false, audio: false },
1156
1282
  "claude-haiku-5.5": { image: true, video: false, audio: false },
1157
1283
  "claude-sonnet-4.6": { image: true, video: false, audio: false },
@@ -1199,6 +1325,15 @@ function dashAliasToCanonical(id: string): string {
1199
1325
  return id.replace(/-(\d+)-(\d+)$/, "-$1.$2")
1200
1326
  }
1201
1327
 
1328
+ /**
1329
+ * Retired provider slugs that still name a registered model — a model whose KIE
1330
+ * lane moved to another model's endpoint (`kieServedAs`) no longer carries its
1331
+ * old slug, but stored configs and job rows may.
1332
+ */
1333
+ const LEGACY_PROVIDER_SLUGS: Readonly<Record<string, string>> = {
1334
+ "gemini-3-7-flash-openai": "gemini-3.7-flash",
1335
+ }
1336
+
1202
1337
  export function getLlmModel(id: string): LlmModelDef | undefined {
1203
1338
  const exact = LLM_MODELS.find((m) => m.id === id)
1204
1339
  if (exact) return exact
@@ -1207,11 +1342,18 @@ export function getLlmModel(id: string): LlmModelDef | undefined {
1207
1342
  const aliased = LLM_MODELS.find((m) => m.id === canonical)
1208
1343
  if (aliased) return aliased
1209
1344
  }
1345
+ const legacy = LEGACY_PROVIDER_SLUGS[id]
1346
+ if (legacy) return LLM_MODELS.find((m) => m.id === legacy)
1210
1347
  // Last resort: provider slugs double as historical aliases (e.g. the
1211
1348
  // dated Anthropic slugs, the `-preview`-suffixed Google ids) — accept any
1212
- // model whose slug matches exactly, on either lane.
1349
+ // model whose slug matches exactly, on either lane. A KIE slug borrowed
1350
+ // through `kieServedAs` belongs to the model that answers it, so the
1351
+ // borrower never matches on it — whatever the registry order.
1213
1352
  return LLM_MODELS.find(
1214
- (m) => m.kieSlugOrModel === id || m.directFallbackModel === id || m.directGeminiModel === id,
1353
+ (m) =>
1354
+ (m.kieSlugOrModel === id && !m.kieServedAs) ||
1355
+ m.directFallbackModel === id ||
1356
+ m.directGeminiModel === id,
1215
1357
  )
1216
1358
  }
1217
1359
 
@@ -1342,9 +1484,10 @@ export const ADVANCED_MODE_UNAVAILABLE_REASON =
1342
1484
  * Is this call served on the vendor's own API — and therefore billed as such?
1343
1485
  *
1344
1486
  * The rule (decided 2026-10-08): a call is priced on the lane it runs on.
1345
- * It runs direct when Advanced mode is on, or when it carries a reasoning
1346
- * effort on a model whose effort only works there (`effortRequiresDirect` —
1347
- * the Claude family). Everything else runs on the aggregator at its price,
1487
+ * It runs direct when Advanced mode is on, when the model is served nowhere
1488
+ * else (`directOnly`), or when it carries a reasoning effort on a model whose
1489
+ * effort only works there (`effortRequiresDirect` — the Claude family).
1490
+ * Everything else runs on the aggregator at its price,
1348
1491
  * falling back to the vendor's API only if the aggregator fails (at no extra
1349
1492
  * charge).
1350
1493
  *
@@ -1358,7 +1501,7 @@ export function llmServesDirect(
1358
1501
  advancedMode?: boolean,
1359
1502
  ): boolean {
1360
1503
  if (!supportsAdvancedMode(modelId)) return false
1361
- if (advancedMode) return true
1504
+ if (advancedMode || getLlmModel(modelId!)?.directOnly) return true
1362
1505
  return Boolean(
1363
1506
  getLlmModel(modelId!)?.effortRequiresDirect && effectiveReasoningEffort(modelId, reasoningEffort) !== undefined,
1364
1507
  )
@@ -1390,18 +1533,28 @@ export function buildLlmCreditIdentifier(
1390
1533
  advancedMode?: boolean,
1391
1534
  ): string {
1392
1535
  if (!modelId) return feature
1536
+ return llmCreditIdForRung(feature, llmCreditRung(modelId, reasoningEffort, advancedMode))
1537
+ }
1538
+
1539
+ /**
1540
+ * The rung a call on `modelId` bills on — the half of
1541
+ * {@link buildLlmCreditIdentifier} a feature with its own id shape reads (the
1542
+ * social scrapers' per-post analysis), so its rung cannot drift from the LLM
1543
+ * features'.
1544
+ */
1545
+ export function llmCreditRung(modelId: string, reasoningEffort?: string, advancedMode?: boolean): LlmCreditRung {
1393
1546
  let tier = getLlmTier(modelId)
1394
1547
  const eff = effectiveReasoningEffort(modelId, reasoningEffort)
1395
1548
  if (eff !== undefined && EFFORT_TIER_BUMP.has(eff)) tier = bumpTier(tier)
1396
- // A call served on the vendor's own API (Advanced mode, or an effort on a
1397
- // model whose effort only works there — llmServesDirect) bills materially
1398
- // more per token than the aggregator. It bumps INDEPENDENTLY of the effort
1399
- // bump — the two are separate cost levers and genuinely stack, so a
1400
- // max-effort advanced economy call lands at premium — and on the four-rung
1401
- // ladder, so a premium model served direct lands at `premium-direct`. A stale
1402
- // flag on a model with no direct lane never inflates a bill.
1403
- const rung: LlmCreditRung = llmServesDirect(modelId, reasoningEffort, advancedMode) ? bumpToDirectRung(tier) : tier
1404
- return llmCreditIdForRung(feature, rung)
1549
+ // A call served on the vendor's own API (Advanced mode, a directOnly model,
1550
+ // or an effort on a model whose effort only works there — llmServesDirect)
1551
+ // bills materially more per token than the aggregator. It bumps
1552
+ // INDEPENDENTLY of the effort bump — the two are separate cost levers and
1553
+ // genuinely stack, so a max-effort advanced economy call lands at premium —
1554
+ // and on the four-rung ladder, so a premium model served direct lands at
1555
+ // `premium-direct`. A stale flag on a model with no direct lane never
1556
+ // inflates a bill.
1557
+ return llmServesDirect(modelId, reasoningEffort, advancedMode) ? bumpToDirectRung(tier) : tier
1405
1558
  }
1406
1559
 
1407
1560
  /** One rung up the four-rung ladder — the direct-lane bump. */
@@ -18,7 +18,7 @@
18
18
  * can never land outside the tier set — an identifier missing from
19
19
  * `model_pricing` is a 503 `price_not_configured`, never a silent fallback.
20
20
  */
21
- import { LLM_FEATURE_DEFAULTS, getLlmTier } from "./llm-models.js"
21
+ import { LLM_CREDIT_RUNGS, LLM_FEATURE_DEFAULTS, llmCreditRung } from "./llm-models.js"
22
22
 
23
23
  export const META_ADS_SCRAPE_NODE_TYPE = "meta-ads-scrape" as const
24
24
 
@@ -197,14 +197,22 @@ export type MetaAdsScrapeTier = (typeof META_ADS_SCRAPE_TIERS)[number]
197
197
  * meta-ads-scrape:<tier>:analysis tier × (1 + 3) standard models
198
198
  * meta-ads-scrape:<tier>:analysis:economy tier × (1 + 1)
199
199
  * meta-ads-scrape:<tier>:analysis:premium tier × (1 + 4)
200
+ * meta-ads-scrape:<tier>:analysis:premium-direct tier × (1 + 10)
200
201
  *
201
- * The per-ad SKUs (`meta-ads-analysis[:economy|:premium]`) price the
202
- * SETTLEMENT: a run commits tier + per-ad × ads actually analysed and
203
- * refunds the rest (an ad the model failed on, or one the deadline skipped).
202
+ * The per-ad SKUs (`meta-ads-analysis[:economy|:premium|:premium-direct]`)
203
+ * price the SETTLEMENT: a run commits tier + per-ad × ads actually analysed
204
+ * and refunds the rest (an ad the model failed on, or one the deadline skipped).
205
+ *
206
+ * The tiers are the LLM credit rungs, read through `llmCreditRung` exactly as
207
+ * the LLM features read them: a model served on its vendor's own API (today
208
+ * only a `directOnly` one — the routes send no effort and no Advanced flag)
209
+ * moves one rung up, so a premium one bills `premium-direct`. Its per-ad price
210
+ * is the premium one × the LLM direct multiplier, rounded up — the rule every
211
+ * LLM feature's direct rung follows (held to it by a backend billing test).
204
212
  */
205
- export const META_ADS_ANALYSIS_TIERS = ["economy", "standard", "premium"] as const
213
+ export const META_ADS_ANALYSIS_TIERS = LLM_CREDIT_RUNGS
206
214
  export type MetaAdsAnalysisTier = (typeof META_ADS_ANALYSIS_TIERS)[number]
207
- export const META_ADS_ANALYSIS_CREDITS_PER_AD: Record<MetaAdsAnalysisTier, number> = { economy: 1, standard: 3, premium: 4 }
215
+ export const META_ADS_ANALYSIS_CREDITS_PER_AD: Record<MetaAdsAnalysisTier, number> = { economy: 1, standard: 3, premium: 4, "premium-direct": 10 }
208
216
  export const META_ADS_ANALYSIS_CREDIT_ID = "meta-ads-analysis" as const
209
217
  /** The user's optional analyst focus, appended to the fixed prompt. */
210
218
  export const META_ADS_ANALYSIS_FOCUS_MAX = 500
@@ -214,10 +222,10 @@ export function metaAdsAnalysisCreditId(tier: MetaAdsAnalysisTier): string {
214
222
  return tier === "standard" ? META_ADS_ANALYSIS_CREDIT_ID : `${META_ADS_ANALYSIS_CREDIT_ID}:${tier}`
215
223
  }
216
224
 
217
- /** The analysing model's tier; an absent model is the feature default. */
225
+ /** The analysing model's credit rung; an absent model is the feature default. */
218
226
  export function metaAdsAnalysisTier(modelId?: unknown): MetaAdsAnalysisTier {
219
227
  const id = typeof modelId === "string" && modelId ? modelId : LLM_FEATURE_DEFAULTS["meta-ads-analysis"]
220
- return getLlmTier(id)
228
+ return llmCreditRung(id)
221
229
  }
222
230
 
223
231
  /** What one analysed ad carries (`ad.analysis`); fixed fields + string lists only — never a map (Gemini via KIE drops map fields). */
@@ -173,12 +173,14 @@ export const MODEL_MAKERS = {
173
173
  ideogram: { name: "Ideogram" },
174
174
  kuaishou: { name: "Kuaishou" },
175
175
  lightricks: { name: "Lightricks" },
176
+ luma: { name: "Luma AI" },
176
177
  meituan: { name: "Meituan" },
177
178
  minimax: { name: "MiniMax" },
178
179
  nodaro: { name: "Nodaro" },
179
180
  openai: { name: "OpenAI" },
180
181
  recraft: { name: "Recraft" },
181
182
  runway: { name: "Runway" },
183
+ shengshu: { name: "ShengShu" },
182
184
  suno: { name: "Suno" },
183
185
  "sync-labs": { name: "Sync Labs" },
184
186
  "topaz-labs": { name: "Topaz Labs" },
@@ -263,8 +265,27 @@ export interface ModelCatalogEntry {
263
265
  * auto-determined duration and flat per-generation pricing (see
264
266
  * `runGeminiOmni` in `backend/src/providers/kie/video.ts`) — a different
265
267
  * transport, not a continuation reference.
268
+ *
269
+ * `"reference-to-video"` (video models only) means the model's provider
270
+ * endpoint RUNS FROM REFERENCE IMAGES ALONE — no start frame. Declared only
271
+ * where the provider's own contract accepts a call with reference images and
272
+ * no frame (KIE spec evidence per model). It is what lets a references-only
273
+ * run reach a model on every surface (editor gate, browser DAG, orchestrator,
274
+ * API): `resolveVideoModeForInputs` routes such a run to the image-to-video
275
+ * lane for a model with no text-to-video mode, instead of the text-to-video
276
+ * lane, whose "image required" gate would refuse it. Requires
277
+ * `"reference-image"` (guarded by `video-reference-only.test.ts`).
266
278
  */
267
279
  features?: readonly string[]
280
+ /**
281
+ * How this video model's provider addresses its images in the prompt, by
282
+ * array order — the syntax its frame / identity binding sentences are written
283
+ * in (`videoProviderReferenceSyntax`). Absent ⇒ the platform's `@image_N`.
284
+ * Declared only where the provider documents its own form: Grok Imagine's
285
+ * `@image(n)` (docs.kie.ai/market/grok-imagine/image-to-video) and
286
+ * HappyHorse's `[Image N]` (docs.kie.ai/market/happyhorse-1-1/reference-to-video).
287
+ */
288
+ referenceSyntax?: "@image(n)" | "[Image N]"
268
289
  aspectRatios?: readonly string[]
269
290
  resolutions?: readonly string[]
270
291
  /**
@@ -435,6 +456,10 @@ const VIDEO_RATIOS_HAPPYHORSE_11 = ["16:9", "9:16", "1:1", "4:3", "3:4", "4:5",
435
456
  // so VIDEO_RATIOS_SEEDANCE_2 must NOT be reused here
436
457
  // (docs.kie.ai/market/wan/3-0-video and /3-0-video-prime — identical schemas).
437
458
  const VIDEO_RATIOS_WAN_3 = ["adaptive", "16:9", "4:3", "1:1", "3:4", "9:16"] as const
459
+ // Vidu Q4 — the reference-to-video enum (docs.kie.ai/market/vidu-q4/reference-to-video,
460
+ // default 16:9). The image-to-video endpoint takes NO aspect ratio: its output
461
+ // inherits the start frame's shape, so these apply to reference runs only.
462
+ const VIDEO_RATIOS_VIDU_Q4 = ["16:9", "9:16", "1:1", "4:3", "3:4"] as const
438
463
 
439
464
  // =============================================================================
440
465
  // IMAGE MODELS
@@ -1420,7 +1445,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1420
1445
  series: "Hailuo",
1421
1446
  description: "MiniMax H3 — premium multimodal tier: first/last frame + image/video/audio references, native audio, 2K (default) or 768P output, 4-15s per-second pricing.",
1422
1447
  useCases: ["premium", "narrative"],
1423
- features: ["end-frame", "audio", "reference-image", "video-reference"],
1448
+ features: ["end-frame", "audio", "reference-image", "video-reference", "reference-to-video"],
1424
1449
  aspectRatios: VIDEO_RATIOS_SEEDANCE_2,
1425
1450
  durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
1426
1451
  defaultDuration: 6,
@@ -1541,7 +1566,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1541
1566
  series: "VEO",
1542
1567
  description: "VEO 3.1 Fast — cheaper VEO 3.1 tier, 4/6/8s with audio. Good balance for most uses. Flat per-generation pricing across durations.",
1543
1568
  useCases: ["cinematic", "fast", "general"],
1544
- features: ["end-frame", "audio", "reference-image"],
1569
+ features: ["end-frame", "audio", "reference-image", "reference-to-video"],
1545
1570
  durations: [4, 6, 8],
1546
1571
  defaultDuration: 8,
1547
1572
  aspectRatios: VIDEO_RATIOS_HV,
@@ -1563,7 +1588,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1563
1588
  series: "VEO",
1564
1589
  description: "VEO 3.1 Lite — most cost-effective VEO tier for high-volume generation. 4/6/8s with audio, supports first+last frame.",
1565
1590
  useCases: ["cinematic", "cheap", "high-volume"],
1566
- features: ["end-frame", "audio", "reference-image"],
1591
+ features: ["end-frame", "audio", "reference-image", "reference-to-video"],
1567
1592
  durations: [4, 6, 8],
1568
1593
  defaultDuration: 8,
1569
1594
  aspectRatios: VIDEO_RATIOS_HV,
@@ -1585,7 +1610,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1585
1610
  series: "Gemini",
1586
1611
  description: "Google multimodal video with native audio; text/image-to-video + video-edit.",
1587
1612
  useCases: ["cinematic", "narrative"],
1588
- features: ["audio", "reference-image"],
1613
+ features: ["audio", "reference-image", "reference-to-video"],
1589
1614
  aspectRatios: VIDEO_RATIOS_HV,
1590
1615
  resolutions: ["720p", "1080p", "4k"],
1591
1616
  durations: [4, 6, 8, 10],
@@ -1622,7 +1647,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1622
1647
  series: "Gemini",
1623
1648
  description: "Google Gemini Omni Flash — faster/cheaper Omni tier: multimodal video with native audio, text/image-to-video + video-edit.",
1624
1649
  useCases: ["cinematic", "fast"],
1625
- features: ["audio", "reference-image"],
1650
+ features: ["audio", "reference-image", "reference-to-video"],
1626
1651
  aspectRatios: VIDEO_RATIOS_HV,
1627
1652
  resolutions: ["720p", "1080p", "4k"],
1628
1653
  durations: [4, 6, 8, 10],
@@ -1755,7 +1780,8 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1755
1780
  id: "grok-i2v",
1756
1781
  kind: "video",
1757
1782
  modes: ["i2v"] as const,
1758
- features: ["reference-image"],
1783
+ features: ["reference-image", "reference-to-video"],
1784
+ referenceSyntax: "@image(n)",
1759
1785
  family: "xAI",
1760
1786
  maker: "xai",
1761
1787
  label: "Grok Imagine (I2V)",
@@ -1837,7 +1863,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1837
1863
  series: "Seedance",
1838
1864
  description: "Seedance 2 — premium tier with native audio. Per-second pricing by resolution.",
1839
1865
  useCases: ["premium", "narrative"],
1840
- features: ["end-frame", "audio", "reference-image", "video-reference"],
1866
+ features: ["end-frame", "audio", "reference-image", "video-reference", "reference-to-video"],
1841
1867
  aspectRatios: VIDEO_RATIOS_SEEDANCE_2,
1842
1868
  durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
1843
1869
  defaultDuration: 8,
@@ -1865,7 +1891,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1865
1891
  series: "Seedance",
1866
1892
  description: "Cheaper / quicker Seedance 2 tier.",
1867
1893
  useCases: ["fast", "motion"],
1868
- features: ["end-frame", "audio", "reference-image", "video-reference"],
1894
+ features: ["end-frame", "audio", "reference-image", "video-reference", "reference-to-video"],
1869
1895
  aspectRatios: VIDEO_RATIOS_SEEDANCE_2,
1870
1896
  durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
1871
1897
  defaultDuration: 8,
@@ -1889,7 +1915,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1889
1915
  series: "Seedance",
1890
1916
  description: "Budget Seedance 2 tier — 480p/720p only, per-second pricing by resolution.",
1891
1917
  useCases: ["fast", "motion"],
1892
- features: ["end-frame", "audio", "reference-image", "video-reference"],
1918
+ features: ["end-frame", "audio", "reference-image", "video-reference", "reference-to-video"],
1893
1919
  aspectRatios: VIDEO_RATIOS_SEEDANCE_2,
1894
1920
  durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
1895
1921
  defaultDuration: 8,
@@ -1919,7 +1945,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1919
1945
  series: "Seedance",
1920
1946
  description: "Seedance 2.5 — up to 30s in one shot, native audio, wide multimodal references. 480p/720p/1080p.",
1921
1947
  useCases: ["premium", "narrative", "long-form"],
1922
- features: ["end-frame", "audio", "reference-image", "video-reference"],
1948
+ features: ["end-frame", "audio", "reference-image", "video-reference", "reference-to-video"],
1923
1949
  aspectRatios: VIDEO_RATIOS_SEEDANCE_2,
1924
1950
  durations: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
1925
1951
  defaultDuration: 8,
@@ -1965,7 +1991,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1965
1991
  series: "Wan",
1966
1992
  description: "Wan 3.0 — multimodal: first/last frame or image/video/audio references, native audio, 2-30s at 480p/720p/1080p.",
1967
1993
  useCases: ["motion", "narrative", "long-form"],
1968
- features: ["end-frame", "audio", "reference-image"],
1994
+ features: ["end-frame", "audio", "reference-image", "reference-to-video"],
1969
1995
  aspectRatios: VIDEO_RATIOS_WAN_3,
1970
1996
  durations: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
1971
1997
  defaultDuration: 5,
@@ -1992,7 +2018,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
1992
2018
  series: "Wan",
1993
2019
  description: "Wan 3.0 Prime — Alibaba's high-speed Wan 3.0 tier: same multimodal surface and 2-30s range, faster turnaround at a higher per-second rate.",
1994
2020
  useCases: ["fast", "motion", "narrative"],
1995
- features: ["end-frame", "audio", "reference-image"],
2021
+ features: ["end-frame", "audio", "reference-image", "reference-to-video"],
1996
2022
  aspectRatios: VIDEO_RATIOS_WAN_3,
1997
2023
  durations: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
1998
2024
  defaultDuration: 5,
@@ -2295,7 +2321,8 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
2295
2321
  durations: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
2296
2322
  defaultDuration: 5,
2297
2323
  resolutions: ["720p", "1080p"],
2298
- features: ["reference-image"],
2324
+ features: ["reference-image", "reference-to-video"],
2325
+ referenceSyntax: "[Image N]",
2299
2326
  noSeed: true, // HappyHorse 1.1 dropped `seed` from its schema
2300
2327
  pricing: [
2301
2328
  { identifier: "happyhorse-ref2v", credits: 282, note: "5s 720p default — per-second: ~5.7 cr/s @720p, ~7.3 cr/s @1080p" },
@@ -2316,6 +2343,45 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
2316
2343
  { identifier: "happyhorse-edit", credits: 350, note: "720p default (5s-equivalent flat rate)" },
2317
2344
  ],
2318
2345
  },
2346
+ // ── Vidu (ShengShu Technology) ──
2347
+ // Vidu Q4 — ONE id over two KIE endpoints, chosen by what is wired:
2348
+ // image-to-video (a start frame, no references; the output inherits the
2349
+ // frame's shape) and reference-to-video (1-15 reference images + up to 3
2350
+ // MP3 reference audio clips; a wired start frame joins the reference images).
2351
+ // KIE has NO text-to-video and NO start/end mode for Q4, so `modes` is i2v
2352
+ // only — VIDEO_PROVIDERS_REQUIRING_IMAGE derives the friendly "image
2353
+ // required" 400 from that — and there is no "end-frame" feature. Native audio
2354
+ // behind a boolean `audio` lever, 3-16s, 540p-4k. `resolutions` is ascending
2355
+ // (repo convention); the DEFAULT tier (720p) is declared explicitly in
2356
+ // PRICING_DEFAULT_RESOLUTION, never by array position.
2357
+ "vidu-q4": {
2358
+ id: "vidu-q4",
2359
+ unlistedResolutionRendersAs: "720p",
2360
+ kind: "video",
2361
+ modes: ["i2v"] as const,
2362
+ family: "Vidu",
2363
+ maker: "shengshu",
2364
+ label: "Vidu Q4",
2365
+ series: "Vidu",
2366
+ description: "Vidu Q4 — start-frame or reference-driven video (up to 15 reference images + 3 MP3 voice/sound clips), native audio, 3-16s at 540p to 4K.",
2367
+ useCases: ["motion", "reference"],
2368
+ features: ["audio", "reference-image", "reference-to-video"],
2369
+ aspectRatios: VIDEO_RATIOS_VIDU_Q4,
2370
+ durations: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
2371
+ defaultDuration: 5,
2372
+ resolutions: ["540p", "720p", "1080p", "2k", "4k"],
2373
+ noSeed: true, // neither Q4 schema has a `seed` (additionalProperties: false)
2374
+ pricing: [
2375
+ { identifier: "vidu-q4", credits: 190, note: "default 5s 720p — see :Ns:res variants for exact" },
2376
+ { identifier: "vidu-q4:5s:720p", credits: 190, note: "5s 720p (the default tier)" },
2377
+ { identifier: "vidu-q4:5s:540p", credits: 90, note: "5s 540p" },
2378
+ { identifier: "vidu-q4:5s:1080p", credits: 240, note: "5s 1080p" },
2379
+ { identifier: "vidu-q4:5s:2k", credits: 380, note: "5s 2K" },
2380
+ { identifier: "vidu-q4:5s:4k", credits: 780, note: "5s 4K" },
2381
+ { identifier: "vidu-q4:3s:540p", credits: 60, note: "3s 540p (min)" },
2382
+ { identifier: "vidu-q4:16s:4k", credits: 2500, note: "16s 4K (max)" },
2383
+ ],
2384
+ },
2319
2385
  // ── Bytedance video lite/pro ──
2320
2386
  "bytedance-lite": {
2321
2387
  id: "bytedance-lite",
@@ -2400,6 +2466,18 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
2400
2466
  useCases: ["v2v", "restyle"],
2401
2467
  pricing: [{ identifier: "runway-aleph", credits: 350, note: "5s clip" }],
2402
2468
  },
2469
+ "luma-modify": {
2470
+ id: "luma-modify",
2471
+ kind: "video",
2472
+ modes: ["v2v"] as const,
2473
+ family: "Luma",
2474
+ maker: "luma",
2475
+ label: "Luma Modify",
2476
+ series: "Luma",
2477
+ description: "Luma Modify — changes or restyles an existing video from a prompt.",
2478
+ useCases: ["v2v", "restyle"],
2479
+ pricing: [{ identifier: "luma-modify", credits: 320, note: "per clip" }],
2480
+ },
2403
2481
 
2404
2482
  // ── Extend / Upscale ──
2405
2483
  "veo-extend": {