@nodaro/shared 3.63.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.
- package/dist/{chunk-AE3AAJ4O.js → chunk-36VWLB4J.js} +3 -3
- package/dist/{chunk-AE3AAJ4O.js.map → chunk-36VWLB4J.js.map} +1 -1
- package/dist/{chunk-HWQ2SYNA.js → chunk-3AYM47GW.js} +5 -5
- package/dist/{chunk-HWQ2SYNA.js.map → chunk-3AYM47GW.js.map} +1 -1
- package/dist/{chunk-CZ5IQB3L.js → chunk-3KTWYYCN.js} +8 -5
- package/dist/chunk-3KTWYYCN.js.map +1 -0
- package/dist/{chunk-4MMZD63H.js → chunk-4IUE2JB7.js} +3 -3
- package/dist/{chunk-4MMZD63H.js.map → chunk-4IUE2JB7.js.map} +1 -1
- package/dist/{chunk-M5OCFGHF.cjs → chunk-5OBTGNUQ.cjs} +296 -25
- package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
- package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-67CMMTLN.cjs} +4 -4
- package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
- package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
- package/dist/chunk-6BRWPJPP.cjs.map +1 -0
- package/dist/{chunk-HBXF6RUU.js → chunk-6YIV37V7.js} +4 -4
- package/dist/{chunk-HBXF6RUU.js.map → chunk-6YIV37V7.js.map} +1 -1
- package/dist/{chunk-F6WGGYQW.cjs → chunk-7AJGUI7L.cjs} +37 -15
- package/dist/chunk-7AJGUI7L.cjs.map +1 -0
- package/dist/{chunk-KCZHQH2O.js → chunk-7KQ6W5DS.js} +4 -4
- package/dist/{chunk-KCZHQH2O.js.map → chunk-7KQ6W5DS.js.map} +1 -1
- package/dist/{chunk-TM5JYSJF.cjs → chunk-ACZZHHFZ.cjs} +72 -33
- package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
- package/dist/{chunk-Y35JQPT6.cjs → chunk-AZNZ5WNZ.cjs} +42 -42
- package/dist/{chunk-Y35JQPT6.cjs.map → chunk-AZNZ5WNZ.cjs.map} +1 -1
- package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
- package/dist/chunk-BQYCZLMF.js.map +1 -0
- package/dist/{chunk-GMBDLNLD.cjs → chunk-CHS2SIP6.cjs} +183 -60
- package/dist/chunk-CHS2SIP6.cjs.map +1 -0
- package/dist/{chunk-77WU3V3J.cjs → chunk-CHTZZRAL.cjs} +6 -6
- package/dist/{chunk-77WU3V3J.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
- package/dist/{chunk-WZVIBAKN.cjs → chunk-D4KWNDPH.cjs} +12 -12
- package/dist/{chunk-WZVIBAKN.cjs.map → chunk-D4KWNDPH.cjs.map} +1 -1
- package/dist/{chunk-PSKZKLDG.js → chunk-DZ4IOP3Q.js} +288 -26
- package/dist/chunk-DZ4IOP3Q.js.map +1 -0
- package/dist/{chunk-XGVJGNZW.cjs → chunk-EXEVT6D2.cjs} +15 -5
- package/dist/chunk-EXEVT6D2.cjs.map +1 -0
- package/dist/{chunk-X5BAFW3Q.cjs → chunk-FHGRKQVZ.cjs} +8 -8
- package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
- package/dist/{chunk-GSKLPI3J.cjs → chunk-GTWUS6MQ.cjs} +118 -61
- package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
- package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
- package/dist/chunk-H5KHWTAE.js.map +1 -0
- package/dist/{chunk-V5EEQR2U.cjs → chunk-HDPJNNMF.cjs} +21 -21
- package/dist/{chunk-V5EEQR2U.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
- package/dist/{chunk-6M563QE6.js → chunk-IYSOVS7O.js} +55 -23
- package/dist/chunk-IYSOVS7O.js.map +1 -0
- package/dist/{chunk-XGGZWA4A.cjs → chunk-J6B7J73J.cjs} +52 -49
- package/dist/chunk-J6B7J73J.cjs.map +1 -0
- package/dist/{chunk-MD4XHED4.js → chunk-KB2SQAR3.js} +3 -3
- package/dist/{chunk-MD4XHED4.js.map → chunk-KB2SQAR3.js.map} +1 -1
- package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
- package/dist/chunk-KSHAAPQF.cjs.map +1 -0
- package/dist/{chunk-6TGB7ECA.cjs → chunk-O4RPXBDZ.cjs} +12 -8
- package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
- package/dist/{chunk-YUER7TJG.js → chunk-OBOOHG3N.js} +13 -4
- package/dist/chunk-OBOOHG3N.js.map +1 -0
- package/dist/{chunk-6BZC2ZHC.cjs → chunk-OOZW2MM6.cjs} +9 -9
- package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
- package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
- package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
- package/dist/{chunk-3K24DWOH.js → chunk-PJJAZQVZ.js} +3 -3
- package/dist/{chunk-3K24DWOH.js.map → chunk-PJJAZQVZ.js.map} +1 -1
- package/dist/{chunk-EPXGG27L.js → chunk-Q2Y4JHF7.js} +5 -5
- package/dist/{chunk-EPXGG27L.js.map → chunk-Q2Y4JHF7.js.map} +1 -1
- package/dist/{chunk-KMGCHV6O.js → chunk-QYU7J5EQ.js} +37 -15
- package/dist/chunk-QYU7J5EQ.js.map +1 -0
- package/dist/{chunk-IY3Y462W.js → chunk-S3UGLZSF.js} +3 -3
- package/dist/{chunk-IY3Y462W.js.map → chunk-S3UGLZSF.js.map} +1 -1
- package/dist/{chunk-34QLPTSA.js → chunk-SHH2T4CR.js} +3 -3
- package/dist/{chunk-34QLPTSA.js.map → chunk-SHH2T4CR.js.map} +1 -1
- package/dist/{chunk-L2TVY6XN.cjs → chunk-SPAHI7DY.cjs} +4 -4
- package/dist/{chunk-L2TVY6XN.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
- package/dist/{chunk-YX6TFX7H.js → chunk-SXHHLZ22.js} +66 -11
- package/dist/chunk-SXHHLZ22.js.map +1 -0
- package/dist/{chunk-LMAQUR55.cjs → chunk-T2OVDF2M.cjs} +6 -6
- package/dist/{chunk-LMAQUR55.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
- package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
- package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
- package/dist/{chunk-BMJVKYVB.js → chunk-TPQJKS7D.js} +109 -7
- package/dist/chunk-TPQJKS7D.js.map +1 -0
- package/dist/{chunk-63H4C56Q.cjs → chunk-TQW3R44P.cjs} +8 -8
- package/dist/{chunk-63H4C56Q.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
- package/dist/{chunk-4DVWXEB6.js → chunk-TTGZ2L3O.js} +3 -3
- package/dist/{chunk-4DVWXEB6.js.map → chunk-TTGZ2L3O.js.map} +1 -1
- package/dist/{chunk-XBTYGQ6Z.js → chunk-VPTA4Z7G.js} +8 -5
- package/dist/chunk-VPTA4Z7G.js.map +1 -0
- package/dist/{chunk-6XUG4L7X.cjs → chunk-VZ6TE23U.cjs} +6 -6
- package/dist/{chunk-6XUG4L7X.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
- package/dist/{chunk-LH72PQO2.cjs → chunk-W6VJAUGM.cjs} +114 -45
- package/dist/chunk-W6VJAUGM.cjs.map +1 -0
- package/dist/{chunk-OV3JTKBY.js → chunk-W7KHHNZR.js} +74 -17
- package/dist/chunk-W7KHHNZR.js.map +1 -0
- package/dist/{chunk-2PU3AGGS.cjs → chunk-YQV53HRR.cjs} +7 -7
- package/dist/{chunk-2PU3AGGS.cjs.map → chunk-YQV53HRR.cjs.map} +1 -1
- package/dist/{chunk-FXGNRYQQ.js → chunk-ZI3QDUHO.js} +3 -3
- package/dist/{chunk-FXGNRYQQ.js.map → chunk-ZI3QDUHO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.js +8 -7
- package/dist/entries/captions.cjs +38 -30
- package/dist/entries/captions.d.cts +47 -1
- package/dist/entries/captions.d.ts +47 -1
- package/dist/entries/captions.js +1 -1
- package/dist/entries/credits.cjs +303 -191
- package/dist/entries/credits.d.cts +219 -15
- package/dist/entries/credits.d.ts +219 -15
- package/dist/entries/credits.js +11 -11
- package/dist/entries/llm-models.cjs +62 -62
- package/dist/entries/llm-models.d.cts +29 -7
- package/dist/entries/llm-models.d.ts +29 -7
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/model-catalog.cjs +149 -109
- package/dist/entries/model-catalog.d.cts +64 -7
- package/dist/entries/model-catalog.d.ts +64 -7
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +394 -346
- package/dist/entries/models.d.cts +4 -4
- package/dist/entries/models.d.ts +4 -4
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +220 -211
- package/dist/entries/nodes.d.cts +46 -3
- package/dist/entries/nodes.d.ts +46 -3
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +156 -152
- package/dist/entries/pipeline.d.cts +13 -3
- package/dist/entries/pipeline.d.ts +13 -3
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +177 -177
- package/dist/entries/social.js +2 -2
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +145 -145
- package/dist/entries/video.js +6 -6
- package/dist/entries/workflow.cjs +150 -150
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +1879 -1659
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +25 -25
- package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-Cf9fkEUp.d.cts} +15 -2
- package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-Cf9fkEUp.d.ts} +15 -2
- package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BxjiWVQ9.d.ts} +89 -19
- package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-C_Nyft_i.d.cts} +89 -19
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
- package/src/__tests__/extend-providers.test.ts +266 -26
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
- package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
- package/src/__tests__/flux-3-klein.test.ts +203 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
- package/src/__tests__/llm-models.test.ts +7 -9
- package/src/__tests__/llm-price-key.test.ts +12 -0
- package/src/__tests__/model-makers.test.ts +3 -0
- package/src/__tests__/node-runtime-keys.test.ts +7 -0
- package/src/__tests__/normalize-node-params.test.ts +147 -1
- package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
- package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
- package/src/__tests__/sequence-execution.test.ts +22 -1
- package/src/__tests__/suno-credit-type.test.ts +21 -2
- package/src/__tests__/transcribe-capabilities.test.ts +4 -2
- package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
- package/src/__tests__/video-analysis-pricing.test.ts +10 -9
- package/src/caption-styles.ts +62 -0
- package/src/credit-estimators/add-captions-nemotron.ts +73 -0
- package/src/credit-estimators/index.ts +10 -0
- package/src/credit-identifiers.ts +249 -13
- package/src/entries/captions.ts +2 -0
- package/src/entries/credits.ts +25 -1
- package/src/entries/model-catalog.ts +13 -0
- package/src/entries/models.ts +15 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/pipeline.ts +1 -1
- package/src/flux-3-klein.ts +69 -0
- package/src/input-image-pricing.ts +23 -6
- package/src/llm-models.ts +60 -16
- package/src/model-catalog.ts +280 -25
- package/src/model-constants.ts +146 -17
- package/src/node-default-mappings.ts +3 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +123 -2
- package/src/seedance-extend-rate.ts +116 -0
- package/src/sequence-execution.ts +24 -0
- package/src/transcribe-preflight.ts +23 -0
- package/src/video-analysis-pricing.ts +28 -15
- package/dist/chunk-6M563QE6.js.map +0 -1
- package/dist/chunk-6TGB7ECA.cjs.map +0 -1
- package/dist/chunk-BLJUCPMV.cjs.map +0 -1
- package/dist/chunk-BMJVKYVB.js.map +0 -1
- package/dist/chunk-CZ5IQB3L.js.map +0 -1
- package/dist/chunk-F6WGGYQW.cjs.map +0 -1
- package/dist/chunk-GMBDLNLD.cjs.map +0 -1
- package/dist/chunk-GSKLPI3J.cjs.map +0 -1
- package/dist/chunk-HSHCCBIV.js.map +0 -1
- package/dist/chunk-KMGCHV6O.js.map +0 -1
- package/dist/chunk-LH72PQO2.cjs.map +0 -1
- package/dist/chunk-M5OCFGHF.cjs.map +0 -1
- package/dist/chunk-OV3JTKBY.js.map +0 -1
- package/dist/chunk-PSKZKLDG.js.map +0 -1
- package/dist/chunk-Q6IES3U2.js.map +0 -1
- package/dist/chunk-TM5JYSJF.cjs.map +0 -1
- package/dist/chunk-WRSWH7US.cjs.map +0 -1
- package/dist/chunk-XBTYGQ6Z.js.map +0 -1
- package/dist/chunk-XGGZWA4A.cjs.map +0 -1
- package/dist/chunk-XGVJGNZW.cjs.map +0 -1
- package/dist/chunk-YUER7TJG.js.map +0 -1
- package/dist/chunk-YX6TFX7H.js.map +0 -1
|
@@ -21,6 +21,24 @@ describe("sunoCreditType — the ONE implementation of the Suno route pricing co
|
|
|
21
21
|
expect(sunoCreditType("V5_5", "suno-generate")).toBe("suno-v5_5")
|
|
22
22
|
expect(sunoCreditType("V5", "suno-cover")).toBe("suno-v5")
|
|
23
23
|
expect(sunoCreditType("V5_5", "suno-extend")).toBe("suno-v5_5")
|
|
24
|
+
// Their own rows since 2026-11-12 (they were charged under the operation's row, at the same price).
|
|
25
|
+
expect(sunoCreditType("V4_5PLUS", "suno-generate")).toBe("suno-v4_5plus")
|
|
26
|
+
expect(sunoCreditType("V4_5ALL", "suno-cover")).toBe("suno-v4_5all")
|
|
27
|
+
expect(sunoCreditType("V4_5", "suno-extend")).toBe("suno-v4_5")
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
// A version a deployment's model restriction can name is a catalog entry
|
|
31
|
+
// (its `dataValue`), and the row it is charged under is that entry's own.
|
|
32
|
+
it("gives every version but V4 its own credit key, the pricing row of its catalog entry", () => {
|
|
33
|
+
const sunoEntries = Object.values(MODEL_CATALOG).filter((m) => m.family === "Suno")
|
|
34
|
+
for (const model of SUNO_MODELS) {
|
|
35
|
+
const entry = sunoEntries.find((m) => m.dataValue === model)
|
|
36
|
+
expect(entry, `${model} has no MODEL_CATALOG entry with dataValue`).toBeTruthy()
|
|
37
|
+
if (model === "V4") continue
|
|
38
|
+
const key = SUNO_VERSION_CREDIT_KEYS[model]
|
|
39
|
+
expect(key, `${model} has no SUNO_VERSION_CREDIT_KEYS row`).toBe(entry!.id)
|
|
40
|
+
expect(entry!.pricing[0]!.identifier).toBe(key)
|
|
41
|
+
}
|
|
24
42
|
})
|
|
25
43
|
|
|
26
44
|
// A new active version with no key would silently bill at the operation
|
|
@@ -59,10 +77,11 @@ describe("sunoCreditType — the ONE implementation of the Suno route pricing co
|
|
|
59
77
|
expect(sunoModelHonoursDuration(undefined)).toBe(false)
|
|
60
78
|
})
|
|
61
79
|
|
|
62
|
-
it("falls back to the operation key for
|
|
80
|
+
it("falls back to the operation key for a version with no dedicated price (V4) and for none", () => {
|
|
63
81
|
expect(sunoCreditType("V4", "suno-generate")).toBe("suno-generate")
|
|
64
|
-
expect(sunoCreditType("
|
|
82
|
+
expect(sunoCreditType("V4", "suno-cover")).toBe("suno-cover")
|
|
65
83
|
expect(sunoCreditType(undefined, "suno-extend")).toBe("suno-extend")
|
|
84
|
+
expect(sunoCreditType("V9", "suno-generate")).toBe("suno-generate")
|
|
66
85
|
})
|
|
67
86
|
|
|
68
87
|
// The reason this function is gated rather than a bare version map: these four
|
|
@@ -71,9 +71,11 @@ describe("transcribe lane capabilities", () => {
|
|
|
71
71
|
expect(TRANSCRIBE_PROVIDERS[TRANSCRIBE_PROVIDERS.length - 1]).toBe("nemotron-3-5-transcribe")
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
it("Add Captions
|
|
75
|
-
expect([...CAPTION_TRANSCRIBE_LANES]
|
|
74
|
+
it("Add Captions offers Nemotron at the END of its lanes (priced per minute there too, decided 2026-11-13)", () => {
|
|
75
|
+
expect([...CAPTION_TRANSCRIBE_LANES]).toEqual(["whisper", "incredibly-fast-whisper", "elevenlabs-stt", "nemotron-3-5-transcribe"])
|
|
76
76
|
for (const lane of CAPTION_TRANSCRIBE_LANES) expect(TRANSCRIBE_LANES).toContain(lane)
|
|
77
|
+
// Captions need word timings: every lane but whisper gives them, Nemotron included.
|
|
78
|
+
expect(TRANSCRIBE_PROVIDER_CAPABILITIES["nemotron-3-5-transcribe"].wordTimestamps).toBe(true)
|
|
77
79
|
})
|
|
78
80
|
|
|
79
81
|
it("the defaults do not move", () => {
|
|
@@ -163,8 +163,10 @@ describe("bare video-analysis node-type credit id", () => {
|
|
|
163
163
|
// plugin's token pin 8_203 -> 8_482, 356 wrote 2071: Stage 1.3 grew
|
|
164
164
|
// that prompt again, moving the pin 8_482 -> 8_706, and 357 wrote 2076:
|
|
165
165
|
// the transition vocabulary v2 doctrine (twelve named values; absent =
|
|
166
|
-
// nothing asserted) grew it once more, moving the pin 8_706 -> 9_082
|
|
167
|
-
|
|
166
|
+
// nothing asserted) grew it once more, moving the pin 8_706 -> 9_082, and
|
|
167
|
+
// the fast-tier move to gemini-3.8-flash (2026-11-13) wrote 2097: smart's
|
|
168
|
+
// donor rolls roll the fast model too.
|
|
169
|
+
expect(ceiling).toBe(2097)
|
|
168
170
|
})
|
|
169
171
|
|
|
170
172
|
it("the bare id still bounds the default tier at the ceiling bucket", () => {
|
|
@@ -60,7 +60,7 @@ describe("video-analysis-pricing", () => {
|
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
it("model SSOT is capability-derived and Gemini-only today", () => {
|
|
63
|
-
expect(VIDEO_ANALYSIS_LLM_MODELS).toEqual(["gemini-3-flash", "gemini-3.6-flash", "gemini-3.1-pro"])
|
|
63
|
+
expect(VIDEO_ANALYSIS_LLM_MODELS).toEqual(["gemini-3-flash", "gemini-3.6-flash", "gemini-3.8-flash", "gemini-3.1-pro"])
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
it("tier layer: every model-backed tier maps to a real model AND every model is tier-reachable or explicitly legacy (no vendor leak)", () => {
|
|
@@ -103,9 +103,10 @@ describe("video-analysis-pricing", () => {
|
|
|
103
103
|
expect(DEFAULT_VIDEO_ANALYSIS_TIER).toBe("pro")
|
|
104
104
|
expect(DEFAULT_VIDEO_ANALYSIS_MODEL).toBe("gemini-3.1-pro")
|
|
105
105
|
expect(resolveVideoAnalysisModel("pro")).toBe("gemini-3.1-pro")
|
|
106
|
-
// The
|
|
107
|
-
//
|
|
108
|
-
expect(resolveVideoAnalysisModel("fast")).toBe("gemini-3-flash")
|
|
106
|
+
// The fast tier moved to gemini-3.8-flash when KIE dropped gemini-3-flash's
|
|
107
|
+
// channel (2026-11-13); gemini-3-flash is now a legacy fast backing.
|
|
108
|
+
expect(resolveVideoAnalysisModel("fast")).toBe("gemini-3.8-flash")
|
|
109
|
+
expect(VIDEO_ANALYSIS_LEGACY_MODELS["gemini-3-flash"]).toBe("fast")
|
|
109
110
|
expect(resolveVideoAnalysisModel("mixed")).toBe("mixed") // roll-plan sentinel passthrough
|
|
110
111
|
expect(resolveVideoAnalysisModel("mixed-fast")).toBe("mixed-fast")
|
|
111
112
|
// `smart` is a sentinel too — it names an engine plan, never a model id, so the
|
|
@@ -193,11 +194,11 @@ describe("video-audit-pricing", () => {
|
|
|
193
194
|
|
|
194
195
|
it("videoAuditCreditsForBucket: table lookup by resolved bucket + family, snapping a raw duration onto the ladder", () => {
|
|
195
196
|
expect(videoAuditCreditsForBucket(60, false)).toBe(215)
|
|
196
|
-
expect(videoAuditCreditsForBucket(60, true)).toBe(
|
|
197
|
+
expect(videoAuditCreditsForBucket(60, true)).toBe(401)
|
|
197
198
|
expect(videoAuditCreditsForBucket(180, false)).toBe(290)
|
|
198
199
|
expect(videoAuditCreditsForBucket(360, false)).toBe(663)
|
|
199
200
|
expect(videoAuditCreditsForBucket(600, false)).toBe(1073)
|
|
200
|
-
expect(videoAuditCreditsForBucket(600, true)).toBe(
|
|
201
|
+
expect(videoAuditCreditsForBucket(600, true)).toBe(1953)
|
|
201
202
|
// Not just exact ladder values — a raw duration snaps up to its bucket.
|
|
202
203
|
expect(videoAuditCreditsForBucket(70, false)).toBe(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:180s"])
|
|
203
204
|
expect(videoAuditCreditsForBucket(9999, true)).toBe(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"])
|
|
@@ -239,17 +240,17 @@ describe("video-audit-pricing", () => {
|
|
|
239
240
|
expect(Object.keys(VIDEO_AUDIT_BUCKET_CREDITS)).toHaveLength(8)
|
|
240
241
|
// Bare-id values quoted in the task/catalog must equal each family's 600s ceiling.
|
|
241
242
|
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:600s"]).toBe(1073)
|
|
242
|
-
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"]).toBe(
|
|
243
|
+
expect(VIDEO_AUDIT_BUCKET_CREDITS["video-audit:auto:600s"]).toBe(1953)
|
|
243
244
|
})
|
|
244
245
|
|
|
245
|
-
it("auto family = base family + the
|
|
246
|
+
it("auto family = base family + the fast tier's row at the same bucket, exactly — single-source, never hand-added", () => {
|
|
246
247
|
// Single-source assertion: reads the fast-tier row straight out of
|
|
247
248
|
// VIDEO_ANALYSIS_BUCKET_CREDITS rather than re-hardcoding 180/185/514/846
|
|
248
249
|
// here, so this test can't silently drift from that table either.
|
|
249
250
|
for (const bucketSec of VIDEO_ANALYSIS_DURATION_BUCKETS) {
|
|
250
251
|
const base = VIDEO_AUDIT_BUCKET_CREDITS[`video-audit:${bucketSec}s`]!
|
|
251
252
|
const auto = VIDEO_AUDIT_BUCKET_CREDITS[`video-audit:auto:${bucketSec}s`]!
|
|
252
|
-
const fastRow = VIDEO_ANALYSIS_BUCKET_CREDITS[
|
|
253
|
+
const fastRow = VIDEO_ANALYSIS_BUCKET_CREDITS[buildVideoAnalysisCreditId(VIDEO_ANALYSIS_TIERS.fast, bucketSec)]!
|
|
253
254
|
expect(auto - base, `auto-base mismatch at ${bucketSec}s`).toBe(fastRow)
|
|
254
255
|
}
|
|
255
256
|
})
|
package/src/caption-styles.ts
CHANGED
|
@@ -129,6 +129,68 @@ export function captionRoutesToRemotion(input: {
|
|
|
129
129
|
return false
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Is this render's caption source a STATIC TEXT BLOCK — the caller's `text`,
|
|
134
|
+
* burned once for the whole clip — rather than timed words?
|
|
135
|
+
*
|
|
136
|
+
* On `subtitle`, `text` IS the caption: one block, `\n` a forced line break,
|
|
137
|
+
* never transcribed over, whichever renderer draws it (the cheap FFmpeg drawtext
|
|
138
|
+
* burn with no styling lever, the Remotion SubtitleOverlay with one). On a
|
|
139
|
+
* KINETIC style the same `text` stays what it always was — a FALLBACK, spread
|
|
140
|
+
* evenly across the clip as synthetic word timings when transcription returns
|
|
141
|
+
* nothing.
|
|
142
|
+
*
|
|
143
|
+
* Source precedence is unchanged: `captions[]` > wired transcript > (`text` on
|
|
144
|
+
* subtitle) > auto-transcription. `auto_transcribe` is deliberately NOT read: on
|
|
145
|
+
* a subtitle the caller's text wins either way.
|
|
146
|
+
*
|
|
147
|
+
* Shared by the WORKER (which must not pay for a transcription it then discards)
|
|
148
|
+
* and the ROUTE/DAG ingress, so the two cannot disagree about where the words
|
|
149
|
+
* come from.
|
|
150
|
+
*/
|
|
151
|
+
export function isStaticTextCaptionSource(input: {
|
|
152
|
+
style?: string | null
|
|
153
|
+
text?: string | null
|
|
154
|
+
captions?: readonly unknown[] | null
|
|
155
|
+
transcript?: unknown
|
|
156
|
+
segments?: readonly unknown[] | null
|
|
157
|
+
}): boolean {
|
|
158
|
+
if (input.segments && input.segments.length > 0) return false
|
|
159
|
+
if (isKineticCaptionStyle(input.style)) return false
|
|
160
|
+
if (input.captions && input.captions.length > 0) return false
|
|
161
|
+
if (input.transcript !== undefined && input.transcript !== null) return false
|
|
162
|
+
return typeof input.text === "string" && /\S/.test(input.text)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Whether an Add Captions render transcribes its audio: it carries no caption
|
|
167
|
+
* source of its own — no captions, no wired transcript, no static text block —
|
|
168
|
+
* auto-transcribe is not turned off, and its segments (when it has any) do not
|
|
169
|
+
* all carry their own text or captions. The worker decides with it; the route's
|
|
170
|
+
* credit guard asks it so a request is judged on its transcription model only
|
|
171
|
+
* when one will run, and every place that prices a run on an engine charged by
|
|
172
|
+
* the video's length (Nemotron 3.5 Transcribe) holds that price only when it does.
|
|
173
|
+
*/
|
|
174
|
+
export function captionsNeedTranscription(input: {
|
|
175
|
+
style?: string | null
|
|
176
|
+
text?: string | null
|
|
177
|
+
captions?: readonly unknown[] | null
|
|
178
|
+
transcript?: unknown
|
|
179
|
+
segments?: ReadonlyArray<{ readonly text?: unknown; readonly captions?: readonly unknown[] | null }> | null
|
|
180
|
+
auto_transcribe?: boolean | null
|
|
181
|
+
}): boolean {
|
|
182
|
+
const hasSegments = !!(input.segments && input.segments.length > 0)
|
|
183
|
+
const hasTranscript = input.transcript !== undefined && input.transcript !== null
|
|
184
|
+
const someSegmentNeedsShared = hasSegments && input.segments!.some((s) => !(s.text || (s.captions && s.captions.length > 0)))
|
|
185
|
+
return (
|
|
186
|
+
!isStaticTextCaptionSource(input) &&
|
|
187
|
+
!input.captions?.length &&
|
|
188
|
+
!hasTranscript &&
|
|
189
|
+
input.auto_transcribe !== false &&
|
|
190
|
+
(!hasSegments || someSegmentNeedsShared)
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
132
194
|
/**
|
|
133
195
|
* `maxWordsPerLine` — caps how many words a caption LINE (or tiktok-words page)
|
|
134
196
|
* may hold, on top of the frame-width budget, sentence ends and pauses that
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add Captions transcribing on Nemotron 3.5 Transcribe — ONE charge for the
|
|
3
|
+
* render and its transcription (decided 2026-11-13).
|
|
4
|
+
*
|
|
5
|
+
* Every Add Captions render that transcribes is a Remotion render
|
|
6
|
+
* (`captionRoutesToRemotion`), billed at the kinetic row. On the other engines
|
|
7
|
+
* that flat row covers the transcription too. Nemotron is priced by the
|
|
8
|
+
* video's length, so its caption run holds
|
|
9
|
+
* `add-captions:kinetic:nemotron:<N>m` (N = started minutes of the video,
|
|
10
|
+
* 1..60): the kinetic row plus Nemotron's own per-minute price (its four-minute
|
|
11
|
+
* rate row × N ÷ 4, rounded up once), summed into one base and marked up once
|
|
12
|
+
* — never a row of its own, so a retune of either row moves every price
|
|
13
|
+
* together. The id keeps the `add-captions` prefix, so Add Captions' margin
|
|
14
|
+
* applies to the whole charge.
|
|
15
|
+
*
|
|
16
|
+
* It is held only when a transcription will actually run on Nemotron; a
|
|
17
|
+
* Nemotron node that brings its own captions, transcript or static text holds
|
|
18
|
+
* the plain kinetic row. Like the Transcribe node's id it is the HOLD: the run
|
|
19
|
+
* is charged for the minutes the provider reports it decoded, up or down
|
|
20
|
+
* (backend `lib/nemotron-transcribe-settle.ts`).
|
|
21
|
+
*/
|
|
22
|
+
import {
|
|
23
|
+
NEMOTRON_TRANSCRIBE_PRICING,
|
|
24
|
+
nemotronTranscribeBaseCredits,
|
|
25
|
+
nemotronTranscribeStartedMinutes,
|
|
26
|
+
} from "./nemotron-transcribe.js"
|
|
27
|
+
|
|
28
|
+
/** The Remotion render's row — every Add Captions render that transcribes. */
|
|
29
|
+
export const ADD_CAPTIONS_KINETIC_CREDIT_ID = "add-captions:kinetic"
|
|
30
|
+
|
|
31
|
+
/** The prefix of the per-minute ids a Nemotron caption run holds. */
|
|
32
|
+
export const ADD_CAPTIONS_NEMOTRON_ID_PREFIX = `${ADD_CAPTIONS_KINETIC_CREDIT_ID}:nemotron`
|
|
33
|
+
|
|
34
|
+
/** `add-captions:kinetic:nemotron:<N>m` for N started minutes (1..60, clamped). */
|
|
35
|
+
export function addCaptionsNemotronMinutesId(minutes: number): string {
|
|
36
|
+
const n = Math.min(NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES, Math.max(1, Math.ceil(minutes)))
|
|
37
|
+
return `${ADD_CAPTIONS_NEMOTRON_ID_PREFIX}:${n}m`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The id a Nemotron caption run on a video of `durationSec` seconds holds (its started minutes). */
|
|
41
|
+
export function addCaptionsNemotronCreditId(durationSec: number | null | undefined): string {
|
|
42
|
+
return addCaptionsNemotronMinutesId(nemotronTranscribeStartedMinutes(durationSec))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The id a QUOTE names for a video of `durationSec` seconds — every estimate
|
|
47
|
+
* before a run. A known length is the id its run holds; an UNKNOWN length is
|
|
48
|
+
* the 60-minute id, the most any run can be charged (a run measures the video
|
|
49
|
+
* first, holds 60 minutes for one whose length cannot be read, and refuses one
|
|
50
|
+
* over 60 minutes).
|
|
51
|
+
*/
|
|
52
|
+
export function addCaptionsNemotronQuoteCreditId(durationSec: number | null | undefined): string {
|
|
53
|
+
const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0
|
|
54
|
+
return addCaptionsNemotronCreditId(known ? durationSec : NEMOTRON_TRANSCRIBE_PRICING.MAX_DURATION_SEC)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The minutes of an `add-captions:kinetic:nemotron:<N>m` id (1 ≤ N ≤ 60), or `undefined` for any other id. */
|
|
58
|
+
export function parseAddCaptionsNemotronCreditId(id: string): { minutes: number } | undefined {
|
|
59
|
+
const m = /^add-captions:kinetic:nemotron:(\d+)m$/.exec(id)
|
|
60
|
+
if (!m) return undefined
|
|
61
|
+
const minutes = Number(m[1])
|
|
62
|
+
if (!Number.isInteger(minutes) || minutes < 1 || minutes > NEMOTRON_TRANSCRIBE_PRICING.MAX_MINUTES) return undefined
|
|
63
|
+
return { minutes }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The base of a Nemotron caption run of `minutes` started minutes: the kinetic
|
|
68
|
+
* row's base plus Nemotron's per-minute base for those minutes (`ratePerBlock`
|
|
69
|
+
* credits per four minutes, rounded up once). Marked up once, as one charge.
|
|
70
|
+
*/
|
|
71
|
+
export function addCaptionsNemotronBaseCredits(kineticBase: number, ratePerBlock: number, minutes: number): number {
|
|
72
|
+
return kineticBase + nemotronTranscribeBaseCredits(ratePerBlock, minutes)
|
|
73
|
+
}
|
|
@@ -92,6 +92,16 @@ export {
|
|
|
92
92
|
nemotronTranscribeBaseCredits,
|
|
93
93
|
} from "./nemotron-transcribe.js"
|
|
94
94
|
|
|
95
|
+
export {
|
|
96
|
+
ADD_CAPTIONS_KINETIC_CREDIT_ID,
|
|
97
|
+
ADD_CAPTIONS_NEMOTRON_ID_PREFIX,
|
|
98
|
+
addCaptionsNemotronMinutesId,
|
|
99
|
+
addCaptionsNemotronCreditId,
|
|
100
|
+
addCaptionsNemotronQuoteCreditId,
|
|
101
|
+
parseAddCaptionsNemotronCreditId,
|
|
102
|
+
addCaptionsNemotronBaseCredits,
|
|
103
|
+
} from "./add-captions-nemotron.js"
|
|
104
|
+
|
|
95
105
|
export {
|
|
96
106
|
VIDEO_OVERLAY_PRICING,
|
|
97
107
|
VIDEO_OVERLAY_REMEASURE_SLACK_SEC,
|
|
@@ -42,9 +42,26 @@ import {
|
|
|
42
42
|
type VideoAudioRequest,
|
|
43
43
|
canonicalVideoProvider,
|
|
44
44
|
isTailExtendProvider,
|
|
45
|
+
isPixverseExtendProvider,
|
|
46
|
+
PIXVERSE_V6_EXTEND_PROVIDER,
|
|
47
|
+
isGrokExtendProvider,
|
|
48
|
+
isGrokExtendSourceModel,
|
|
49
|
+
GROK_EXTEND_PROVIDER,
|
|
50
|
+
type CatalogExtendProvider,
|
|
45
51
|
type SeedanceExtendProvider,
|
|
46
52
|
type TailExtendProvider,
|
|
47
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"
|
|
48
65
|
import { isFlux2Model, FLUX2_RES_MP, type Flux2Model } from "./flux2-pricing.js"
|
|
49
66
|
import {
|
|
50
67
|
GPT_IMAGE_2_6_DEFAULT_QUALITY,
|
|
@@ -59,6 +76,7 @@ import {
|
|
|
59
76
|
type ImageFormatLevers,
|
|
60
77
|
} from "./gpt-image-2-6.js"
|
|
61
78
|
import { isMinimaxH3Image, minimaxH3ImageCreditId } from "./minimax-h3-image.js"
|
|
79
|
+
import { flux3KleinCreditId, isFlux3Klein } from "./flux-3-klein.js"
|
|
62
80
|
import {
|
|
63
81
|
SEEDREAM_5_5_I2I,
|
|
64
82
|
SEEDREAM_5_5_MAX_INPUT_IMAGES,
|
|
@@ -210,6 +228,11 @@ export function buildCreditModelIdentifier(
|
|
|
210
228
|
if (isSeedream55(provider)) {
|
|
211
229
|
return seedream55CreditId(provider, resolution, referenceImageCount)
|
|
212
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
|
+
}
|
|
213
236
|
if (HIGH_QUALITY_PROVIDERS.has(provider) && quality === "high") {
|
|
214
237
|
return `${provider}:high`
|
|
215
238
|
}
|
|
@@ -532,9 +555,16 @@ export function buildVideoCreditModelIdentifier(
|
|
|
532
555
|
// A retired model (RETIRED_VIDEO_PROVIDERS) is priced as the model it runs as.
|
|
533
556
|
const provider = canonicalVideoProvider(rawProvider) as string
|
|
534
557
|
// A tail-recipe Extend Video provider (Seedance 2.5 / 2.0, Kling 4) is
|
|
535
|
-
// priced
|
|
536
|
-
//
|
|
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).
|
|
537
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)
|
|
538
568
|
// T2V overrides: some providers have different base costs for text-to-video
|
|
539
569
|
let effectiveProvider = provider
|
|
540
570
|
if (nodeType === "text-to-video") {
|
|
@@ -787,29 +817,230 @@ export function tailExtendResolution(provider: TailExtendProvider, resolution?:
|
|
|
787
817
|
}
|
|
788
818
|
|
|
789
819
|
/**
|
|
790
|
-
* The
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
|
|
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.
|
|
794
892
|
*
|
|
795
893
|
* The seconds added snap into the provider's catalog `durations` (its catalog
|
|
796
894
|
* `defaultDuration` when unset, through {@link pricedOutputDurationSec}); the
|
|
797
|
-
* resolution is {@link tailExtendResolution}'s.
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
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}.
|
|
801
905
|
*
|
|
802
906
|
* A retired id (`seedance-2-extend`) is not a {@link TailExtendProvider}:
|
|
803
|
-
* pass a stored or sent provider through `canonicalVideoProvider` first
|
|
907
|
+
* pass a stored or sent provider through `canonicalVideoProvider` first
|
|
908
|
+
* ({@link buildVideoCreditModelIdentifier} does).
|
|
804
909
|
*/
|
|
805
910
|
export function tailExtendCreditId(
|
|
806
911
|
provider: TailExtendProvider,
|
|
807
912
|
duration?: number | string,
|
|
808
913
|
resolution?: string,
|
|
809
914
|
): string {
|
|
915
|
+
if (isSeedanceExtendPricedBySecondsSent(provider)) return seedanceExtendFullWindowCreditId(duration, resolution)
|
|
810
916
|
return `${provider}:${pricedOutputDurationSec(provider, duration)}s:${tailExtendResolution(provider, resolution)}`
|
|
811
917
|
}
|
|
812
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).
|
|
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
|
+
|
|
813
1044
|
/** @deprecated Use {@link tailExtendResolution}, which also answers for Kling 4 Extend. */
|
|
814
1045
|
export function seedanceExtendResolution(provider: SeedanceExtendProvider, resolution?: unknown): string {
|
|
815
1046
|
return tailExtendResolution(provider, resolution)
|
|
@@ -1108,8 +1339,8 @@ export function speakerViewCreditId(quality: unknown, tier?: unknown): SpeakerVi
|
|
|
1108
1339
|
* satisfies the B3 egress invariant.
|
|
1109
1340
|
*
|
|
1110
1341
|
* The version → key map is {@link SUNO_VERSION_CREDIT_KEYS}; a version with no
|
|
1111
|
-
* entry (V4
|
|
1112
|
-
*
|
|
1342
|
+
* entry (V4) falls back to the operation key, and a non-version-priced
|
|
1343
|
+
* operation is returned unchanged.
|
|
1113
1344
|
*/
|
|
1114
1345
|
export function sunoCreditType(model: string | undefined, operation: string): string {
|
|
1115
1346
|
if (!(SUNO_VERSION_PRICED_OPERATIONS as readonly string[]).includes(operation)) {
|
|
@@ -1132,4 +1363,9 @@ export const SUNO_VERSION_CREDIT_KEYS: Readonly<Record<string, string>> = {
|
|
|
1132
1363
|
V6_MINI: "suno-v6_mini",
|
|
1133
1364
|
V5_5: "suno-v5_5",
|
|
1134
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",
|
|
1135
1371
|
}
|
package/src/entries/captions.ts
CHANGED