@nodaro/shared 3.67.0 → 3.69.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 (202) hide show
  1. package/dist/{chunk-T4GIHHXY.cjs → chunk-25C2E2GI.cjs} +6 -6
  2. package/dist/{chunk-T4GIHHXY.cjs.map → chunk-25C2E2GI.cjs.map} +1 -1
  3. package/dist/{chunk-OXTF4Y3P.cjs → chunk-3AB3YIFM.cjs} +6 -6
  4. package/dist/{chunk-OXTF4Y3P.cjs.map → chunk-3AB3YIFM.cjs.map} +1 -1
  5. package/dist/{chunk-23IKLMRL.cjs → chunk-3OHRFSQL.cjs} +53 -51
  6. package/dist/{chunk-23IKLMRL.cjs.map → chunk-3OHRFSQL.cjs.map} +1 -1
  7. package/dist/{chunk-GNLA5NTT.cjs → chunk-4IMEJQVQ.cjs} +4 -4
  8. package/dist/{chunk-GNLA5NTT.cjs.map → chunk-4IMEJQVQ.cjs.map} +1 -1
  9. package/dist/{chunk-JTYCJ5OL.cjs → chunk-54E2JO4E.cjs} +100 -33
  10. package/dist/chunk-54E2JO4E.cjs.map +1 -0
  11. package/dist/{chunk-HTDKEYMY.cjs → chunk-5EQRIUGI.cjs} +139 -91
  12. package/dist/chunk-5EQRIUGI.cjs.map +1 -0
  13. package/dist/{chunk-AT53ZQUC.js → chunk-5WHU7CYE.js} +3 -3
  14. package/dist/{chunk-AT53ZQUC.js.map → chunk-5WHU7CYE.js.map} +1 -1
  15. package/dist/{chunk-BNR5FKL5.js → chunk-5ZCZL73I.js} +3 -3
  16. package/dist/{chunk-BNR5FKL5.js.map → chunk-5ZCZL73I.js.map} +1 -1
  17. package/dist/{chunk-6FQBKI2A.cjs → chunk-6JSYNKFL.cjs} +4 -4
  18. package/dist/{chunk-6FQBKI2A.cjs.map → chunk-6JSYNKFL.cjs.map} +1 -1
  19. package/dist/{chunk-WZG6GZIL.cjs → chunk-6QJHSN6J.cjs} +4 -4
  20. package/dist/{chunk-WZG6GZIL.cjs.map → chunk-6QJHSN6J.cjs.map} +1 -1
  21. package/dist/{chunk-OFQ6CU6S.js → chunk-7EQJIGVT.js} +3 -3
  22. package/dist/{chunk-OFQ6CU6S.js.map → chunk-7EQJIGVT.js.map} +1 -1
  23. package/dist/{chunk-XEPKONJC.js → chunk-7OSUEYZ4.js} +3 -3
  24. package/dist/{chunk-XEPKONJC.js.map → chunk-7OSUEYZ4.js.map} +1 -1
  25. package/dist/{chunk-3L7GMQ4M.cjs → chunk-7PC2YHBN.cjs} +54 -49
  26. package/dist/chunk-7PC2YHBN.cjs.map +1 -0
  27. package/dist/{chunk-BMDOPJBP.cjs → chunk-AGIG5HUU.cjs} +17 -17
  28. package/dist/{chunk-BMDOPJBP.cjs.map → chunk-AGIG5HUU.cjs.map} +1 -1
  29. package/dist/{chunk-5LWYX4GV.js → chunk-AH6OQXLW.js} +3 -3
  30. package/dist/{chunk-5LWYX4GV.js.map → chunk-AH6OQXLW.js.map} +1 -1
  31. package/dist/{chunk-RVQW623D.js → chunk-BDW25A7Y.js} +72 -18
  32. package/dist/chunk-BDW25A7Y.js.map +1 -0
  33. package/dist/{chunk-5J2LIQYU.js → chunk-DE55SA2X.js} +5 -5
  34. package/dist/{chunk-5J2LIQYU.js.map → chunk-DE55SA2X.js.map} +1 -1
  35. package/dist/{chunk-VBP4DH37.js → chunk-DNWFFVC6.js} +130 -15
  36. package/dist/chunk-DNWFFVC6.js.map +1 -0
  37. package/dist/{chunk-CLAKSLXF.js → chunk-E3PU7YC6.js} +3 -3
  38. package/dist/{chunk-CLAKSLXF.js.map → chunk-E3PU7YC6.js.map} +1 -1
  39. package/dist/{chunk-MVXZP6VB.js → chunk-FUYBUT65.js} +97 -2
  40. package/dist/chunk-FUYBUT65.js.map +1 -0
  41. package/dist/{chunk-SW5ZD7BO.js → chunk-G6AOKNAY.js} +3 -3
  42. package/dist/{chunk-SW5ZD7BO.js.map → chunk-G6AOKNAY.js.map} +1 -1
  43. package/dist/{chunk-EFYWV2V5.cjs → chunk-I6TBKTW3.cjs} +61 -61
  44. package/dist/{chunk-EFYWV2V5.cjs.map → chunk-I6TBKTW3.cjs.map} +1 -1
  45. package/dist/{chunk-3YWZ5SOZ.js → chunk-KLEKJUQI.js} +5 -5
  46. package/dist/{chunk-3YWZ5SOZ.js.map → chunk-KLEKJUQI.js.map} +1 -1
  47. package/dist/{chunk-OXBU5AGH.js → chunk-LSX2OFNB.js} +3 -3
  48. package/dist/{chunk-OXBU5AGH.js.map → chunk-LSX2OFNB.js.map} +1 -1
  49. package/dist/{chunk-66QSUUB4.cjs → chunk-LY6IR5LL.cjs} +12 -12
  50. package/dist/{chunk-66QSUUB4.cjs.map → chunk-LY6IR5LL.cjs.map} +1 -1
  51. package/dist/{chunk-5GG4CG4Y.js → chunk-LZPG4XHT.js} +3 -3
  52. package/dist/{chunk-5GG4CG4Y.js.map → chunk-LZPG4XHT.js.map} +1 -1
  53. package/dist/{chunk-PGDR7CO3.cjs → chunk-MGSGLRHZ.cjs} +8 -8
  54. package/dist/{chunk-PGDR7CO3.cjs.map → chunk-MGSGLRHZ.cjs.map} +1 -1
  55. package/dist/{chunk-Z77M7Q2R.js → chunk-ML55U7WM.js} +3 -3
  56. package/dist/{chunk-Z77M7Q2R.js.map → chunk-ML55U7WM.js.map} +1 -1
  57. package/dist/{chunk-ALRXY4QH.cjs → chunk-N7ZJD4CK.cjs} +6 -2
  58. package/dist/chunk-N7ZJD4CK.cjs.map +1 -0
  59. package/dist/{chunk-O2QOBA6Q.js → chunk-NPGP6FMU.js} +43 -3
  60. package/dist/chunk-NPGP6FMU.js.map +1 -0
  61. package/dist/{chunk-IWUW3YPM.cjs → chunk-NTCSXKZ3.cjs} +5 -5
  62. package/dist/{chunk-IWUW3YPM.cjs.map → chunk-NTCSXKZ3.cjs.map} +1 -1
  63. package/dist/chunk-NWNRATS3.js +13 -0
  64. package/dist/chunk-NWNRATS3.js.map +1 -0
  65. package/dist/{chunk-SCDE676D.js → chunk-OEOOXL3F.js} +65 -23
  66. package/dist/chunk-OEOOXL3F.js.map +1 -0
  67. package/dist/{chunk-GF7ZA26H.js → chunk-OOUJZR4K.js} +4 -4
  68. package/dist/{chunk-GF7ZA26H.js.map → chunk-OOUJZR4K.js.map} +1 -1
  69. package/dist/{chunk-5IZHECUP.js → chunk-OZA4DE23.js} +3 -3
  70. package/dist/{chunk-5IZHECUP.js.map → chunk-OZA4DE23.js.map} +1 -1
  71. package/dist/{chunk-GTBW2KAY.js → chunk-PHQVAPSD.js} +8 -6
  72. package/dist/{chunk-GTBW2KAY.js.map → chunk-PHQVAPSD.js.map} +1 -1
  73. package/dist/{chunk-5NVGKXJV.cjs → chunk-PLANUXQL.cjs} +89 -3
  74. package/dist/chunk-PLANUXQL.cjs.map +1 -0
  75. package/dist/{chunk-ZQ2BHOFH.cjs → chunk-Q2LEJXLZ.cjs} +6 -6
  76. package/dist/{chunk-ZQ2BHOFH.cjs.map → chunk-Q2LEJXLZ.cjs.map} +1 -1
  77. package/dist/{chunk-PJAJCFLP.cjs → chunk-QNPYYSLT.cjs} +168 -44
  78. package/dist/chunk-QNPYYSLT.cjs.map +1 -0
  79. package/dist/{chunk-G2G7XGFU.cjs → chunk-RURPG6IS.cjs} +7 -7
  80. package/dist/{chunk-G2G7XGFU.cjs.map → chunk-RURPG6IS.cjs.map} +1 -1
  81. package/dist/{chunk-PAUWEWTY.js → chunk-TDU45K6Z.js} +12 -7
  82. package/dist/chunk-TDU45K6Z.js.map +1 -0
  83. package/dist/{chunk-X2YHKP4D.cjs → chunk-TWUFC32F.cjs} +8 -8
  84. package/dist/{chunk-X2YHKP4D.cjs.map → chunk-TWUFC32F.cjs.map} +1 -1
  85. package/dist/{chunk-O6TBB4IF.cjs → chunk-TZWXZDSX.cjs} +48 -2
  86. package/dist/chunk-TZWXZDSX.cjs.map +1 -0
  87. package/dist/{chunk-F6XIH3TZ.cjs → chunk-UJREE6EQ.cjs} +9 -9
  88. package/dist/{chunk-F6XIH3TZ.cjs.map → chunk-UJREE6EQ.cjs.map} +1 -1
  89. package/dist/{chunk-CFTXW3ZL.js → chunk-UVUHVY7F.js} +3 -3
  90. package/dist/{chunk-CFTXW3ZL.js.map → chunk-UVUHVY7F.js.map} +1 -1
  91. package/dist/{chunk-37ZSFS6A.cjs → chunk-WML66SUV.cjs} +9 -9
  92. package/dist/{chunk-37ZSFS6A.cjs.map → chunk-WML66SUV.cjs.map} +1 -1
  93. package/dist/{chunk-M5QY464F.cjs → chunk-XZYZYWKG.cjs} +21 -21
  94. package/dist/{chunk-M5QY464F.cjs.map → chunk-XZYZYWKG.cjs.map} +1 -1
  95. package/dist/{chunk-3QJ3UR5Z.js → chunk-YT4ZTJVC.js} +9 -9
  96. package/dist/{chunk-3QJ3UR5Z.js.map → chunk-YT4ZTJVC.js.map} +1 -1
  97. package/dist/{chunk-V6OXSXIX.js → chunk-YVQFYW2U.js} +86 -4
  98. package/dist/chunk-YVQFYW2U.js.map +1 -0
  99. package/dist/{chunk-E62W5I6A.cjs → chunk-ZWEVRMFN.cjs} +97 -2
  100. package/dist/chunk-ZWEVRMFN.cjs.map +1 -0
  101. package/dist/entries/apps.cjs +42 -42
  102. package/dist/entries/apps.js +7 -7
  103. package/dist/entries/credits.cjs +295 -219
  104. package/dist/entries/credits.d.cts +233 -70
  105. package/dist/entries/credits.d.ts +233 -70
  106. package/dist/entries/credits.js +11 -11
  107. package/dist/entries/llm-models.cjs +84 -68
  108. package/dist/entries/llm-models.d.cts +36 -3
  109. package/dist/entries/llm-models.d.ts +36 -3
  110. package/dist/entries/llm-models.js +2 -2
  111. package/dist/entries/media.cjs +111 -107
  112. package/dist/entries/media.d.cts +17 -2
  113. package/dist/entries/media.d.ts +17 -2
  114. package/dist/entries/media.js +3 -3
  115. package/dist/entries/model-catalog.cjs +133 -133
  116. package/dist/entries/model-catalog.js +4 -4
  117. package/dist/entries/models.cjs +433 -397
  118. package/dist/entries/models.d.cts +2 -2
  119. package/dist/entries/models.d.ts +2 -2
  120. package/dist/entries/models.js +8 -8
  121. package/dist/entries/nodes.cjs +212 -212
  122. package/dist/entries/nodes.js +8 -8
  123. package/dist/entries/pipeline.cjs +153 -153
  124. package/dist/entries/pipeline.d.cts +1 -1
  125. package/dist/entries/pipeline.d.ts +1 -1
  126. package/dist/entries/pipeline.js +3 -3
  127. package/dist/entries/runtime-config.cjs +53 -29
  128. package/dist/entries/runtime-config.d.cts +53 -1
  129. package/dist/entries/runtime-config.d.ts +53 -1
  130. package/dist/entries/runtime-config.js +1 -1
  131. package/dist/entries/social.cjs +177 -177
  132. package/dist/entries/social.js +2 -2
  133. package/dist/entries/types.d.cts +12 -5
  134. package/dist/entries/types.d.ts +12 -5
  135. package/dist/entries/ugc.cjs +71 -71
  136. package/dist/entries/ugc.js +4 -4
  137. package/dist/entries/video.cjs +152 -152
  138. package/dist/entries/video.d.cts +2 -1
  139. package/dist/entries/video.d.ts +2 -1
  140. package/dist/entries/video.js +6 -6
  141. package/dist/index.cjs +1882 -1726
  142. package/dist/index.d.cts +5 -5
  143. package/dist/index.d.ts +5 -5
  144. package/dist/index.js +25 -25
  145. package/dist/{model-constants-DZ3tPGFO.d.ts → model-constants-B5DNHIP8.d.ts} +156 -12
  146. package/dist/{model-constants-BstsUup6.d.cts → model-constants-CQr_d3Kw.d.cts} +156 -12
  147. package/package.json +1 -1
  148. package/src/__tests__/add-captions-nemotron-pricing.test.ts +13 -1
  149. package/src/__tests__/extend-providers.test.ts +43 -6
  150. package/src/__tests__/fixtures/measured-input-quote-parity.json +2352 -1
  151. package/src/__tests__/fixtures/planned-length-quote-parity.json +100 -10
  152. package/src/__tests__/fixtures/probed-node-quote-parity.json +132 -0
  153. package/src/__tests__/fixtures/video-utility-quote-parity.json +945 -38
  154. package/src/__tests__/gemini-omni-extend.test.ts +110 -0
  155. package/src/__tests__/gvp-supported-providers.test.ts +3 -0
  156. package/src/__tests__/llm-models.test.ts +116 -2
  157. package/src/__tests__/llm-price-key.test.ts +2 -0
  158. package/src/__tests__/nemotron-transcribe-pricing.test.ts +32 -0
  159. package/src/__tests__/runtime-config-lists.test.ts +92 -0
  160. package/src/__tests__/seedance-2-5-flash-catalog.test.ts +194 -0
  161. package/src/__tests__/video-character-refs.test.ts +48 -0
  162. package/src/catalog-projection.ts +12 -5
  163. package/src/credit-estimators/add-captions-nemotron.ts +11 -1
  164. package/src/credit-estimators/index.ts +6 -1
  165. package/src/credit-estimators/nemotron-transcribe.ts +35 -3
  166. package/src/credit-estimators/pitch-tempo.ts +14 -0
  167. package/src/credit-estimators/video-sfx.ts +15 -0
  168. package/src/credit-estimators/video-utils.ts +48 -12
  169. package/src/credit-identifiers.ts +51 -32
  170. package/src/entries/credits.ts +18 -0
  171. package/src/entries/llm-models.ts +4 -0
  172. package/src/entries/models.ts +11 -0
  173. package/src/entries/runtime-config.ts +10 -1
  174. package/src/gemini-omni-extend-quote.ts +76 -0
  175. package/src/lip-sync-pricing.ts +16 -1
  176. package/src/llm-models.ts +117 -2
  177. package/src/model-catalog.ts +95 -0
  178. package/src/model-constants.ts +274 -11
  179. package/src/node-default-mappings.ts +2 -0
  180. package/src/priced-clip-seconds.ts +19 -1
  181. package/src/runtime-config/lists.ts +87 -0
  182. package/src/runtime-config/worlds.ts +10 -0
  183. package/src/seedance-extend-rate.ts +83 -20
  184. package/src/seedance-lip-sync.ts +68 -0
  185. package/src/video-character-refs.ts +26 -6
  186. package/dist/chunk-3L7GMQ4M.cjs.map +0 -1
  187. package/dist/chunk-5NVGKXJV.cjs.map +0 -1
  188. package/dist/chunk-ALRXY4QH.cjs.map +0 -1
  189. package/dist/chunk-E62W5I6A.cjs.map +0 -1
  190. package/dist/chunk-HTDKEYMY.cjs.map +0 -1
  191. package/dist/chunk-JTYCJ5OL.cjs.map +0 -1
  192. package/dist/chunk-MVXZP6VB.js.map +0 -1
  193. package/dist/chunk-O2QOBA6Q.js.map +0 -1
  194. package/dist/chunk-O6TBB4IF.cjs.map +0 -1
  195. package/dist/chunk-PAUWEWTY.js.map +0 -1
  196. package/dist/chunk-PJAJCFLP.cjs.map +0 -1
  197. package/dist/chunk-RVQW623D.js.map +0 -1
  198. package/dist/chunk-SCDE676D.js.map +0 -1
  199. package/dist/chunk-SMOO5FAH.js +0 -10
  200. package/dist/chunk-SMOO5FAH.js.map +0 -1
  201. package/dist/chunk-V6OXSXIX.js.map +0 -1
  202. package/dist/chunk-VBP4DH37.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@nodaro/shared/runtime-config` — The deployment runtime config contract: `/config.js`'s keys and their shapes, a lenient parser, and the worlds a deployment can offer.
2
+ * `@nodaro/shared/runtime-config` — The deployment runtime config contract: `/config.js`'s keys and their shapes, a lenient parser, the worlds a deployment can offer, and how its own lists withhold what it offers.
3
3
  *
4
4
  * One of the package's subpath entries (see `src/index.ts`). The root
5
5
  * re-exports every entry, so each name here is also importable from
@@ -10,10 +10,19 @@ export {
10
10
  WORLD_REQUIRED_NODE_TYPES,
11
11
  isWorldId,
12
12
  worldAllowed,
13
+ worldOffered,
13
14
  orderWorlds,
14
15
  type WorldId,
15
16
  type SurfaceWorlds,
16
17
  } from "../runtime-config/worlds.js"
18
+ export {
19
+ ALLOW_LIST_EXEMPT_NODE_TYPES,
20
+ isAllowListGatedNodeType,
21
+ listsSet,
22
+ listsWithhold,
23
+ nodeListsWithhold,
24
+ type SurfaceAllowDeny,
25
+ } from "../runtime-config/lists.js"
17
26
  export {
18
27
  RUNTIME_CONFIG_GLOBAL,
19
28
  RUNTIME_CONFIG_KEYS,
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The price of ONE Gemini Omni Flash 1.2 Extend run (`gemini-omni-flash-1-2-extend`),
3
+ * as ONE id (decided 2026-11-17) — part of the public credit-id contract.
4
+ *
5
+ * Such a run is charged per second of video it sends and adds, on two rows
6
+ * the server reads, the total rounded up once: no single row × units can name
7
+ * it. `geminiOmniExtendQuoteCreditId` names the whole run instead:
8
+ *
9
+ * `gemini-omni-flash-1-2-extend:<resolution>:sent-<S>s:added-<A>s`
10
+ *
11
+ * - `<resolution>`: the one the run renders at and is priced by (360p / 720p /
12
+ * 1080p / 4k; any other is 720p, as the run reads it);
13
+ * - `<S>`: the seconds of the source sent — its last 10 seconds, or all of a
14
+ * shorter source, read by the platform's container-overhang rule (8.04 s is
15
+ * 8 s, 8.3 s is 8.3 s); with no known source, the whole 10 s window, the
16
+ * most a run sends;
17
+ * - `<A>`: the whole seconds added, held in the engine's 3–10 s window (8
18
+ * when none is asked).
19
+ *
20
+ * `GET /v1/credits/model-cost` and `POST /v1/credits/model-costs` answer it
21
+ * with exactly what such a run is charged; an id the server does not price (a
22
+ * resolution, a length or a source it refuses) lands in `missing`. Numbers are
23
+ * written exactly as JavaScript prints them.
24
+ */
25
+ import { MODEL_CATALOG } from "./model-catalog.js"
26
+ import { seedanceExtendAddedSec, seedanceExtendSentSec } from "./seedance-extend-rate.js"
27
+
28
+ const PROVIDER = "gemini-omni-flash-1-2-extend"
29
+ const DEFAULT_RESOLUTION = "720p"
30
+ const PREFIX = `${PROVIDER}:`
31
+ const NUMBER = String.raw`\d{1,7}(?:\.\d{1,20})?`
32
+ const QUOTE_ID = new RegExp(`^${PROVIDER}:([0-9a-z]+):sent-(${NUMBER})s:added-(\\d{1,3})s$`)
33
+
34
+ /** A `gemini-omni-flash-1-2-extend:<res>:sent-<S>s:added-<A>s` id, read back. */
35
+ export interface GeminiOmniExtendQuoteCreditIdParts {
36
+ /** The resolution the run renders at. */
37
+ readonly resolution: string
38
+ /** The seconds of the source sent. */
39
+ readonly sentSec: number
40
+ /** The whole seconds added. */
41
+ readonly addedSec: number
42
+ }
43
+
44
+ /**
45
+ * The id of the whole price of one Gemini Omni Flash 1.2 Extend run that adds
46
+ * `duration` seconds at `resolution` to a source whose picture lasts
47
+ * `sourcePictureSec` (undefined, or not a positive number: not known — the
48
+ * whole 10 s window, the most a run of that length costs).
49
+ */
50
+ export function geminiOmniExtendQuoteCreditId(args: {
51
+ readonly sourcePictureSec?: number | null
52
+ readonly duration?: number | string
53
+ readonly resolution?: unknown
54
+ }): string {
55
+ const resolution = typeof args.resolution === "string" && MODEL_CATALOG[PROVIDER]?.resolutions?.includes(args.resolution)
56
+ ? args.resolution
57
+ : DEFAULT_RESOLUTION
58
+ const sent = seedanceExtendSentSec(args.sourcePictureSec)
59
+ const added = seedanceExtendAddedSec(PROVIDER, args.duration)
60
+ return `${PREFIX}${resolution}:sent-${String(sent)}s:added-${String(added)}s`
61
+ }
62
+
63
+ /**
64
+ * The parts of such an id by its shape alone, or undefined. Which
65
+ * resolutions, lengths and sources the server prices is the server's to say:
66
+ * an id it does not price lands in `missing`.
67
+ */
68
+ export function parseGeminiOmniExtendQuoteCreditId(id: string): GeminiOmniExtendQuoteCreditIdParts | undefined {
69
+ if (typeof id !== "string" || !id.startsWith(PREFIX)) return undefined
70
+ const m = QUOTE_ID.exec(id)
71
+ if (!m) return undefined
72
+ const sentSec = Number(m[2])
73
+ const addedSec = Number(m[3])
74
+ if (!Number.isFinite(sentSec) || sentSec <= 0 || !Number.isInteger(addedSec) || addedSec <= 0) return undefined
75
+ return { resolution: m[1]!, sentSec, addedSec }
76
+ }
@@ -13,6 +13,7 @@
13
13
  */
14
14
 
15
15
  import { unitQuoteCreditId } from "./credit-estimators/unit-quote.js"
16
+ import { gracedMeasuredSec } from "./priced-clip-seconds.js"
16
17
 
17
18
  /**
18
19
  * A lip-sync model charged at a per-second rate: the rate's one-second price
@@ -61,6 +62,20 @@ export function lipSyncBilledSeconds(rate: LipSyncAudioRate, measuredSec: number
61
62
  return Math.max(rate.minSeconds, Math.ceil(measuredSec))
62
63
  }
63
64
 
65
+ /**
66
+ * The seconds a run of a per-second-rate model is HELD and CHARGED for audio
67
+ * it measured at `measuredSec`: {@link lipSyncBilledSeconds} of the length less
68
+ * `CLIP_PRICE_GRACE_SEC` (0.05 s, decided 2026-11-14), so audio a hair past a
69
+ * whole second (a decoder's few hundredths at a file's end) is charged the
70
+ * second its length is quoted at. A quote reads the length exactly
71
+ * ({@link lipSyncEstimateSeconds}).
72
+ */
73
+ export function lipSyncHeldSeconds(rate: LipSyncAudioRate, measuredSec: number): number {
74
+ if (!Number.isFinite(measuredSec) || measuredSec <= 0) return rate.minSeconds
75
+ return lipSyncBilledSeconds(rate, Math.max(Number.MIN_VALUE, gracedMeasuredSec(measuredSec)))
76
+ }
77
+
78
+
64
79
  /**
65
80
  * The length the editor quotes a lip-sync run on while its audio's length is
66
81
  * not known yet — the 15 seconds every model priced by its audio shows then
@@ -113,7 +128,7 @@ export const LIP_SYNC_MAX_AUDIO_SECONDS: Record<string, number> = {
113
128
  "sync-lipsync-v3": 300,
114
129
  // Volcengine (KIE) — video-to-video dubbing, per-second, 5-min ceiling.
115
130
  "volcengine-lipsync": 300,
116
- // The per-second-rate models: their own maximum (longer audio is refused, never trimmed).
131
+ // The per-second-rate models: their own maximum (longer audio is refused; up to the 0.05 s its hold forgives past it, held at the maximum and cut to it).
117
132
  ...Object.fromEntries(Object.entries(LIP_SYNC_AUDIO_RATES).map(([provider, rate]) => [provider, rate.maxSeconds])),
118
133
  }
119
134
 
package/src/llm-models.ts CHANGED
@@ -182,6 +182,15 @@ export interface LlmModelDef {
182
182
  * the concrete things Advanced mode buys.
183
183
  */
184
184
  directReasoningEfforts?: readonly LlmReasoningEffort[]
185
+ /**
186
+ * true = Google's own API takes `thinkingLevel: XHIGH` on this model, so an
187
+ * `xhigh` (or `max`) effort on the direct lane is sent as XHIGH. Absent =
188
+ * both collapse onto HIGH there, the level every other Gemini tops out at.
189
+ * Declared per model from a probe, never derived from a model name. Only
190
+ * meaningful with `directGeminiModel` and an `xhigh` level on the direct
191
+ * ladder (registry test).
192
+ */
193
+ directXhighThinking?: true
185
194
  /** false = model rejects `temperature` (Claude 5-era, GPT-5.6). Absent = accepts. */
186
195
  supportsTemperature?: false
187
196
  /**
@@ -679,6 +688,63 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
679
688
  // tokens. No `reasoningOutputFloor`: both lanes take the default 32768.
680
689
  thinkingDefaultOn: true,
681
690
  },
691
+ {
692
+ id: "gemini-4-hydrogen",
693
+ displayName: "Gemini 4 Hydrogen",
694
+ series: "Gemini",
695
+ desc: "Fast multimodal Gemini 4, four thinking levels, 1M context",
696
+ tier: "premium",
697
+ kieFormat: "chat-completions",
698
+ // KIE serves it on the OpenAI-compatible dialect under this slug, the
699
+ // same shape as Carbon's. Its lane passed its probe (2026-11-16, 29 calls):
700
+ // every call answered, images read, streams ended cleanly with a final
701
+ // usage chunk (no reasoning deltas), no empty 200, no in-band error, no
702
+ // negative counts, no code fences or code-execution leaks. KIE flags it
703
+ // "Chat only", like Carbon: it may not back a tool-loop feature (none
704
+ // does today). Latency: median 7 s, but 4 of 29 trivial calls took
705
+ // 31–78 s — inside the KIE lane's default timeout, which no model
706
+ // overrides.
707
+ kieSlugOrModel: "gemini-4-hydrogen-openai",
708
+ vendor: "google",
709
+ // NO trusted `structuredOutputMode` (decided 2026-11-16), as Carbon: KIE
710
+ // did NOT enforce a `response_format` json_schema — 3 of 3 probe calls
711
+ // came back as valid JSON with prose in the enum field. So it is not a
712
+ // STRUCTURED_VISION_MODELS member, and every answer is parsed, validated
713
+ // and re-asked by `llmCompleteStructured`. The schema still goes on the
714
+ // wire as a hint: `response_format` on KIE, `responseJsonSchema` on the
715
+ // direct Google lane, which enforced it (enum honoured) in the probe.
716
+ structuredOutputHint: "kie-response-format",
717
+ supportsImages: true,
718
+ // The registry's usual 16384, as Carbon. Every call is floored to the
719
+ // default 32768 (`thinkingDefaultOn`, below): KIE accepted max_tokens
720
+ // 32768 and 65536, and Google lists an output cap of 65,536 (models.list)
721
+ // and accepted maxOutputTokens 65536.
722
+ maxOutputTokens: 16384,
723
+ // KIE first, Google as the reliability fallback (and Advanced mode) — no
724
+ // `preferDirect`, no `directOnly`, as Carbon. Google serves
725
+ // `models/gemini-4-hydrogen` (models.list, 2026-11-16: input 1,048,576,
726
+ // output 65,536).
727
+ directGeminiModel: "gemini-4-hydrogen",
728
+ // KIE accepted reasoning_effort low / medium / high / xhigh (xhigh reasons
729
+ // clearly deeper); Google 400s thinkingLevel MINIMAL on this model ("not
730
+ // supported") and answers LOW / MEDIUM / HIGH / XHIGH (probed 2026-11-16).
731
+ // So no `none` (it maps to MINIMAL in the direct client) and no
732
+ // `directReasoningEfforts`: one ladder on both lanes. KIE also accepted
733
+ // the off-enum `none`, `minimal` and `max` and still reasoned, so the
734
+ // clamp here is what keeps a request on the ladder: `none` runs at Auto,
735
+ // `max` at xhigh.
736
+ reasoningEfforts: ["low", "medium", "high", "xhigh"],
737
+ // Google takes thinkingLevel XHIGH on this model, so an xhigh effort on
738
+ // the direct lane is sent as XHIGH rather than collapsing to HIGH.
739
+ directXhighThinking: true,
740
+ // Reasons with no thinking param sent on both lanes (KIE reported
741
+ // reasoning tokens on every no-effort call; Google's no-level call
742
+ // thought). Unlike Carbon, KIE's `completion_tokens` INCLUDES the
743
+ // reasoning (`completion_tokens_details.reasoning_tokens` is a part of it;
744
+ // total = prompt + completion), so the reported output count is billed as
745
+ // it stands. No `reasoningOutputFloor`: both lanes take the default 32768.
746
+ thinkingDefaultOn: true,
747
+ },
682
748
  {
683
749
  id: "claude-opus-4.7",
684
750
  displayName: "Claude Opus 4.7",
@@ -1606,6 +1672,21 @@ export const LLM_MODALITY_CAPS: Record<string, LlmModalityCaps> = {
1606
1672
  // choose it (modelReadsClip) — both intended. It was image-only from
1607
1673
  // 2026-11-12 until this enrolment was decided.
1608
1674
  "gemini-4-carbon": { image: true, video: true, audio: true },
1675
+ // gemini-4-hydrogen takes video + audio ON THE LLM NODES ONLY (decided
1676
+ // 2026-11-16; probed 2026-11-17): it is listed in LLM_NODE_ONLY_MEDIA_MODELS
1677
+ // (below), so these caps do NOT enrol it in VIDEO_ANALYSIS_LLM_MODELS or let
1678
+ // a trend's clip-reading LLM step choose it. Its KIE lane reads both through
1679
+ // the `image_url` part the chat-completions builder already sends (an https
1680
+ // URL or a `data:` URL; an `input_audio` part is dropped by KIE, billed, so
1681
+ // it is never sent): a 52 s 480p clip by URL read correctly 3 of 3, its
1682
+ // sound heard, ≈105 prompt tokens a second (≈74 of frames, ≈32 of sound);
1683
+ // an mp3 by URL or data URL transcribed 3 of 3, ≈32 tokens a second. KIE
1684
+ // takes a linked file up to 74 MB and picks its type from the link's
1685
+ // extension (an extensionless link is refused). Longer clips and long
1686
+ // audio were not probed. Google's own API (where a media call is pinned
1687
+ // when this install has a Gemini key, as Carbon's) lists video and audio
1688
+ // input for it; not probed with media.
1689
+ "gemini-4-hydrogen": { image: true, video: true, audio: true },
1609
1690
  "claude-haiku-4.5": { image: true, video: false, audio: false },
1610
1691
  "claude-haiku-5.5": { image: true, video: false, audio: false },
1611
1692
  "claude-sonnet-4.6": { image: true, video: false, audio: false },
@@ -1639,6 +1720,35 @@ export const LLM_MODALITY_CAPS: Record<string, LlmModalityCaps> = {
1639
1720
  "deepseek-v4.1-flash": { image: true, video: false, audio: false },
1640
1721
  }
1641
1722
 
1723
+ /**
1724
+ * Models whose video and audio caps are for the LLM nodes ONLY (LLM Chat, the
1725
+ * MCP `generate_text` tool and their API routes) and never enrol them in
1726
+ * another product that derives "the models that read video" from
1727
+ * {@link LLM_MODALITY_CAPS}: Video Analysis ({@link VIDEO_ANALYSIS_LLM_MODELS})
1728
+ * and a trend's clip-reading LLM step. Gemini 4 Hydrogen (decided 2026-11-16).
1729
+ */
1730
+ export const LLM_NODE_ONLY_MEDIA_MODELS: readonly string[] = ["gemini-4-hydrogen"]
1731
+
1732
+ /** Whether `modelId` reads video/audio on the LLM nodes only ({@link LLM_NODE_ONLY_MEDIA_MODELS}). */
1733
+ export function readsMediaOnLlmNodesOnly(modelId: string | undefined): boolean {
1734
+ return Boolean(modelId && LLM_NODE_ONLY_MEDIA_MODELS.includes(modelId))
1735
+ }
1736
+
1737
+ /**
1738
+ * Whether `modelId` reads VIDEO for a product other than the LLM nodes (Video
1739
+ * Analysis, a trend's clip step, anything new): its `video` cap, less
1740
+ * {@link LLM_NODE_ONLY_MEDIA_MODELS}. Every such product reads the cap through
1741
+ * this, never `.video` directly (`tools/__tests__/llm-media-caps-guard.test.mjs`).
1742
+ */
1743
+ export function readsVideoOutsideLlmNodes(modelId: string | undefined): boolean {
1744
+ return getLlmModalityCaps(modelId).video && !readsMediaOnLlmNodesOnly(modelId)
1745
+ }
1746
+
1747
+ /** The audio twin of {@link readsVideoOutsideLlmNodes}. */
1748
+ export function readsAudioOutsideLlmNodes(modelId: string | undefined): boolean {
1749
+ return getLlmModalityCaps(modelId).audio && !readsMediaOnLlmNodesOnly(modelId)
1750
+ }
1751
+
1642
1752
  /** Capability lookup with safe default — unknown models get image-only. */
1643
1753
  export function getLlmModalityCaps(modelId: string | undefined): LlmModalityCaps {
1644
1754
  if (!modelId) return { image: true, video: false, audio: false }
@@ -2030,9 +2140,14 @@ export function resolveLlmCreditId(feature: string, body: unknown): string {
2030
2140
  )
2031
2141
  }
2032
2142
 
2033
- /** Models capable of video-analysis: capability-derived, never hand-listed (route-enum-sync convention). */
2143
+ /**
2144
+ * Models capable of video-analysis: capability-derived, never hand-listed
2145
+ * (route-enum-sync convention) — less the models that read media on the LLM
2146
+ * nodes only ({@link LLM_NODE_ONLY_MEDIA_MODELS}), which no Video Analysis
2147
+ * tier, price or stored `llmModel` passthrough reaches.
2148
+ */
2034
2149
  export const VIDEO_ANALYSIS_LLM_MODELS: string[] = LLM_MODELS
2035
- .filter((m) => getLlmModalityCaps(m.id).video && getLlmModalityCaps(m.id).audio)
2150
+ .filter((m) => readsVideoOutsideLlmNodes(m.id) && readsAudioOutsideLlmNodes(m.id))
2036
2151
  .map((m) => m.id)
2037
2152
 
2038
2153
  /**
@@ -3040,6 +3040,42 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
3040
3040
  { identifier: "seedance-2-5:30s:1080p", credits: 11850, note: "30s 1080p (max)" },
3041
3041
  ],
3042
3042
  },
3043
+ // Seedance 2.5 Flash — the fast tier of Seedance 2.5, listed beside it (no
3044
+ // default, preset or role moves to it). Its own facts, never the sibling's:
3045
+ // 480p/720p only (no 1080p), 10 images / 5 videos / 5 audio references
3046
+ // (SEEDANCE_2_5_FLASH_REF_LIMITS), WAV/MP3 reference audio only, a prompt plus
3047
+ // reference audio alone is a valid request, and no draft mode or HD finalize.
3048
+ "seedance-2-5-flash": {
3049
+ id: "seedance-2-5-flash",
3050
+ kind: "video",
3051
+ // `v2v`: it edits a clip by instruction through the same Seedance reference
3052
+ // lane as Seedance 2.5 (SEEDANCE_VIDEO_EDIT_PROVIDERS).
3053
+ modes: ["i2v", "t2v", "v2v"] as const,
3054
+ family: "Bytedance",
3055
+ maker: "bytedance",
3056
+ label: "Seedance 2.5 Flash",
3057
+ series: "Seedance",
3058
+ description: "Seedance 2.5 Flash — the faster, lower-cost tier of Seedance 2.5: 4–30s with native sound at 480p or 720p, from text, a first frame or first and last frames, up to 10 image / 5 video / 5 audio references (audio alone works too), and video edits by instruction.",
3059
+ useCases: ["fast", "narrative", "long-form"],
3060
+ features: ["end-frame", "audio", "reference-image", "video-reference", "reference-to-video"],
3061
+ aspectRatios: VIDEO_RATIOS_SEEDANCE_2,
3062
+ 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],
3063
+ defaultDuration: 8,
3064
+ autoDuration: true,
3065
+ referenceTaskTypes: ["reference", "edit", "extend"],
3066
+ resolutions: ["480p", "720p"],
3067
+ // No seed in KIE's schema for Flash either — the provider config omits it.
3068
+ noSeed: true,
3069
+ pricing: [
3070
+ { identifier: "seedance-2-5-flash", credits: 820, note: "default 8s 720p — see :Ns:res variants for exact" },
3071
+ { identifier: "seedance-2-5-flash:8s:480p", credits: 370, note: "8s 480p" },
3072
+ { identifier: "seedance-2-5-flash:8s:720p", credits: 820, note: "8s 720p" },
3073
+ { identifier: "seedance-2-5-flash:8s:480p-ref", credits: 230, note: "8s 480p with reference video" },
3074
+ { identifier: "seedance-2-5-flash:8s:720p-ref", credits: 510, note: "8s 720p with reference video" },
3075
+ { identifier: "seedance-2-5-flash:30s:480p", credits: 1390, note: "30s 480p (max)" },
3076
+ { identifier: "seedance-2-5-flash:30s:720p", credits: 3080, note: "30s 720p (max)" },
3077
+ ],
3078
+ },
3043
3079
 
3044
3080
  // ── Wan ──
3045
3081
  // Wan 3.0 (standard + Prime) — a NEW generation, not a tier of the 2.x ladder.
@@ -3652,6 +3688,33 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
3652
3688
  { identifier: "seedance-2-5-extend:1080p:per-2s:9u", credits: 4275, note: "8s added at 1080p to a source of 10s or more" },
3653
3689
  ],
3654
3690
  },
3691
+ // Seedance 2.5 Flash extends ANY video the way Seedance 2.5 does (the
3692
+ // source's last 10 s declared as an extension, no start image), generated
3693
+ // on Seedance 2.5 Flash: its own entry, so a deployment can withhold or
3694
+ // release it apart from Flash generation, at Flash's own 480p / 720p and
3695
+ // 4–30 s. Charged per second of video sent and added, at its resolution's
3696
+ // row, the price of two seconds (decided 2026-11-16).
3697
+ "seedance-2-5-flash-extend": {
3698
+ id: "seedance-2-5-flash-extend",
3699
+ kind: "video",
3700
+ modes: ["extend"] as const,
3701
+ family: "Bytedance",
3702
+ maker: "bytedance",
3703
+ label: "Seedance 2.5 Flash Extend",
3704
+ series: "Seedance",
3705
+ description: "Extend ANY video with Seedance 2.5 Flash, the faster and lower-cost tier: a 4–30s continuation (audio included) of the source's last 10 seconds at 480p or 720p, joined onto it. Charged per second of video sent and added; the figure is the default run, 8s added at 720p to a source of 10s or more.",
3706
+ useCases: ["extend", "fast"],
3707
+ 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],
3708
+ defaultDuration: 8,
3709
+ resolutions: ["480p", "720p"],
3710
+ pricing: [
3711
+ // The default run (8 s added to a source of 10 s or more: 18 s sent and
3712
+ // added, 9 units of the two-second row) at each resolution. A run is
3713
+ // charged its own seconds: `seedance-2-5-flash-extend:<res>:per-2s` × (sent + added) ÷ 2.
3714
+ { identifier: "seedance-2-5-flash-extend:720p:per-2s:9u", credits: 1152, note: "default run: 8s added at 720p to a source of 10s or more — priced per second sent and added" },
3715
+ { identifier: "seedance-2-5-flash-extend:480p:per-2s:9u", credits: 522, note: "8s added at 480p to a source of 10s or more" },
3716
+ ],
3717
+ },
3655
3718
  "seedance-2-0-extend": {
3656
3719
  id: "seedance-2-0-extend",
3657
3720
  kind: "video",
@@ -3694,6 +3757,38 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
3694
3757
  { identifier: "kling-4-extend:5s:1080p", credits: 638, note: "5s 1080p" },
3695
3758
  ],
3696
3759
  },
3760
+ // Gemini Omni Flash 1.2 extends ANY 16:9 or 9:16 video from its tail
3761
+ // (decided 2026-11-17): the source's last 10 s go to fal's extend, which
3762
+ // returns them with the new seconds joined on; the run keeps the user's own
3763
+ // source and joins only the new seconds to it. Its own entry, so a
3764
+ // deployment can withhold it apart from Gemini Omni Flash 1.2 generation.
3765
+ // Charged per second sent and added on its own rows; each figure below is
3766
+ // a whole run's quote id (the whole 10 s window sent).
3767
+ "gemini-omni-flash-1-2-extend": {
3768
+ id: "gemini-omni-flash-1-2-extend",
3769
+ kind: "video",
3770
+ modes: ["extend"] as const,
3771
+ family: "Google",
3772
+ maker: "google",
3773
+ label: "Gemini Omni Flash 1.2 Extend",
3774
+ series: "Gemini",
3775
+ description: "Extend ANY 16:9 or 9:16 video with Gemini Omni Flash 1.2: a 3–10s continuation with sound, from 360p to 4K, of the source's last 10 seconds, joined onto it. Charged per second of video sent and added; the figure is the default run, 8s added at 720p to a source of 10s or more.",
3776
+ useCases: ["extend", "fast"],
3777
+ durations: [3, 4, 5, 6, 7, 8, 9, 10],
3778
+ defaultDuration: 8,
3779
+ resolutions: ["360p", "720p", "1080p", "4k"],
3780
+ pricing: [
3781
+ // Whole-run quotes (`geminiOmniExtendQuoteCreditId`) of runs that send
3782
+ // the whole 10 s window. A run is charged its own seconds: its sent row
3783
+ // per second sent plus its resolution's row per second added, the total
3784
+ // rounded up to the next 10.
3785
+ { identifier: "gemini-omni-flash-1-2-extend:720p:sent-10s:added-8s", credits: 390, note: "default run: 8s added at 720p to a source of 10s or more — priced per second sent and added" },
3786
+ { identifier: "gemini-omni-flash-1-2-extend:360p:sent-10s:added-3s", credits: 100, note: "3s added at 360p to a source of 10s or more (min)" },
3787
+ { identifier: "gemini-omni-flash-1-2-extend:1080p:sent-10s:added-8s", credits: 560, note: "8s added at 1080p to a source of 10s or more" },
3788
+ { identifier: "gemini-omni-flash-1-2-extend:4k:sent-10s:added-8s", credits: 1050, note: "8s added at 4K to a source of 10s or more" },
3789
+ { identifier: "gemini-omni-flash-1-2-extend:4k:sent-10s:added-10s", credits: 1300, note: "10s added at 4K to a source of 10s or more (max)" },
3790
+ ],
3791
+ },
3697
3792
  // PixVerse V6 extends ANY video natively (no tail recipe): the whole source
3698
3793
  // goes to its extend, which returns it with the new seconds joined on; the
3699
3794
  // run keeps the user's own source and joins only the new seconds to it. Its