@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
@@ -32,15 +32,36 @@ import {
32
32
  KLING_4_FLASH_RESOLUTION,
33
33
  isGrokVideo15Provider,
34
34
  normalizeGrokVideo15Resolution,
35
+ isPixverseV6MaxProvider,
36
+ normalizePixverseV6MaxQuality,
35
37
  VIDEO_REF_RATE_PROVIDERS,
36
38
  normalizeMinimaxH3Resolution,
37
39
  normalizeWan3Resolution,
38
40
  normalizeViduQ4Resolution,
39
- getVideoAudioCapability,
41
+ videoAudioPricedOn,
42
+ type VideoAudioRequest,
40
43
  canonicalVideoProvider,
41
- isSeedanceExtendProvider,
44
+ isTailExtendProvider,
45
+ isPixverseExtendProvider,
46
+ PIXVERSE_V6_EXTEND_PROVIDER,
47
+ isGrokExtendProvider,
48
+ isGrokExtendSourceModel,
49
+ GROK_EXTEND_PROVIDER,
50
+ type CatalogExtendProvider,
42
51
  type SeedanceExtendProvider,
52
+ type TailExtendProvider,
43
53
  } from "./model-constants.js"
54
+ import {
55
+ SEEDANCE_EXTEND_CONTEXT_MAX_SEC,
56
+ SEEDANCE_EXTEND_RATE_CREDIT_IDS,
57
+ SEEDANCE_EXTEND_SENT_PRICED_PROVIDER,
58
+ isSeedanceExtendPricedBySecondsSent,
59
+ seedanceExtendAddedSec,
60
+ seedanceExtendRefusesSource,
61
+ seedanceExtendSentSec,
62
+ seedanceExtendUnits,
63
+ } from "./seedance-extend-rate.js"
64
+ import { unitQuoteCreditId } from "./credit-estimators/unit-quote.js"
44
65
  import { isFlux2Model, FLUX2_RES_MP, type Flux2Model } from "./flux2-pricing.js"
45
66
  import {
46
67
  GPT_IMAGE_2_6_DEFAULT_QUALITY,
@@ -55,6 +76,7 @@ import {
55
76
  type ImageFormatLevers,
56
77
  } from "./gpt-image-2-6.js"
57
78
  import { isMinimaxH3Image, minimaxH3ImageCreditId } from "./minimax-h3-image.js"
79
+ import { flux3KleinCreditId, isFlux3Klein } from "./flux-3-klein.js"
58
80
  import {
59
81
  SEEDREAM_5_5_I2I,
60
82
  SEEDREAM_5_5_MAX_INPUT_IMAGES,
@@ -206,6 +228,11 @@ export function buildCreditModelIdentifier(
206
228
  if (isSeedream55(provider)) {
207
229
  return seedream55CreditId(provider, resolution, referenceImageCount)
208
230
  }
231
+ // FLUX 3 Klein: by size alone, the same on both ids (`flux-3-klein:2K`,
232
+ // `flux-3-klein-i2i:4K`); images move a text-to-image id onto the edit id.
233
+ if (isFlux3Klein(provider)) {
234
+ return flux3KleinCreditId(provider, resolution, referenceImageCount)
235
+ }
209
236
  if (HIGH_QUALITY_PROVIDERS.has(provider) && quality === "high") {
210
237
  return `${provider}:high`
211
238
  }
@@ -450,7 +477,9 @@ const T2V_CREDIT_OVERRIDES: Record<string, string> = {
450
477
  *
451
478
  * @param provider - Video model key (e.g., "kling-3.0")
452
479
  * @param duration - Video duration in seconds
453
- * @param sound - Whether audio/sound is enabled
480
+ * @param sound - The request's audio: its `sound` flag, or the whole audio
481
+ * request (`{ sound, generateAudio }`) — read through `videoAudioIntent`, the
482
+ * same reading the provider runner sends the model's switch from
454
483
  * @param nodeType - Node type for T2V-specific cost overrides
455
484
  * @param mode - Quality variant that affects pricing
456
485
  * @param resolution - Output resolution (used by Seedance 2 for 480p/720p pricing)
@@ -509,23 +538,33 @@ function wireNormalizedResolution(provider: string, resolution: string | undefin
509
538
  // Kling 4.0 Flash renders 720p whatever it is asked (its runner sends 720p).
510
539
  if (isKling4FlashProvider(provider)) return KLING_4_FLASH_RESOLUTION
511
540
  if (isGrokVideo15Provider(provider)) return normalizeGrokVideo15Resolution(resolution)
541
+ if (isPixverseV6MaxProvider(provider)) return normalizePixverseV6MaxQuality(resolution)
512
542
  return resolution
513
543
  }
514
544
 
515
545
  export function buildVideoCreditModelIdentifier(
516
546
  rawProvider: string,
517
547
  duration?: number | string,
518
- sound?: boolean,
548
+ sound?: boolean | VideoAudioRequest,
519
549
  nodeType?: "image-to-video" | "text-to-video",
520
550
  mode?: string,
521
551
  resolution?: string,
522
552
  hasVideoRef?: boolean,
523
553
  ): string {
554
+ const audio: VideoAudioRequest = typeof sound === "object" && sound !== null ? sound : { sound }
524
555
  // A retired model (RETIRED_VIDEO_PROVIDERS) is priced as the model it runs as.
525
556
  const provider = canonicalVideoProvider(rawProvider) as string
526
- // A Seedance Extend Video provider is priced on its own rows — the one
527
- // builder every surface that prices an extend reads.
528
- if (isSeedanceExtendProvider(provider)) return seedanceExtendCreditId(provider, duration, resolution)
557
+ // A tail-recipe Extend Video provider (Seedance 2.5 / 2.0, Kling 4) is
558
+ // priced through the one builder every surface that prices an extend reads
559
+ // (Seedance 2.5: the most a run of that length costs, the whole 10-second
560
+ // window sent — see tailExtendCreditId).
561
+ if (isTailExtendProvider(provider)) return tailExtendCreditId(provider, duration, resolution)
562
+ // PixVerse V6 Extend on its own rows too, its sound read from the extend's
563
+ // own switch (`generateAudio`), else the request's `sound`.
564
+ if (isPixverseExtendProvider(provider)) return pixverseExtendCreditId(duration, resolution, audio.generateAudio ?? audio.sound)
565
+ // Grok Extend is priced at its SOURCE's resolution, which only its source
566
+ // check knows: a resolution handed here is never read, so the dearer row.
567
+ if (isGrokExtendProvider(provider)) return grokExtendCreditId(duration)
529
568
  // T2V overrides: some providers have different base costs for text-to-video
530
569
  let effectiveProvider = provider
531
570
  if (nodeType === "text-to-video") {
@@ -596,16 +635,6 @@ export function buildVideoCreditModelIdentifier(
596
635
  const tier = tiers.find(t => durationSec <= t.maxSeconds) ?? tiers[tiers.length - 1]
597
636
  let identifier = `${effectiveProvider}:${tier.suffix}`
598
637
 
599
- // Append audio suffix if applicable. When the caller expressed no intent
600
- // (sound === undefined), fall back to the model's own default (capability
601
- // `defaultOn` — kling-3.0 generates audio unless explicitly disabled), so an
602
- // intent-less request is billed for the audio it actually produces instead
603
- // of reserving the cheaper no-audio tier against an audio-on generation.
604
- const soundOn = sound ?? (getVideoAudioCapability(effectiveProvider).defaultOn === true)
605
- if (AUDIO_ADDON_PROVIDERS.has(effectiveProvider) && soundOn) {
606
- identifier += ":audio"
607
- }
608
-
609
638
  // Append mode suffix for providers with quality-tiered pricing
610
639
  // "high" comes from I2V videoSize field, "pro" comes from T2V mode field
611
640
  if (MODE_ADDON_PROVIDERS.has(effectiveProvider) && (mode === "high" || mode === "pro")) {
@@ -660,7 +689,7 @@ export function buildVideoCreditModelIdentifier(
660
689
  // Collapsing through the SAME normalizer the runner uses makes render == billed
661
690
  // by construction for every spelling, including garbage (→ the declared 720p).
662
691
  // Scoped to the families whose runner normalizes on purpose (Wan 3.0, Vidu
663
- // Q4, Kling 4.0, Grok Imagine Video 1.5): the other RESOLUTION_DURATION_PRICING members pass `resolution` to
692
+ // Q4, Kling 4.0, Grok Imagine Video 1.5, PixVerse V6 Max): the other RESOLUTION_DURATION_PRICING members pass `resolution` to
664
693
  // their wire verbatim, so case-folding their billing without probing their
665
694
  // wire would reprice live models.
666
695
  const requested = wireNormalizedResolution(effectiveProvider, resolution)
@@ -680,6 +709,17 @@ export function buildVideoCreditModelIdentifier(
680
709
  identifier += ":768p"
681
710
  }
682
711
 
712
+ // Append the audio suffix LAST, after every other dimension
713
+ // (`kling-3.0:10s:audio`, `pixverse-v6-max:5s:720p:audio`). The request's
714
+ // audio is read by `videoAudioIntent` — the reading `applyVideoAudioToggle`
715
+ // sends the model's switch from — and with no intent falls back to the
716
+ // model's own default (capability `defaultOn` — kling-3.0 and PixVerse V6 Max
717
+ // generate audio unless explicitly disabled), so a request is billed for the
718
+ // audio it actually produces.
719
+ if (AUDIO_ADDON_PROVIDERS.has(effectiveProvider) && videoAudioPricedOn(effectiveProvider, audio)) {
720
+ identifier += ":audio"
721
+ }
722
+
683
723
  return identifier
684
724
  }
685
725
 
@@ -706,6 +746,8 @@ export function videoGenerationCreditId(args: {
706
746
  provider: string
707
747
  duration?: number | string
708
748
  sound?: boolean
749
+ /** The request's `generateAudio`, read after `sound` where the model reads it (`videoAudioIntent`). */
750
+ generateAudio?: boolean
709
751
  nodeType?: "image-to-video" | "text-to-video"
710
752
  mode?: string
711
753
  resolution?: string
@@ -719,7 +761,7 @@ export function videoGenerationCreditId(args: {
719
761
  return buildVideoCreditModelIdentifier(
720
762
  args.provider,
721
763
  args.duration,
722
- args.sound,
764
+ { sound: args.sound, generateAudio: args.generateAudio },
723
765
  args.nodeType ?? "image-to-video",
724
766
  args.mode,
725
767
  resolution,
@@ -757,43 +799,260 @@ export function seedanceVideoEditCreditId(provider: string, resolution?: string,
757
799
  })
758
800
  }
759
801
 
760
- /** The resolution a Seedance extend that names none, or one it does not offer, is priced and run at. */
761
- const SEEDANCE_EXTEND_DEFAULT_RESOLUTION = "720p"
802
+ /** The resolution a tail-recipe extend that names none, or one it does not offer, is priced and run at (every one offers it). */
803
+ const TAIL_EXTEND_DEFAULT_RESOLUTION = "720p"
762
804
 
763
805
  /**
764
- * The resolution a Seedance Extend Video run is priced at, and so the one it
765
- * must render at: the requested one when it is among the provider's catalog
766
- * `resolutions`, else 720p (also when none is named). The workflow run queues
767
- * it and the worker holds the job to it, so a stored or sent resolution the
768
- * model does not offer (`4k`) can never render above the row it reserved.
806
+ * The resolution a tail-recipe Extend Video run (Seedance 2.5 / 2.0, Kling 4)
807
+ * is priced at, and so the one it must render at: the requested one when it is
808
+ * among the provider's catalog `resolutions`, else 720p (also when none is
809
+ * named). The workflow run queues it and the worker holds the job to it, so a
810
+ * stored or sent resolution the model does not offer (`4k`, or `480p` on Kling
811
+ * 4) can never render above, or bill apart from, the row it reserved.
769
812
  */
770
- export function seedanceExtendResolution(provider: SeedanceExtendProvider, resolution?: unknown): string {
813
+ export function tailExtendResolution(provider: TailExtendProvider, resolution?: unknown): string {
771
814
  return typeof resolution === "string" && MODEL_CATALOG[provider]?.resolutions?.includes(resolution)
772
815
  ? resolution
773
- : SEEDANCE_EXTEND_DEFAULT_RESOLUTION
816
+ : TAIL_EXTEND_DEFAULT_RESOLUTION
774
817
  }
775
818
 
776
819
  /**
777
- * The credit identifier one Seedance Extend Video run is priced at — the one
778
- * builder every surface that prices it reads (the route's guard and
779
- * reservation, the workflow reservation and estimate, the editor), so none of
780
- * them can name a different row.
820
+ * The rate row a Seedance 2.5 Extend run at `resolution` is charged a multiple
821
+ * of: the row of the resolution the run is priced and rendered at
822
+ * ({@link tailExtendResolution}: one the model offers, else 720p).
823
+ */
824
+ export function seedanceExtendRateCreditId(resolution: unknown): string {
825
+ const res = tailExtendResolution(SEEDANCE_EXTEND_SENT_PRICED_PROVIDER, resolution) as keyof typeof SEEDANCE_EXTEND_RATE_CREDIT_IDS
826
+ return SEEDANCE_EXTEND_RATE_CREDIT_IDS[res] ?? SEEDANCE_EXTEND_RATE_CREDIT_IDS["720p"]
827
+ }
828
+
829
+ /**
830
+ * The ONE id a Seedance 2.5 Extend run on a known source is charged: the
831
+ * whole-run quote (`<rate row>:<units>u`, {@link unitQuoteCreditId}) of that
832
+ * run, which the price lookups (`GET /v1/credits/model-cost`,
833
+ * `POST /v1/credits/model-costs`) answer with exactly what the run is charged.
834
+ *
835
+ * The units are (seconds sent + seconds added) ÷ 2, by the rule the server
836
+ * charges a run by (seedance-extend-rate.ts): the seconds sent are the
837
+ * source's last {@link SEEDANCE_EXTEND_CONTEXT_MAX_SEC} seconds, or all of a
838
+ * shorter source, its picture's length read by the container-overhang rule
839
+ * (`CONTAINER_OVERHANG_SEC`: 8.04 s counts as 8 s, 8.3 s as 8.3 s); the seconds
840
+ * added snap into the catalog window as {@link tailExtendCreditId} reads them.
841
+ *
842
+ * @param sourcePictureSec the source's measured picture length, in seconds.
843
+ * Not known or unreadable (undefined, null, not a positive finite number):
844
+ * the whole window is counted — {@link seedanceExtendFullWindowCreditId},
845
+ * the most a run of that length costs.
846
+ * @param duration the seconds added (the request's `duration`).
847
+ * @param resolution the request's resolution (one the model does not offer is 720p).
848
+ * @returns the id, or `undefined` for a source the extend refuses: a measured
849
+ * picture shorter than the shortest source it takes
850
+ * (`SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC`, 1.8 s, compared as measured, as the
851
+ * route and the worker compare it), whatever the seconds added. No run on
852
+ * such a source is made or charged, so there is no price to name.
853
+ */
854
+ export function seedanceExtendSourceCreditId(
855
+ sourcePictureSec: number | null | undefined,
856
+ duration?: number | string,
857
+ resolution?: unknown,
858
+ ): string | undefined {
859
+ if (seedanceExtendRefusesSource(sourcePictureSec)) return undefined
860
+ return seedanceExtendWholeRunCreditId(seedanceExtendSentSec(sourcePictureSec), duration, resolution)
861
+ }
862
+
863
+ /** The whole-run quote of a Seedance 2.5 Extend run that sends `sentSec` and adds `duration` at `resolution`. */
864
+ function seedanceExtendWholeRunCreditId(sentSec: number, duration: number | string | undefined, resolution: unknown): string {
865
+ const units = seedanceExtendUnits(sentSec, seedanceExtendAddedSec(SEEDANCE_EXTEND_SENT_PRICED_PROVIDER, duration))
866
+ return unitQuoteCreditId(seedanceExtendRateCreditId(resolution), units)
867
+ }
868
+
869
+ /**
870
+ * The most a Seedance 2.5 Extend run that adds `duration` seconds at
871
+ * `resolution` can cost, as ONE id: the whole-run quote
872
+ * (`<rate row>:<units>u`, {@link unitQuoteCreditId}) of a run that sends the
873
+ * whole {@link SEEDANCE_EXTEND_CONTEXT_MAX_SEC}-second window — the units are
874
+ * (10 + the seconds added) ÷ 2. A run sends at most that window, so this is
875
+ * never below what a run of that length is charged; the price lookups answer
876
+ * it at the rate row's current price. A client that knows the source names
877
+ * its run exactly with {@link seedanceExtendSourceCreditId}; this is that id
878
+ * for a source not known.
879
+ *
880
+ * The seconds added snap into the catalog window exactly as
881
+ * {@link tailExtendCreditId} reads them for every tail-recipe provider.
882
+ */
883
+ export function seedanceExtendFullWindowCreditId(duration?: number | string, resolution?: unknown): string {
884
+ return seedanceExtendWholeRunCreditId(seedanceExtendSentSec(undefined), duration, resolution)
885
+ }
886
+
887
+ /**
888
+ * The credit identifier a client prices one tail-recipe Extend Video run at —
889
+ * the one builder every surface that prices it reads (the route's guard and
890
+ * reservation, the workflow reservation and estimate, the editor, and every
891
+ * client of this package), so none of them can name a different row.
781
892
  *
782
893
  * The seconds added snap into the provider's catalog `durations` (its catalog
783
894
  * `defaultDuration` when unset, through {@link pricedOutputDurationSec}); the
784
- * resolution is {@link seedanceExtendResolution}'s. Each provider has its own
785
- * rows, one per second of its window and resolution: `<provider>:<N>s:<res>`
786
- * (`seedance-2-5-extend` 4–30 s, `seedance-2-0-extend` 4–15 s).
895
+ * resolution is {@link tailExtendResolution}'s.
896
+ * - Seedance 2.0 Extend (4–15 s) and Kling 4 Extend (3–30 s): their own rows,
897
+ * one per second of the window and resolution, `<provider>:<N>s:<res>`
898
+ * (480p / 720p / 1080p; Kling 4 720p / 1080p) — the price a run is charged.
899
+ * - Seedance 2.5 Extend (4–30 s) is charged per second it sends and adds, and
900
+ * how much it sends depends on the source: this names the most a run of
901
+ * that length costs, the whole 10-second window sent
902
+ * ({@link seedanceExtendFullWindowCreditId},
903
+ * `seedance-2-5-extend:<res>:per-2s:<units>u`). A client that knows the
904
+ * source names the run's own id with {@link seedanceExtendSourceCreditId}.
787
905
  *
788
- * A retired id (`seedance-2-extend`) is not a {@link SeedanceExtendProvider}:
789
- * pass a stored or sent provider through `canonicalVideoProvider` first.
906
+ * A retired id (`seedance-2-extend`) is not a {@link TailExtendProvider}:
907
+ * pass a stored or sent provider through `canonicalVideoProvider` first
908
+ * ({@link buildVideoCreditModelIdentifier} does).
909
+ */
910
+ export function tailExtendCreditId(
911
+ provider: TailExtendProvider,
912
+ duration?: number | string,
913
+ resolution?: string,
914
+ ): string {
915
+ if (isSeedanceExtendPricedBySecondsSent(provider)) return seedanceExtendFullWindowCreditId(duration, resolution)
916
+ return `${provider}:${pricedOutputDurationSec(provider, duration)}s:${tailExtendResolution(provider, resolution)}`
917
+ }
918
+
919
+ /** PixVerse V6 Extend's qualities, ascending: its catalog `resolutions`. */
920
+ type PixverseExtendQuality = "360p" | "540p" | "720p" | "1080p"
921
+
922
+ /** The quality a PixVerse V6 Extend that names none, or one it cannot map, is priced and run at. */
923
+ const PIXVERSE_EXTEND_DEFAULT_QUALITY: PixverseExtendQuality = "720p"
924
+
925
+ /**
926
+ * The quality a PixVerse V6 Extend run is priced at, and so the one it must
927
+ * render at: a quality it offers (360p / 540p / 720p / 1080p) as asked; 480p —
928
+ * the lowest the other extends render, which PixVerse does not — at the
929
+ * nearest it offers, 540p; anything else, or none, at 720p. The route refuses
930
+ * 480p and every other value it does not offer; a saved node, a quick-strip
931
+ * switch or a workflow written elsewhere carrying one runs, and is priced, at
932
+ * this quality instead.
933
+ */
934
+ export function pixverseExtendQuality(resolution?: unknown): PixverseExtendQuality {
935
+ if (resolution === "480p") return "540p"
936
+ return typeof resolution === "string" && MODEL_CATALOG[PIXVERSE_V6_EXTEND_PROVIDER]?.resolutions?.includes(resolution)
937
+ ? (resolution as PixverseExtendQuality)
938
+ : PIXVERSE_EXTEND_DEFAULT_QUALITY
939
+ }
940
+
941
+ /**
942
+ * The credit identifier one PixVerse V6 Extend run is priced at:
943
+ * `pixverse-v6-extend:<N>s:<quality>`, `:audio` appended with sound. The
944
+ * seconds added snap into its catalog `durations` (1–15, its default 5 when
945
+ * unset, {@link pricedOutputDurationSec}); the quality is
946
+ * {@link pixverseExtendQuality}'s; the sound is on unless `generateAudio` is
947
+ * `false` (the editor's sound switch shows it on until it is turned off).
790
948
  */
949
+ export function pixverseExtendCreditId(duration?: number | string, resolution?: unknown, generateAudio?: boolean): string {
950
+ const seconds = pricedOutputDurationSec(PIXVERSE_V6_EXTEND_PROVIDER, duration)
951
+ return `${PIXVERSE_V6_EXTEND_PROVIDER}:${seconds}s:${pixverseExtendQuality(resolution)}${generateAudio === false ? "" : ":audio"}`
952
+ }
953
+
954
+ /**
955
+ * The resolution a catalog Extend Video run ({@link CatalogExtendProvider}) is
956
+ * priced at, and so renders at: a tail recipe's {@link tailExtendResolution},
957
+ * PixVerse V6's {@link pixverseExtendQuality}.
958
+ */
959
+ export function catalogExtendResolution(provider: CatalogExtendProvider, resolution?: unknown): string {
960
+ return isPixverseExtendProvider(provider) ? pixverseExtendQuality(resolution) : tailExtendResolution(provider, resolution)
961
+ }
962
+
963
+ /**
964
+ * The credit identifier one catalog Extend Video run is priced at — the one
965
+ * builder every surface that prices one reads (the route's guard and
966
+ * reservation, the workflow reservation and estimate, the editor): a tail
967
+ * recipe's {@link tailExtendCreditId} (no sound switch is priced there), and
968
+ * PixVerse V6's {@link pixverseExtendCreditId}.
969
+ */
970
+ export function catalogExtendCreditId(
971
+ provider: CatalogExtendProvider,
972
+ duration?: number | string,
973
+ resolution?: string,
974
+ generateAudio?: boolean,
975
+ ): string {
976
+ return isPixverseExtendProvider(provider)
977
+ ? pixverseExtendCreditId(duration, resolution, generateAudio)
978
+ : tailExtendCreditId(provider, duration, resolution)
979
+ }
980
+
981
+ /** The source resolutions Grok Extend is priced at (one row each per length added). */
982
+ export type GrokExtendSourceResolution = "480p" | "720p"
983
+
984
+ /**
985
+ * The seconds a Grok Extend run adds for a requested `duration`: 6 or 10 as
986
+ * asked, its default 6 when unset or unreadable, any other length snapped to
987
+ * the nearer of the two ({@link pricedOutputDurationSec} on its catalog
988
+ * `durations`). The route refuses any other length; a saved node, a quick-strip
989
+ * switch or a workflow written elsewhere runs, and is priced, at this one.
990
+ */
991
+ export function grokExtendSeconds(duration: unknown): number {
992
+ const requested = typeof duration === "number" || typeof duration === "string" ? duration : undefined
993
+ return pricedOutputDurationSec(GROK_EXTEND_PROVIDER, requested)
994
+ }
995
+
996
+ /**
997
+ * The credit identifier one Grok Extend run is priced at:
998
+ * `grok-extend:<6|10>s:<480p|720p>`. The resolution is the SOURCE's — what
999
+ * Grok bills an extension at — as the source check answers it (the route's
1000
+ * hold, the workflow hold); never a resolution the request names. Anything but
1001
+ * `480p` (a source not known yet, an estimate) is priced at the dearer 720p
1002
+ * row, so a quote never falls below the charge.
1003
+ */
1004
+ export function grokExtendCreditId(duration?: unknown, sourceResolution?: unknown): string {
1005
+ const resolution: GrokExtendSourceResolution = sourceResolution === "480p" ? "480p" : "720p"
1006
+ return `${GROK_EXTEND_PROVIDER}:${grokExtendSeconds(duration)}s:${resolution}`
1007
+ }
1008
+
1009
+ /** The video node types whose run Grok Extend can extend, set to a Grok Imagine model. */
1010
+ const GROK_EXTEND_SOURCE_NODE_TYPES: ReadonlySet<string> = new Set(["generate-video", "text-to-video", "image-to-video"])
1011
+
1012
+ /**
1013
+ * The source resolution a Grok Extend node is QUOTED at (its estimate, its
1014
+ * editor price), read off the node wired into its `video` input: `480p` only
1015
+ * when that node surely renders at 480p — a Grok Imagine video node (text- or
1016
+ * image-to-video) set to 480p, which every mode sends as set — and `720p`, the
1017
+ * dearer row, for anything else: nothing wired, another model, a Grok node with
1018
+ * no resolution set (Grok may render it at either). The run is held and
1019
+ * charged at the source's own row, read off its job.
1020
+ */
1021
+ export function grokExtendWiredSourceResolution(
1022
+ nodeId: string | undefined,
1023
+ nodes: ReadonlyArray<{ readonly id?: string; readonly type?: string; readonly data?: unknown }>,
1024
+ edges: ReadonlyArray<{ readonly source?: string; readonly target?: string; readonly targetHandle?: string | null }> | undefined,
1025
+ ): GrokExtendSourceResolution {
1026
+ if (nodeId === undefined || !edges) return "720p"
1027
+ const sources = edges
1028
+ .filter((e) => e.target === nodeId && (e.targetHandle == null || e.targetHandle === "video"))
1029
+ .map((e) => nodes.find((n) => n.id !== undefined && n.id === e.source))
1030
+ if (sources.length === 0) return "720p"
1031
+ const surely480p = sources.every((n) => {
1032
+ const data = (n?.data ?? {}) as Record<string, unknown>
1033
+ return (
1034
+ n?.type !== undefined &&
1035
+ GROK_EXTEND_SOURCE_NODE_TYPES.has(n.type) &&
1036
+ isGrokExtendSourceModel(data.provider) &&
1037
+ typeof data.resolution === "string" &&
1038
+ data.resolution.trim().toLowerCase() === "480p"
1039
+ )
1040
+ })
1041
+ return surely480p ? "480p" : "720p"
1042
+ }
1043
+
1044
+ /** @deprecated Use {@link tailExtendResolution}, which also answers for Kling 4 Extend. */
1045
+ export function seedanceExtendResolution(provider: SeedanceExtendProvider, resolution?: unknown): string {
1046
+ return tailExtendResolution(provider, resolution)
1047
+ }
1048
+
1049
+ /** @deprecated Use {@link tailExtendCreditId}, which also answers for Kling 4 Extend. */
791
1050
  export function seedanceExtendCreditId(
792
1051
  provider: SeedanceExtendProvider,
793
1052
  duration?: number | string,
794
1053
  resolution?: string,
795
1054
  ): string {
796
- return `${provider}:${pricedOutputDurationSec(provider, duration)}s:${seedanceExtendResolution(provider, resolution)}`
1055
+ return tailExtendCreditId(provider, duration, resolution)
797
1056
  }
798
1057
 
799
1058
  /** What the video credit identifier PRICES for a request, for the levers whose
@@ -897,13 +1156,59 @@ export function pricedVideoSelection(opts: {
897
1156
  * "wan-animate-move" (480p default), "wan-animate-move:580p", "wan-animate-move:720p"
898
1157
  *
899
1158
  * @param provider - Motion control provider key ("kling" for 2.6, "kling-3.0", "wan-animate-move", "wan-animate-replace")
900
- * @param resolution - "720p" or "1080p" (Kling), "480p" or "580p" or "720p" (Wan Animate)
1159
+ * @param resolution - "720p" or "1080p" (Kling), "480p" or "580p" or "720p" (Wan Animate); a size the
1160
+ * model does not have is priced as the size it runs at (`motionTransferResolution`: Wan Animate's 1080p as 720p)
901
1161
  * @param videoDuration - Reference video duration in seconds (defaults to 10s, unused for Wan Animate)
902
1162
  */
903
1163
  export function buildMotionCreditModelIdentifier(
904
1164
  provider: string,
905
1165
  resolution: string,
906
1166
  videoDuration?: number,
1167
+ ): string {
1168
+ return motionCreditIdentifier(provider, motionTransferResolution(provider, resolution).resolution, videoDuration)
1169
+ }
1170
+
1171
+ /** The catalog model a Motion Transfer option runs: the base of the id it is billed under. */
1172
+ function motionModelOf(provider: string): string {
1173
+ return motionCreditIdentifier(provider, "720p").split(":")[0]!
1174
+ }
1175
+
1176
+ /**
1177
+ * Motion models still SENT at a size their catalog entry does not list, as
1178
+ * before Wan Animate had entries: Kling 2.6 and Kling 3.0 Motion Control
1179
+ * (720p and 1080p). Their price is the same either way (any size but 1080p is
1180
+ * charged on the 720p rows), and Kling 3.0's provider already sends such a
1181
+ * size as 720p; whether Kling 2.6 should too is not decided. Only shrinks.
1182
+ */
1183
+ const MOTION_MODELS_SENT_AS_NAMED: ReadonlySet<string> = new Set(["motion-transfer", "kling-3.0-motion"])
1184
+
1185
+ /** The size a Motion Transfer run is sent and charged at, and what moved. */
1186
+ export interface MotionTransferResolution {
1187
+ resolution: string
1188
+ /** Empty when the size it names is the one it runs at. */
1189
+ adjustments: ModelInputAdjustment[]
1190
+ }
1191
+
1192
+ /**
1193
+ * The size a Motion Transfer run is sent and charged at (decided 2026-11-12):
1194
+ * the size it names, held to the catalog entry of the model its option runs
1195
+ * (`normalizeModelInput`), so a size that model does not have moves to the
1196
+ * entry's `defaultResolution` — a Wan Animate request at 1080p runs, and is
1197
+ * charged, as 720p. The route, the workflow build, the MCP workflow writes and
1198
+ * every price (through `buildMotionCreditModelIdentifier`) read this one rule.
1199
+ */
1200
+ export function motionTransferResolution(provider: string, resolution: string): MotionTransferResolution {
1201
+ const model = motionModelOf(provider)
1202
+ if (MOTION_MODELS_SENT_AS_NAMED.has(model)) return { resolution, adjustments: [] }
1203
+ const normalized = normalizeModelInput(model, { resolution })
1204
+ if (normalized.resolution === undefined) return { resolution, adjustments: [] }
1205
+ return { resolution: normalized.resolution, adjustments: normalized.adjustments }
1206
+ }
1207
+
1208
+ function motionCreditIdentifier(
1209
+ provider: string,
1210
+ resolution: string,
1211
+ videoDuration?: number,
907
1212
  ): string {
908
1213
  // Wan Animate providers use resolution-tiered pricing (not duration-based)
909
1214
  if (provider === "wan-animate-move" || provider === "wan-animate-replace") {
@@ -1034,8 +1339,8 @@ export function speakerViewCreditId(quality: unknown, tier?: unknown): SpeakerVi
1034
1339
  * satisfies the B3 egress invariant.
1035
1340
  *
1036
1341
  * The version → key map is {@link SUNO_VERSION_CREDIT_KEYS}; a version with no
1037
- * entry (V4 / V4_5 / V4_5ALL / V4_5PLUS) falls back to the operation key, and a
1038
- * non-version-priced operation is returned unchanged.
1342
+ * entry (V4) falls back to the operation key, and a non-version-priced
1343
+ * operation is returned unchanged.
1039
1344
  */
1040
1345
  export function sunoCreditType(model: string | undefined, operation: string): string {
1041
1346
  if (!(SUNO_VERSION_PRICED_OPERATIONS as readonly string[]).includes(operation)) {
@@ -1058,4 +1363,9 @@ export const SUNO_VERSION_CREDIT_KEYS: Readonly<Record<string, string>> = {
1058
1363
  V6_MINI: "suno-v6_mini",
1059
1364
  V5_5: "suno-v5_5",
1060
1365
  V5: "suno-v5",
1366
+ // Their own rows since 2026-11-12, at the price their runs were charged
1367
+ // under the operation's row before.
1368
+ V4_5PLUS: "suno-v4_5plus",
1369
+ V4_5ALL: "suno-v4_5all",
1370
+ V4_5: "suno-v4_5",
1061
1371
  }
@@ -16,6 +16,8 @@ export {
16
16
  DEFAULT_SUBTITLE_LOOK,
17
17
  KINETIC_ONLY_CAPTION_LEVER_KEYS,
18
18
  captionRoutesToRemotion,
19
+ isStaticTextCaptionSource,
20
+ captionsNeedTranscription,
19
21
  CAPTION_MAX_WORDS_PER_LINE_MIN,
20
22
  CAPTION_MAX_WORDS_PER_LINE_MAX,
21
23
  CAPTION_LEVER_BOUNDS,
@@ -24,11 +24,25 @@ export {
24
24
  imageGenAutoAspectNeedsSourceImage,
25
25
  buildVideoCreditModelIdentifier,
26
26
  seedanceVideoEditCreditId,
27
+ tailExtendCreditId,
28
+ tailExtendResolution,
29
+ seedanceExtendRateCreditId,
30
+ seedanceExtendFullWindowCreditId,
31
+ seedanceExtendSourceCreditId,
32
+ pixverseExtendCreditId,
33
+ pixverseExtendQuality,
34
+ catalogExtendCreditId,
35
+ catalogExtendResolution,
36
+ grokExtendCreditId,
37
+ grokExtendSeconds,
38
+ grokExtendWiredSourceResolution,
27
39
  seedanceExtendCreditId,
28
40
  seedanceExtendResolution,
29
41
  videoGenerationCreditId,
30
42
  pricedVideoSelection,
31
43
  buildMotionCreditModelIdentifier,
44
+ motionTransferResolution,
45
+ type MotionTransferResolution,
32
46
  speedRampCreditId,
33
47
  applyEdlCreditId,
34
48
  speakerViewCreditId,
@@ -41,7 +55,21 @@ export {
41
55
  SUNO_VERSION_PRICED_OPERATIONS,
42
56
  SUNO_SELECT_OPERATIONS,
43
57
  } from "../credit-identifiers.js"
44
- export type { NormalizedImageGen, PricedVideoSelection } from "../credit-identifiers.js"
58
+ export type { NormalizedImageGen, PricedVideoSelection, GrokExtendSourceResolution } from "../credit-identifiers.js"
59
+ export {
60
+ SEEDANCE_EXTEND_SENT_PRICED_PROVIDER,
61
+ SEEDANCE_EXTEND_CONTEXT_MAX_SEC,
62
+ SEEDANCE_EXTEND_RATE_SECONDS,
63
+ SEEDANCE_EXTEND_RATE_CREDIT_IDS,
64
+ isSeedanceExtendPricedBySecondsSent,
65
+ isSeedanceExtendRateCreditId,
66
+ seedanceExtendAddedSec,
67
+ seedanceExtendRefusesSource,
68
+ seedanceExtendSourceSec,
69
+ seedanceExtendSentSec,
70
+ seedanceExtendUnits,
71
+ type SentPricedSeedanceExtendProvider,
72
+ } from "../seedance-extend-rate.js"
45
73
  export * from "../credit-estimators/index.js"
46
74
  export {
47
75
  resolveTopazUpscale,
@@ -71,8 +99,15 @@ export {
71
99
  getLipSyncMaxAudioSeconds,
72
100
  isPerSecondLipSyncProvider,
73
101
  buildLipSyncCreditId,
102
+ LIP_SYNC_AUDIO_RATES,
103
+ OMNIHUMAN_2_0_PER_SECOND_CREDIT_ID,
104
+ lipSyncAudioRateOf,
105
+ lipSyncBilledSeconds,
106
+ lipSyncEstimateSeconds,
107
+ lipSyncFifteenSecondCreditId,
108
+ LIP_SYNC_UNMEASURED_ESTIMATE_SECONDS,
74
109
  } from "../lip-sync-pricing.js"
75
- export type { LipSyncDurationBucket } from "../lip-sync-pricing.js"
110
+ export type { LipSyncDurationBucket, LipSyncAudioRate } from "../lip-sync-pricing.js"
76
111
  export {
77
112
  AI_AVATAR_MAX_DURATION_SEC,
78
113
  AI_AVATAR_MAX_AUDIO_SEC,
@@ -51,6 +51,12 @@ export {
51
51
  supportsAdvancedMode,
52
52
  llmServesDirect,
53
53
  llmPriceKey,
54
+ LLM_PRICE_KEY_DIRECT,
55
+ LLM_PRICE_KEY_EFFORT,
56
+ parseLlmPriceKeyModel,
57
+ type LlmPriceKeyModel,
58
+ structuredWireMode,
59
+ llmSendsSchema,
54
60
  LLM_FEATURE_DEFAULTS_FROM,
55
61
  llmDefaultsFeature,
56
62
  LLM_CREDIT_RUNGS,
@@ -53,10 +53,23 @@ export {
53
53
  seedream55Resolution,
54
54
  } from "../seedream-5-5.js"
55
55
  export type { Seedream55Model, Seedream55Resolution } from "../seedream-5-5.js"
56
+ export {
57
+ FLUX_3_KLEIN_DEFAULT_RESOLUTION,
58
+ FLUX_3_KLEIN_I2I,
59
+ FLUX_3_KLEIN_MAX_INPUT_IMAGES,
60
+ FLUX_3_KLEIN_RESOLUTIONS,
61
+ FLUX_3_KLEIN_T2I,
62
+ flux3KleinCreditId,
63
+ flux3KleinResolution,
64
+ isFlux3Klein,
65
+ isFlux3KleinI2i,
66
+ } from "../flux-3-klein.js"
67
+ export type { Flux3KleinModel, Flux3KleinResolution } from "../flux-3-klein.js"
56
68
  // The models priced by the input images a run sends, and how a run's images are counted.
57
69
  export {
58
70
  isPricedPerInputImage,
59
71
  isPricedPerInputImageEdit,
72
+ priceReadsInputImages,
60
73
  pricedEstimatedImages,
61
74
  pricedSentImages,
62
75
  } from "../input-image-pricing.js"
@@ -167,3 +180,12 @@ export {
167
180
  export type { ImageModelRole } from "../image-model-roles.js"
168
181
  export type { SafetyRetryPolicy } from "../safety-retry-policy.js"
169
182
  export { VIDEO_DURATION_AUTO, isAutoVideoDuration } from "../video-duration-auto.js"
183
+ // Video Upscale's target resolution per provider, coerced from the catalog
184
+ // (`resolutions` / `defaultResolution`) on every lane.
185
+ export {
186
+ VIDEO_UPSCALE_RESOLUTIONS,
187
+ videoUpscaleModelOf,
188
+ videoUpscaleResolutionsFor,
189
+ normalizeVideoUpscaleResolution,
190
+ } from "../video-upscale-params.js"
191
+ export type { VideoUpscaleResolution, NormalizedVideoUpscaleResolution } from "../video-upscale-params.js"