@nodaro/shared 3.69.0 → 3.71.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-25C2E2GI.cjs → chunk-4A3ITJJB.cjs} +6 -6
- package/dist/{chunk-25C2E2GI.cjs.map → chunk-4A3ITJJB.cjs.map} +1 -1
- package/dist/{chunk-5EQRIUGI.cjs → chunk-4HV3LY4A.cjs} +78 -78
- package/dist/chunk-4HV3LY4A.cjs.map +1 -0
- package/dist/{chunk-PERUFUVH.cjs → chunk-5B337MCI.cjs} +15 -15
- package/dist/{chunk-PERUFUVH.cjs.map → chunk-5B337MCI.cjs.map} +1 -1
- package/dist/{chunk-7EQJIGVT.js → chunk-6FUVGATF.js} +3 -3
- package/dist/{chunk-7EQJIGVT.js.map → chunk-6FUVGATF.js.map} +1 -1
- package/dist/{chunk-WML66SUV.cjs → chunk-6PEWM2B3.cjs} +18 -18
- package/dist/{chunk-WML66SUV.cjs.map → chunk-6PEWM2B3.cjs.map} +1 -1
- package/dist/{chunk-KLEKJUQI.js → chunk-BO6IKV24.js} +5 -5
- package/dist/{chunk-KLEKJUQI.js.map → chunk-BO6IKV24.js.map} +1 -1
- package/dist/{chunk-KSHAAPQF.cjs → chunk-BOCHNFDU.cjs} +4 -4
- package/dist/chunk-BOCHNFDU.cjs.map +1 -0
- package/dist/{chunk-AH6OQXLW.js → chunk-BQV6NV7E.js} +3 -3
- package/dist/{chunk-AH6OQXLW.js.map → chunk-BQV6NV7E.js.map} +1 -1
- package/dist/{chunk-BDW25A7Y.js → chunk-BVP4M5AK.js} +247 -11
- package/dist/chunk-BVP4M5AK.js.map +1 -0
- package/dist/{chunk-ML55U7WM.js → chunk-C2UHX7OF.js} +3 -3
- package/dist/{chunk-ML55U7WM.js.map → chunk-C2UHX7OF.js.map} +1 -1
- package/dist/{chunk-Q2LEJXLZ.cjs → chunk-C32IL6RD.cjs} +2 -2
- package/dist/{chunk-Q2LEJXLZ.cjs.map → chunk-C32IL6RD.cjs.map} +1 -1
- package/dist/{chunk-5WHU7CYE.js → chunk-CL7ECTK2.js} +52 -7
- package/dist/chunk-CL7ECTK2.js.map +1 -0
- package/dist/{chunk-FUYBUT65.js → chunk-COA2OJIH.js} +51 -28
- package/dist/chunk-COA2OJIH.js.map +1 -0
- package/dist/{chunk-PLANUXQL.cjs → chunk-CV2BEK52.cjs} +25 -3
- package/dist/chunk-CV2BEK52.cjs.map +1 -0
- package/dist/{chunk-HW6TLOK4.cjs → chunk-DRPHRE4J.cjs} +2 -2
- package/dist/{chunk-HW6TLOK4.cjs.map → chunk-DRPHRE4J.cjs.map} +1 -1
- package/dist/{chunk-LZPG4XHT.js → chunk-F3XG5J5V.js} +3 -3
- package/dist/{chunk-LZPG4XHT.js.map → chunk-F3XG5J5V.js.map} +1 -1
- package/dist/{chunk-I6TBKTW3.cjs → chunk-H52P7DD2.cjs} +73 -73
- package/dist/{chunk-I6TBKTW3.cjs.map → chunk-H52P7DD2.cjs.map} +1 -1
- package/dist/{chunk-AGIG5HUU.cjs → chunk-HUCGHMOI.cjs} +17 -17
- package/dist/{chunk-AGIG5HUU.cjs.map → chunk-HUCGHMOI.cjs.map} +1 -1
- package/dist/{chunk-3AB3YIFM.cjs → chunk-I4C6ZYU4.cjs} +6 -6
- package/dist/{chunk-3AB3YIFM.cjs.map → chunk-I4C6ZYU4.cjs.map} +1 -1
- package/dist/{chunk-UVUHVY7F.js → chunk-JCYTTTM2.js} +2 -2
- package/dist/{chunk-UVUHVY7F.js.map → chunk-JCYTTTM2.js.map} +1 -1
- package/dist/{chunk-7OSUEYZ4.js → chunk-JPSKVBYB.js} +3 -3
- package/dist/{chunk-7OSUEYZ4.js.map → chunk-JPSKVBYB.js.map} +1 -1
- package/dist/{chunk-TAPBDT47.js → chunk-JVYDKXGY.js} +4 -4
- package/dist/{chunk-TAPBDT47.js.map → chunk-JVYDKXGY.js.map} +1 -1
- package/dist/{chunk-YT4ZTJVC.js → chunk-K2P7KOIT.js} +11 -11
- package/dist/{chunk-YT4ZTJVC.js.map → chunk-K2P7KOIT.js.map} +1 -1
- package/dist/{chunk-YVQFYW2U.js → chunk-K3YGI5IW.js} +25 -4
- package/dist/chunk-K3YGI5IW.js.map +1 -0
- package/dist/{chunk-4IMEJQVQ.cjs → chunk-K5WRF2F3.cjs} +4 -4
- package/dist/{chunk-4IMEJQVQ.cjs.map → chunk-K5WRF2F3.cjs.map} +1 -1
- package/dist/{chunk-TDU45K6Z.js → chunk-KD4UUCMW.js} +5 -5
- package/dist/{chunk-TDU45K6Z.js.map → chunk-KD4UUCMW.js.map} +1 -1
- package/dist/{chunk-UJREE6EQ.cjs → chunk-LBKMQAXD.cjs} +9 -9
- package/dist/{chunk-UJREE6EQ.cjs.map → chunk-LBKMQAXD.cjs.map} +1 -1
- package/dist/{chunk-XZYZYWKG.cjs → chunk-MI4WEFJ4.cjs} +21 -21
- package/dist/{chunk-XZYZYWKG.cjs.map → chunk-MI4WEFJ4.cjs.map} +1 -1
- package/dist/{chunk-RURPG6IS.cjs → chunk-MN7BUGXF.cjs} +7 -7
- package/dist/{chunk-RURPG6IS.cjs.map → chunk-MN7BUGXF.cjs.map} +1 -1
- package/dist/{chunk-54E2JO4E.cjs → chunk-NNCHSLFD.cjs} +309 -26
- package/dist/chunk-NNCHSLFD.cjs.map +1 -0
- package/dist/{chunk-6Q4BS6AR.js → chunk-NT3ZFUNJ.js} +31 -3
- package/dist/chunk-NT3ZFUNJ.js.map +1 -0
- package/dist/{chunk-G6AOKNAY.js → chunk-PPXUSZJU.js} +3 -3
- package/dist/{chunk-G6AOKNAY.js.map → chunk-PPXUSZJU.js.map} +1 -1
- package/dist/{chunk-6QJHSN6J.cjs → chunk-QCGSL4CJ.cjs} +4 -4
- package/dist/{chunk-6QJHSN6J.cjs.map → chunk-QCGSL4CJ.cjs.map} +1 -1
- package/dist/{chunk-DE55SA2X.js → chunk-QME5O4NG.js} +8 -6
- package/dist/chunk-QME5O4NG.js.map +1 -0
- package/dist/{chunk-KL6GAYTT.js → chunk-S6DXSQCV.js} +5 -3
- package/dist/chunk-S6DXSQCV.js.map +1 -0
- package/dist/{chunk-LSX2OFNB.js → chunk-SAOIGWA2.js} +3 -3
- package/dist/{chunk-LSX2OFNB.js.map → chunk-SAOIGWA2.js.map} +1 -1
- package/dist/{chunk-PHQVAPSD.js → chunk-SHSDGAI4.js} +29 -17
- package/dist/chunk-SHSDGAI4.js.map +1 -0
- package/dist/{chunk-QNPYYSLT.cjs → chunk-SR7WH4FX.cjs} +33 -33
- package/dist/{chunk-QNPYYSLT.cjs.map → chunk-SR7WH4FX.cjs.map} +1 -1
- package/dist/{chunk-OZA4DE23.js → chunk-SZ7ALYPK.js} +3 -3
- package/dist/{chunk-OZA4DE23.js.map → chunk-SZ7ALYPK.js.map} +1 -1
- package/dist/{chunk-DNWFFVC6.js → chunk-T4YYUI5Q.js} +3 -3
- package/dist/{chunk-DNWFFVC6.js.map → chunk-T4YYUI5Q.js.map} +1 -1
- package/dist/{chunk-ZWEVRMFN.cjs → chunk-TOYWEF6E.cjs} +51 -28
- package/dist/chunk-TOYWEF6E.cjs.map +1 -0
- package/dist/{chunk-V24EPI5N.cjs → chunk-U4DIGIC3.cjs} +5 -3
- package/dist/chunk-U4DIGIC3.cjs.map +1 -0
- package/dist/{chunk-NTCSXKZ3.cjs → chunk-U6APV2PO.cjs} +5 -5
- package/dist/{chunk-NTCSXKZ3.cjs.map → chunk-U6APV2PO.cjs.map} +1 -1
- package/dist/{chunk-7PC2YHBN.cjs → chunk-UJIPIVTB.cjs} +48 -48
- package/dist/{chunk-7PC2YHBN.cjs.map → chunk-UJIPIVTB.cjs.map} +1 -1
- package/dist/{chunk-H5KHWTAE.js → chunk-UY6QZX7H.js} +4 -4
- package/dist/chunk-UY6QZX7H.js.map +1 -0
- package/dist/{chunk-DBD4BCGH.cjs → chunk-VDFQKLDG.cjs} +33 -2
- package/dist/chunk-VDFQKLDG.cjs.map +1 -0
- package/dist/{chunk-OEOOXL3F.js → chunk-VZIMLPDC.js} +5 -5
- package/dist/chunk-VZIMLPDC.js.map +1 -0
- package/dist/{chunk-TWUFC32F.cjs → chunk-W4CJ2P3F.cjs} +8 -8
- package/dist/{chunk-TWUFC32F.cjs.map → chunk-W4CJ2P3F.cjs.map} +1 -1
- package/dist/{chunk-HP3YIWNJ.js → chunk-WARGPM7P.js} +2 -2
- package/dist/{chunk-HP3YIWNJ.js.map → chunk-WARGPM7P.js.map} +1 -1
- package/dist/{chunk-3OHRFSQL.cjs → chunk-WHK3HTFY.cjs} +73 -60
- package/dist/chunk-WHK3HTFY.cjs.map +1 -0
- package/dist/{chunk-5ZCZL73I.js → chunk-X3YRSRHP.js} +3 -3
- package/dist/{chunk-5ZCZL73I.js.map → chunk-X3YRSRHP.js.map} +1 -1
- package/dist/{chunk-OOUJZR4K.js → chunk-XK75VOEH.js} +5 -5
- package/dist/{chunk-OOUJZR4K.js.map → chunk-XK75VOEH.js.map} +1 -1
- package/dist/{chunk-LY6IR5LL.cjs → chunk-YHZUTPZL.cjs} +26 -24
- package/dist/{chunk-DE55SA2X.js.map → chunk-YHZUTPZL.cjs.map} +1 -1
- package/dist/{chunk-MGSGLRHZ.cjs → chunk-ZJQ2L3MI.cjs} +72 -11
- package/dist/chunk-ZJQ2L3MI.cjs.map +1 -0
- package/dist/entries/apps.cjs +43 -43
- package/dist/entries/apps.js +8 -8
- package/dist/entries/credits.cjs +426 -238
- package/dist/entries/credits.d.cts +277 -1
- package/dist/entries/credits.d.ts +277 -1
- package/dist/entries/credits.js +11 -11
- package/dist/entries/edl.cjs +60 -60
- package/dist/entries/edl.d.cts +96 -1
- package/dist/entries/edl.d.ts +96 -1
- package/dist/entries/edl.js +1 -1
- package/dist/entries/llm-models.cjs +76 -72
- package/dist/entries/llm-models.d.cts +38 -4
- package/dist/entries/llm-models.d.ts +38 -4
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/media.cjs +87 -87
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +133 -133
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +431 -415
- package/dist/entries/models.d.cts +62 -27
- package/dist/entries/models.d.ts +62 -27
- package/dist/entries/models.js +7 -7
- package/dist/entries/nodes.cjs +215 -215
- package/dist/entries/nodes.js +11 -11
- package/dist/entries/pipeline.cjs +153 -153
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +241 -177
- package/dist/entries/social.d.cts +189 -6
- package/dist/entries/social.d.ts +189 -6
- 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 +153 -153
- package/dist/entries/video.js +7 -7
- package/dist/entries/workflow.cjs +152 -152
- package/dist/entries/workflow.js +4 -4
- package/dist/index.cjs +2203 -1931
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +27 -27
- package/package.json +1 -1
- package/src/__tests__/audio-isolation-pricing.test.ts +49 -0
- package/src/__tests__/cast-swap-limits.test.ts +54 -20
- package/src/__tests__/competitors.test.ts +69 -0
- package/src/__tests__/credit-identifiers.test.ts +9 -10
- package/src/__tests__/lip-sync-pricing.test.ts +29 -2
- package/src/__tests__/llm-models.test.ts +50 -7
- package/src/__tests__/motion-transfer-pricing.test.ts +252 -0
- package/src/__tests__/suno-separate.test.ts +32 -0
- package/src/__tests__/video-to-video-pricing.test.ts +151 -0
- package/src/audio-isolation-pricing.ts +80 -0
- package/src/cast-swap-limits.ts +43 -25
- package/src/competitors.ts +86 -8
- package/src/credit-identifiers.ts +6 -0
- package/src/entries/credits.ts +56 -0
- package/src/entries/edl.ts +2 -0
- package/src/entries/llm-models.ts +2 -0
- package/src/entries/models.ts +4 -0
- package/src/entries/social.ts +34 -0
- package/src/generated/unit-contracts.ts +1 -0
- package/src/lip-sync-pricing.ts +25 -0
- package/src/llm-models.ts +60 -4
- package/src/model-catalog.ts +46 -23
- package/src/motion-transfer-pricing.ts +239 -0
- package/src/node-runtime-keys.ts +2 -2
- package/src/producer-types.ts +2 -0
- package/src/suno-separate.ts +51 -0
- package/src/topics.ts +162 -0
- package/src/use-case-output.ts +102 -0
- package/src/video-face-mesh.ts +1 -1
- package/src/video-to-video-pricing.ts +248 -0
- package/dist/chunk-3OHRFSQL.cjs.map +0 -1
- package/dist/chunk-54E2JO4E.cjs.map +0 -1
- package/dist/chunk-5EQRIUGI.cjs.map +0 -1
- package/dist/chunk-5WHU7CYE.js.map +0 -1
- package/dist/chunk-6Q4BS6AR.js.map +0 -1
- package/dist/chunk-BDW25A7Y.js.map +0 -1
- package/dist/chunk-DBD4BCGH.cjs.map +0 -1
- package/dist/chunk-FUYBUT65.js.map +0 -1
- package/dist/chunk-H5KHWTAE.js.map +0 -1
- package/dist/chunk-KL6GAYTT.js.map +0 -1
- package/dist/chunk-KSHAAPQF.cjs.map +0 -1
- package/dist/chunk-LY6IR5LL.cjs.map +0 -1
- package/dist/chunk-MGSGLRHZ.cjs.map +0 -1
- package/dist/chunk-OEOOXL3F.js.map +0 -1
- package/dist/chunk-PHQVAPSD.js.map +0 -1
- package/dist/chunk-PLANUXQL.cjs.map +0 -1
- package/dist/chunk-V24EPI5N.cjs.map +0 -1
- package/dist/chunk-YVQFYW2U.js.map +0 -1
- package/dist/chunk-ZWEVRMFN.cjs.map +0 -1
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
getLipSyncMaxAudioSeconds,
|
|
5
5
|
isPerSecondLipSyncProvider,
|
|
6
6
|
buildLipSyncCreditId,
|
|
7
|
+
LIP_SYNC_CHARGED_AT_RUN_COST,
|
|
8
|
+
isLipSyncChargedAtRunCost,
|
|
7
9
|
} from "../lip-sync-pricing.js"
|
|
8
10
|
|
|
9
11
|
describe("pickLipSyncBucket", () => {
|
|
@@ -81,7 +83,26 @@ describe("isPerSecondLipSyncProvider", () => {
|
|
|
81
83
|
|
|
82
84
|
it("returns false for everything else", () => {
|
|
83
85
|
expect(isPerSecondLipSyncProvider("infinitalk")).toBe(false)
|
|
84
|
-
expect(isPerSecondLipSyncProvider("
|
|
86
|
+
expect(isPerSecondLipSyncProvider("seedance-2")).toBe(false)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it("flags LatentSync: its work grows with its audio's length", () => {
|
|
90
|
+
expect(isPerSecondLipSyncProvider("latentsync")).toBe(true)
|
|
91
|
+
expect(getLipSyncMaxAudioSeconds("latentsync")).toBe(300)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
describe("models charged what the run used (the bucket row is their hold)", () => {
|
|
96
|
+
it("is LatentSync, and no other", () => {
|
|
97
|
+
expect([...LIP_SYNC_CHARGED_AT_RUN_COST]).toEqual(["latentsync"])
|
|
98
|
+
expect(isLipSyncChargedAtRunCost("latentsync")).toBe(true)
|
|
99
|
+
for (const p of ["kling-avatar", "lipsync-2-pro", "omnihuman-2-0", "infinitalk", undefined, 7]) {
|
|
100
|
+
expect(isLipSyncChargedAtRunCost(p), String(p)).toBe(false)
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it("every member is a bucketed model: the hold is its bucket row", () => {
|
|
105
|
+
for (const p of LIP_SYNC_CHARGED_AT_RUN_COST) expect(isPerSecondLipSyncProvider(p), p).toBe(true)
|
|
85
106
|
})
|
|
86
107
|
})
|
|
87
108
|
|
|
@@ -123,7 +144,13 @@ describe("buildLipSyncCreditId", () => {
|
|
|
123
144
|
|
|
124
145
|
it("returns the bare provider for non-per-second models", () => {
|
|
125
146
|
expect(buildLipSyncCreditId("infinitalk", 10)).toBe("infinitalk")
|
|
126
|
-
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it("emits composite IDs for LatentSync (its hold)", () => {
|
|
150
|
+
expect(buildLipSyncCreditId("latentsync", 12)).toBe("latentsync:15s")
|
|
151
|
+
expect(buildLipSyncCreditId("latentsync", 26.9)).toBe("latentsync:30s")
|
|
152
|
+
expect(buildLipSyncCreditId("latentsync", 999)).toBe("latentsync:300s")
|
|
153
|
+
expect(buildLipSyncCreditId("latentsync", undefined)).toBe("latentsync:300s")
|
|
127
154
|
})
|
|
128
155
|
})
|
|
129
156
|
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
LLM_REFERENCE_FILES_MAX_PAGES,
|
|
47
47
|
LLM_REFERENCE_FILE_MIME_TYPES,
|
|
48
48
|
llmAcceptsFiles,
|
|
49
|
+
llmFileWire,
|
|
49
50
|
} from "../llm-models.js"
|
|
50
51
|
import type { LlmModelDef, LlmTier, LlmFeature } from "../llm-models.js"
|
|
51
52
|
import { PIPELINE_ACCEPTED_SCRIPT_LLMS, PIPELINE_LEGACY_PINNED_SCRIPT_LLMS, PIPELINE_PINNABLE_SCRIPT_LLMS, PipelineConfigSchema } from "../pipeline-types.js"
|
|
@@ -1203,9 +1204,17 @@ describe("gemini-4-hydrogen exposure", () => {
|
|
|
1203
1204
|
expect(getLlmTier("gemini-4-hydrogen")).toBe("premium")
|
|
1204
1205
|
})
|
|
1205
1206
|
|
|
1206
|
-
it("reads images, video and
|
|
1207
|
-
expect(getLlmModalityCaps("gemini-4-hydrogen")).toEqual({ image: true, video: true, audio: true })
|
|
1208
|
-
expect(llmAcceptsFiles("gemini-4-hydrogen")).toBe(
|
|
1207
|
+
it("reads images, video, audio and PDF files on the LLM nodes (decided 2026-11-16 and 2026-11-17)", () => {
|
|
1208
|
+
expect(getLlmModalityCaps("gemini-4-hydrogen")).toEqual({ image: true, video: true, audio: true, file: true })
|
|
1209
|
+
expect(llmAcceptsFiles("gemini-4-hydrogen")).toBe(true)
|
|
1210
|
+
// The shape probed on its aggregator lane (2026-11-17), and an inline part on Google's own API.
|
|
1211
|
+
expect(llmFileWire("gemini-4-hydrogen")).toEqual({ kie: "image-url", direct: "inline-data" })
|
|
1212
|
+
})
|
|
1213
|
+
|
|
1214
|
+
it("the file cap enrols it in nothing outside the LLM nodes", () => {
|
|
1215
|
+
expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gemini-4-hydrogen")
|
|
1216
|
+
expect(readsVideoOutsideLlmNodes("gemini-4-hydrogen")).toBe(false)
|
|
1217
|
+
expect(readsAudioOutsideLlmNodes("gemini-4-hydrogen")).toBe(false)
|
|
1209
1218
|
})
|
|
1210
1219
|
|
|
1211
1220
|
it("its media caps are for the LLM nodes only: no Video Analysis list, tier, legacy row or passthrough", () => {
|
|
@@ -1283,10 +1292,11 @@ describe("gpt-6.1-terra exposure", () => {
|
|
|
1283
1292
|
})
|
|
1284
1293
|
|
|
1285
1294
|
describe("the `file` modality cap (documents, decided 2026-11-13)", () => {
|
|
1286
|
-
it("is declared on GPT-6.1 Terra
|
|
1287
|
-
|
|
1288
|
-
expect(
|
|
1289
|
-
|
|
1295
|
+
it("is declared on GPT-6.1 Terra and Gemini 4 Hydrogen, and never derived for another model", () => {
|
|
1296
|
+
const readers = ["gemini-4-hydrogen", "gpt-6.1-terra"]
|
|
1297
|
+
expect(LLM_FILE_MODELS.map((m) => m.id)).toEqual(readers)
|
|
1298
|
+
expect(Object.entries(LLM_MODALITY_CAPS).filter(([, c]) => c.file).map(([id]) => id).sort()).toEqual(readers)
|
|
1299
|
+
for (const m of LLM_MODELS) expect(llmAcceptsFiles(m.id), m.id).toBe(readers.includes(m.id))
|
|
1290
1300
|
expect(llmAcceptsFiles(undefined)).toBe(false)
|
|
1291
1301
|
expect(llmAcceptsFiles("no-such-model")).toBe(false)
|
|
1292
1302
|
// Its siblings on the same endpoint do not read files here.
|
|
@@ -1294,6 +1304,39 @@ describe("the `file` modality cap (documents, decided 2026-11-13)", () => {
|
|
|
1294
1304
|
expect(llmAcceptsFiles("gpt-5.6-terra")).toBe(false)
|
|
1295
1305
|
})
|
|
1296
1306
|
|
|
1307
|
+
// Every declaration, by model. A shape is never derived from a model's
|
|
1308
|
+
// dialect: a new model gets a row here only with its own probe, whose date
|
|
1309
|
+
// goes on its registry entry.
|
|
1310
|
+
const FILE_WIRES: Record<string, unknown> = {
|
|
1311
|
+
// Probed 2026-11-13: an inline `input_file` part on the responses dialect.
|
|
1312
|
+
"gpt-6.1-terra": { kie: "input-file" },
|
|
1313
|
+
// Probed 2026-11-17 on both lanes: an `image_url` part on the aggregator's
|
|
1314
|
+
// chat-completions dialect, an inline part on Google's own API.
|
|
1315
|
+
"gemini-4-hydrogen": { kie: "image-url", direct: "inline-data" },
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
it("a model reads files exactly when it is listed with how each of its lanes is sent one (`fileWire`)", () => {
|
|
1319
|
+
for (const m of LLM_MODELS) {
|
|
1320
|
+
expect(m.fileWire, m.id).toEqual(FILE_WIRES[m.id])
|
|
1321
|
+
expect(llmAcceptsFiles(m.id), m.id).toBe(m.id in FILE_WIRES)
|
|
1322
|
+
expect(llmFileWire(m.id), m.id).toEqual(FILE_WIRES[m.id])
|
|
1323
|
+
}
|
|
1324
|
+
expect(Object.keys(FILE_WIRES).sort()).toEqual(LLM_FILE_MODELS.map((m) => m.id).sort())
|
|
1325
|
+
// A sibling on the same dialect has no shape of its own.
|
|
1326
|
+
for (const id of ["gemini-4-carbon", "gemini-4-argon", "gemini-3.8-flash", "gpt-6.1-sol", "gpt-5.6-terra"]) expect(llmFileWire(id), id).toBeUndefined()
|
|
1327
|
+
expect(llmFileWire(undefined)).toBeUndefined()
|
|
1328
|
+
})
|
|
1329
|
+
|
|
1330
|
+
it("a declared shape fits the lanes its model has", () => {
|
|
1331
|
+
for (const m of LLM_FILE_MODELS) {
|
|
1332
|
+
// The aggregator's shape is one its dialect can carry.
|
|
1333
|
+
expect(m.kieFormat, m.id).toBe(m.fileWire!.kie === "input-file" ? "responses" : "chat-completions")
|
|
1334
|
+
// A direct Google lane is declared a shape, and only a model with one has it.
|
|
1335
|
+
expect(Boolean(m.fileWire!.direct), m.id).toBe(Boolean(m.directGeminiModel))
|
|
1336
|
+
expect(m.directFallbackModel, m.id).toBeUndefined()
|
|
1337
|
+
}
|
|
1338
|
+
})
|
|
1339
|
+
|
|
1297
1340
|
it("PDF only, up to 5 files, 6 MB in all and 100 pages in all", () => {
|
|
1298
1341
|
expect(LLM_REFERENCE_FILE_MIME_TYPES).toEqual(["application/pdf"])
|
|
1299
1342
|
expect(LLM_REFERENCE_FILES_MAX).toBe(5)
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
checkMotionTransferLength,
|
|
4
|
+
motionTransferBilledSeconds,
|
|
5
|
+
motionTransferEstimatePrice,
|
|
6
|
+
motionTransferEstimateSeconds,
|
|
7
|
+
motionTransferMaxSec,
|
|
8
|
+
motionTransferPrice,
|
|
9
|
+
motionTransferRateOf,
|
|
10
|
+
motionTransferBaseCharge,
|
|
11
|
+
motionTransferChargedPrice,
|
|
12
|
+
MOTION_TRANSFER_FLOOR_IDS,
|
|
13
|
+
MOTION_TRANSFER_RATE_IDS,
|
|
14
|
+
MOTION_TRANSFER_SECOND_RATES,
|
|
15
|
+
} from "../motion-transfer-pricing.js"
|
|
16
|
+
import { motionTransferResolution } from "../credit-identifiers.js"
|
|
17
|
+
|
|
18
|
+
/** The rows as they are seeded (migrations 668 and 670, and the flat Wan Animate rows they never change). */
|
|
19
|
+
const ROWS: Record<string, number> = {
|
|
20
|
+
"motion-transfer:720p:per-4s": 126,
|
|
21
|
+
"motion-transfer:1080p:per-4s": 203,
|
|
22
|
+
"kling-3.0-motion:720p:per-4s": 228,
|
|
23
|
+
"kling-3.0-motion:1080p:per-4s": 302,
|
|
24
|
+
"wan-animate-replace:480p:per-4s": 60,
|
|
25
|
+
"wan-animate-replace:580p:per-4s": 95,
|
|
26
|
+
"wan-animate-replace:720p:per-4s": 125,
|
|
27
|
+
"wan-animate-move:720p:per-4s": 125,
|
|
28
|
+
"wan-animate-move": 255,
|
|
29
|
+
"wan-animate-move:580p": 330,
|
|
30
|
+
"wan-animate-move:720p": 410,
|
|
31
|
+
"wan-animate-replace": 255,
|
|
32
|
+
"wan-animate-replace:580p": 330,
|
|
33
|
+
"wan-animate-replace:720p": 410,
|
|
34
|
+
}
|
|
35
|
+
/** The base credits and the row a run of `seconds` billed seconds is charged at the seeded rows. */
|
|
36
|
+
const charge = (provider: string, resolution: string, seconds: number) => motionTransferBaseCharge(motionTransferPrice(provider, resolution, seconds), (id) => ROWS[id])
|
|
37
|
+
|
|
38
|
+
describe("Motion Transfer pricing from the driving video's length", () => {
|
|
39
|
+
describe("billed seconds", () => {
|
|
40
|
+
it("rounds the measured length up to a whole second", () => {
|
|
41
|
+
expect(motionTransferBilledSeconds(3)).toBe(3)
|
|
42
|
+
expect(motionTransferBilledSeconds(3.2)).toBe(4)
|
|
43
|
+
expect(motionTransferBilledSeconds(9.5)).toBe(10)
|
|
44
|
+
})
|
|
45
|
+
it("forgives up to 0.05 s past a whole second", () => {
|
|
46
|
+
expect(motionTransferBilledSeconds(10.05)).toBe(10)
|
|
47
|
+
expect(motionTransferBilledSeconds(10.04)).toBe(10)
|
|
48
|
+
expect(motionTransferBilledSeconds(10.06)).toBe(11)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
describe("limits", () => {
|
|
53
|
+
it("Kling 2.6 and Kling 3.0 take 10 s keeping the image's orientation (the default), 30 s following the video's", () => {
|
|
54
|
+
for (const provider of ["kling", "kling-3.0"]) {
|
|
55
|
+
expect(motionTransferMaxSec(provider, undefined)).toBe(10)
|
|
56
|
+
expect(motionTransferMaxSec(provider, "image")).toBe(10)
|
|
57
|
+
expect(motionTransferMaxSec(provider, "bogus")).toBe(10)
|
|
58
|
+
expect(motionTransferMaxSec(provider, "video")).toBe(30)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
it("Wan Animate takes 30 s whatever the orientation", () => {
|
|
62
|
+
expect(motionTransferMaxSec("wan-animate-move", "image")).toBe(30)
|
|
63
|
+
expect(motionTransferMaxSec("wan-animate-replace", undefined)).toBe(30)
|
|
64
|
+
})
|
|
65
|
+
it("refuses a clip under 3 s", () => {
|
|
66
|
+
const r = checkMotionTransferLength("kling", "image", 2.9)
|
|
67
|
+
expect(r.ok).toBe(false)
|
|
68
|
+
if (!r.ok) {
|
|
69
|
+
expect(r.code).toBe("video_too_short")
|
|
70
|
+
expect(r.message).toContain("at least 3 seconds")
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
it("refuses a clip past the limit, naming it and asking to trim", () => {
|
|
74
|
+
const r = checkMotionTransferLength("kling-3.0", "image", 12)
|
|
75
|
+
expect(r.ok).toBe(false)
|
|
76
|
+
if (!r.ok) {
|
|
77
|
+
expect(r.code).toBe("video_too_long")
|
|
78
|
+
expect(r.message).toContain("at most 10 seconds")
|
|
79
|
+
expect(r.message).toContain("Trim the video first")
|
|
80
|
+
}
|
|
81
|
+
const v = checkMotionTransferLength("kling-3.0", "video", 31)
|
|
82
|
+
expect(v.ok).toBe(false)
|
|
83
|
+
if (!v.ok) expect(v.message).toContain("at most 30 seconds")
|
|
84
|
+
expect(checkMotionTransferLength("wan-animate-move", "image", 30.5).ok).toBe(false)
|
|
85
|
+
})
|
|
86
|
+
it("accepts a clip within 0.05 s past the limit and bills it at the limit", () => {
|
|
87
|
+
expect(checkMotionTransferLength("kling", "image", 10.05)).toEqual({ ok: true, billedSeconds: 10 })
|
|
88
|
+
expect(checkMotionTransferLength("kling", "image", 10.06).ok).toBe(false)
|
|
89
|
+
expect(checkMotionTransferLength("kling-3.0", "video", 30.04)).toEqual({ ok: true, billedSeconds: 30 })
|
|
90
|
+
})
|
|
91
|
+
it("accepts 3 s exactly", () => {
|
|
92
|
+
expect(checkMotionTransferLength("kling", "image", 3)).toEqual({ ok: true, billedSeconds: 3 })
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
describe("Kling 3.0 at 720p: a per-second rate", () => {
|
|
97
|
+
it("is charged its four-second row × billed seconds ÷ 4", () => {
|
|
98
|
+
expect(motionTransferPrice("kling-3.0", "720p", 10)).toEqual({ creditId: "kling-3.0-motion:720p:per-4s", units: 2.5 })
|
|
99
|
+
expect(motionTransferPrice("kling-3.0", "720p", 3)).toEqual({ creditId: "kling-3.0-motion:720p:per-4s", units: 0.75 })
|
|
100
|
+
})
|
|
101
|
+
it("worked examples: 10 s → 570 base credits, 3 s → 171 (the 228 row)", () => {
|
|
102
|
+
expect(charge("kling-3.0", "720p", 10)).toEqual({ creditId: "kling-3.0-motion:720p:per-4s", units: 2.5, baseCredits: 570 })
|
|
103
|
+
expect(charge("kling-3.0", "720p", 3).baseCredits).toBe(171)
|
|
104
|
+
})
|
|
105
|
+
it("any size but 1080p is charged as 720p, so it is on the rate too", () => {
|
|
106
|
+
expect(motionTransferRateOf("kling-3.0", "480p").rateId).toBe("kling-3.0-motion:720p:per-4s")
|
|
107
|
+
expect(motionTransferRateOf("kling-3.0", "580p").rateId).toBe("kling-3.0-motion:720p:per-4s")
|
|
108
|
+
expect(motionTransferRateOf("kling-3.0", undefined).rateId).toBe("kling-3.0-motion:720p:per-4s")
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe("every model and size is charged per second (decided 2026-11-18)", () => {
|
|
113
|
+
it("lists every rate row once and every floor row once", () => {
|
|
114
|
+
expect([...MOTION_TRANSFER_RATE_IDS].sort()).toEqual([
|
|
115
|
+
"kling-3.0-motion:1080p:per-4s",
|
|
116
|
+
"kling-3.0-motion:720p:per-4s",
|
|
117
|
+
"motion-transfer:1080p:per-4s",
|
|
118
|
+
"motion-transfer:720p:per-4s",
|
|
119
|
+
"wan-animate-move:720p:per-4s",
|
|
120
|
+
"wan-animate-replace:480p:per-4s",
|
|
121
|
+
"wan-animate-replace:580p:per-4s",
|
|
122
|
+
"wan-animate-replace:720p:per-4s",
|
|
123
|
+
])
|
|
124
|
+
expect([...MOTION_TRANSFER_FLOOR_IDS].sort()).toEqual([
|
|
125
|
+
"wan-animate-move:720p",
|
|
126
|
+
"wan-animate-replace",
|
|
127
|
+
"wan-animate-replace:580p",
|
|
128
|
+
"wan-animate-replace:720p",
|
|
129
|
+
])
|
|
130
|
+
})
|
|
131
|
+
it("every size a model runs at has a rate, and no rate is a length tier", () => {
|
|
132
|
+
for (const provider of ["kling", "kling-3.0", "wan-animate-move", "wan-animate-replace"]) {
|
|
133
|
+
for (const size of ["480p", "580p", "720p", "1080p", undefined]) {
|
|
134
|
+
const sized = motionTransferResolution(provider, size ?? "720p").resolution
|
|
135
|
+
const rate = motionTransferRateOf(provider, size)
|
|
136
|
+
expect(rate.rateId).toMatch(/:per-4s$/)
|
|
137
|
+
if (provider.startsWith("wan-")) expect(Object.prototype.hasOwnProperty.call(MOTION_TRANSFER_SECOND_RATES, `${provider}:${sized}`)).toBe(true)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
it("a model Motion Transfer does not have is priced as its default, Kling 2.6", () => {
|
|
142
|
+
expect(motionTransferRateOf("bogus", "720p").rateId).toBe("motion-transfer:720p:per-4s")
|
|
143
|
+
expect(motionTransferRateOf(undefined, "1080p").rateId).toBe("motion-transfer:1080p:per-4s")
|
|
144
|
+
})
|
|
145
|
+
it("Kling 2.6: 126 base credits per 4 s at 720p, 203 at 1080p, no floor", () => {
|
|
146
|
+
expect(charge("kling", "720p", 10)).toEqual({ creditId: "motion-transfer:720p:per-4s", units: 2.5, baseCredits: 315 })
|
|
147
|
+
expect(charge("kling", "720p", 3).baseCredits).toBe(95)
|
|
148
|
+
expect(charge("kling", "1080p", 10)).toEqual({ creditId: "motion-transfer:1080p:per-4s", units: 2.5, baseCredits: 508 })
|
|
149
|
+
expect(charge("kling", "1080p", 30).baseCredits).toBe(1523)
|
|
150
|
+
expect(charge("kling", "480p", 5).creditId).toBe("motion-transfer:720p:per-4s")
|
|
151
|
+
})
|
|
152
|
+
it("Kling 3.0 at 1080p: 302 base credits per 4 s, no floor", () => {
|
|
153
|
+
expect(charge("kling-3.0", "1080p", 10)).toEqual({ creditId: "kling-3.0-motion:1080p:per-4s", units: 2.5, baseCredits: 755 })
|
|
154
|
+
expect(charge("kling-3.0", "1080p", 3).baseCredits).toBe(227)
|
|
155
|
+
})
|
|
156
|
+
it("a 10.5 s clip is billed 11 s", () => {
|
|
157
|
+
expect(charge("kling", "720p", motionTransferBilledSeconds(10.5)).baseCredits).toBe(Math.ceil((126 * 11) / 4))
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
describe("Wan Animate: per second, never below today's flat price for the size", () => {
|
|
162
|
+
it("Replace 720p: 3 s stays at today's 410; 30 s is ceil(125 × 30 ÷ 4) = 938", () => {
|
|
163
|
+
expect(charge("wan-animate-replace", "720p", 3)).toEqual({ creditId: "wan-animate-replace:720p", baseCredits: 410 })
|
|
164
|
+
expect(charge("wan-animate-replace", "720p", 30)).toEqual({ creditId: "wan-animate-replace:720p:per-4s", units: 7.5, baseCredits: 938 })
|
|
165
|
+
})
|
|
166
|
+
// Each floored row on both sides of the length where the rate passes it.
|
|
167
|
+
it.each([
|
|
168
|
+
["wan-animate-replace", "480p", 17, "wan-animate-replace", 255, 18, 270],
|
|
169
|
+
["wan-animate-replace", "580p", 13, "wan-animate-replace:580p", 330, 14, 333],
|
|
170
|
+
["wan-animate-replace", "720p", 13, "wan-animate-replace:720p", 410, 14, 438],
|
|
171
|
+
["wan-animate-move", "720p", 13, "wan-animate-move:720p", 410, 14, 438],
|
|
172
|
+
["wan-animate-move", "480p", 13, "wan-animate-move:720p", 410, 14, 438],
|
|
173
|
+
["wan-animate-move", "580p", 13, "wan-animate-move:720p", 410, 14, 438],
|
|
174
|
+
] as const)("%s %s: %d s is the floor row, %d s past it the rate", (provider, size, onFloor, floorId, floorBase, past, pastBase) => {
|
|
175
|
+
expect(charge(provider, size, onFloor)).toEqual({ creditId: floorId, baseCredits: floorBase })
|
|
176
|
+
expect(charge(provider, size, past)).toMatchObject({ creditId: motionTransferRateOf(provider, size).rateId, units: past / 4, baseCredits: pastBase })
|
|
177
|
+
})
|
|
178
|
+
it("a tie goes to the floor row: Replace 480p at 17 s is 255 either way", () => {
|
|
179
|
+
expect(Math.ceil((60 * 17) / 4)).toBe(255)
|
|
180
|
+
expect(charge("wan-animate-replace", "480p", 17).creditId).toBe("wan-animate-replace")
|
|
181
|
+
})
|
|
182
|
+
it("Move runs at 720p only: any size it names is sent and charged as 720p, floored at the 720p row", () => {
|
|
183
|
+
for (const size of ["480p", "580p", "720p", "1080p"]) {
|
|
184
|
+
expect(motionTransferResolution("wan-animate-move", size).resolution).toBe("720p")
|
|
185
|
+
expect(motionTransferRateOf("wan-animate-move", size)).toEqual({ rateId: "wan-animate-move:720p:per-4s", rateSeconds: 4, floorId: "wan-animate-move:720p" })
|
|
186
|
+
}
|
|
187
|
+
expect(charge("wan-animate-move", "480p", 30)).toMatchObject({ creditId: "wan-animate-move:720p:per-4s", baseCredits: 938 })
|
|
188
|
+
expect(charge("wan-animate-move", "480p", 5)).toEqual({ creditId: "wan-animate-move:720p", baseCredits: 410 })
|
|
189
|
+
})
|
|
190
|
+
it("Replace keeps its three sizes", () => {
|
|
191
|
+
for (const size of ["480p", "580p", "720p"]) expect(motionTransferResolution("wan-animate-replace", size).resolution).toBe(size)
|
|
192
|
+
})
|
|
193
|
+
it("a 1080p request runs, and is charged, as 720p", () => {
|
|
194
|
+
expect(motionTransferRateOf("wan-animate-replace", "1080p")).toEqual({ rateId: "wan-animate-replace:720p:per-4s", rateSeconds: 4, floorId: "wan-animate-replace:720p" })
|
|
195
|
+
})
|
|
196
|
+
it("the floor rule reads charged figures the same way (the editor's)", () => {
|
|
197
|
+
const price = motionTransferPrice("wan-animate-replace", "720p", 10)
|
|
198
|
+
expect(motionTransferChargedPrice(price, { perSecond: 360, floor: 472 })).toEqual({ creditId: "wan-animate-replace:720p" })
|
|
199
|
+
expect(motionTransferChargedPrice(price, { perSecond: 500, floor: 472 })).toEqual({ creditId: "wan-animate-replace:720p:per-4s", units: 2.5 })
|
|
200
|
+
})
|
|
201
|
+
it("a row priced nowhere leaves the rate, whose own lookup refuses it", () => {
|
|
202
|
+
const price = motionTransferPrice("wan-animate-replace", "720p", 3)
|
|
203
|
+
expect(motionTransferChargedPrice(price, { perSecond: undefined, floor: 410 })).toEqual({ creditId: "wan-animate-replace:720p:per-4s", units: 0.75 })
|
|
204
|
+
expect(motionTransferChargedPrice(price, { perSecond: 94, floor: undefined })).toEqual({ creditId: "wan-animate-replace:720p:per-4s", units: 0.75 })
|
|
205
|
+
})
|
|
206
|
+
it("the charge never falls as the clip grows, and is never below the floor", () => {
|
|
207
|
+
for (const [provider, size] of [["wan-animate-replace", "480p"], ["wan-animate-replace", "580p"], ["wan-animate-replace", "720p"], ["wan-animate-move", "480p"], ["wan-animate-move", "720p"]] as const) {
|
|
208
|
+
const floor = ROWS[motionTransferRateOf(provider, size).floorId!]!
|
|
209
|
+
let last = 0
|
|
210
|
+
for (let sec = 3; sec <= 30; sec++) {
|
|
211
|
+
const base = charge(provider, size, sec).baseCredits!
|
|
212
|
+
expect(base).toBeGreaterThanOrEqual(Math.max(last, floor))
|
|
213
|
+
last = base
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
describe("estimates", () => {
|
|
220
|
+
it("quote the known length, billed as a run bills it, at most the limit", () => {
|
|
221
|
+
expect(motionTransferEstimateSeconds("kling-3.0", "image", 6.2)).toBe(7)
|
|
222
|
+
expect(motionTransferEstimateSeconds("kling-3.0", "image", 25)).toBe(10)
|
|
223
|
+
expect(motionTransferEstimateSeconds("kling-3.0", "video", 25)).toBe(25)
|
|
224
|
+
})
|
|
225
|
+
it("quote the orientation's limit when the length is unknown", () => {
|
|
226
|
+
expect(motionTransferEstimateSeconds("kling-3.0", undefined, undefined)).toBe(10)
|
|
227
|
+
expect(motionTransferEstimateSeconds("kling-3.0", "video", null)).toBe(30)
|
|
228
|
+
expect(motionTransferEstimatePrice("kling-3.0", "720p", "image", undefined)).toEqual({
|
|
229
|
+
creditId: "kling-3.0-motion:720p:per-4s",
|
|
230
|
+
units: 2.5,
|
|
231
|
+
lengthKnown: false,
|
|
232
|
+
})
|
|
233
|
+
expect(motionTransferEstimatePrice("kling", "720p", "video", undefined)).toEqual({ creditId: "motion-transfer:720p:per-4s", units: 7.5, lengthKnown: false })
|
|
234
|
+
expect(motionTransferEstimatePrice("wan-animate-move", "480p", "image", undefined)).toEqual({
|
|
235
|
+
creditId: "wan-animate-move:720p:per-4s",
|
|
236
|
+
units: 7.5,
|
|
237
|
+
floorId: "wan-animate-move:720p",
|
|
238
|
+
lengthKnown: false,
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
it("never quotes below a run of the same clip", () => {
|
|
242
|
+
for (let tenth = 30; tenth <= 300; tenth++) {
|
|
243
|
+
const sec = tenth / 10
|
|
244
|
+
for (const orientation of ["image", "video"]) {
|
|
245
|
+
const run = checkMotionTransferLength("kling-3.0", orientation, sec)
|
|
246
|
+
if (!run.ok) continue
|
|
247
|
+
expect(motionTransferEstimateSeconds("kling-3.0", orientation, sec)).toBeGreaterThanOrEqual(run.billedSeconds)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
})
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
sunoSeparateCreditId,
|
|
11
11
|
sunoSeparateHandleUrl,
|
|
12
12
|
sunoSeparatePrimaryUrl,
|
|
13
|
+
SUNO_SEPARATE_ID_FIELDS,
|
|
14
|
+
sunoSeparateHandleField,
|
|
15
|
+
sunoSeparateHandleIds,
|
|
13
16
|
} from "../entries/models.js"
|
|
14
17
|
|
|
15
18
|
describe("sunoSeparateCreditId", () => {
|
|
@@ -76,3 +79,32 @@ it("sunoSeparatePrimaryUrl", () => {
|
|
|
76
79
|
expect(sunoSeparatePrimaryUrl({ isolatedUrl: "I", withoutUrl: "W" })).toBe("I")
|
|
77
80
|
expect(sunoSeparatePrimaryUrl({ drumsUrl: "D" })).toBe("D")
|
|
78
81
|
})
|
|
82
|
+
|
|
83
|
+
describe("sunoSeparateHandleIds — the Suno ids of the stem behind a handle", () => {
|
|
84
|
+
const out = {
|
|
85
|
+
sunoTaskId: "sep-task",
|
|
86
|
+
vocalUrl: "https://cdn/v.mp3",
|
|
87
|
+
instrumentalUrl: "https://cdn/i.mp3",
|
|
88
|
+
isolatedUrl: "https://cdn/x.mp3",
|
|
89
|
+
withoutUrl: "https://cdn/w.mp3",
|
|
90
|
+
sunoStemIds: { vocalUrl: "id-v", instrumentalUrl: "id-i", isolatedUrl: "id-x", withoutUrl: "id-w" },
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
it.each([
|
|
94
|
+
["vocals", "id-v"], ["vocal-out", "id-v"], ["instrumental", "id-i"], ["instrumental-out", "id-i"],
|
|
95
|
+
["isolated", "id-x"], ["without", "id-w"], [undefined, "id-v"],
|
|
96
|
+
])("%s → %s", (handle, audioId) => {
|
|
97
|
+
expect(sunoSeparateHandleIds(out, handle)).toStrictEqual({ taskId: "sep-task", audioId })
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("no task id, no stem ids (a Demucs or cloud run, an older output), or no id for that stem: none", () => {
|
|
101
|
+
expect(sunoSeparateHandleIds({ ...out, sunoTaskId: undefined }, "vocals")).toBeUndefined()
|
|
102
|
+
expect(sunoSeparateHandleIds({ ...out, sunoStemIds: undefined }, "vocals")).toBeUndefined()
|
|
103
|
+
expect(sunoSeparateHandleIds({ ...out, sunoStemIds: { vocalUrl: "id-v" } }, "instrumental")).toBeUndefined()
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it("the primary handle follows the primary stem", () => {
|
|
107
|
+
expect(sunoSeparateHandleField({ drumsUrl: "https://cdn/d.mp3" }, undefined)).toBe("drumsUrl")
|
|
108
|
+
expect(SUNO_SEPARATE_ID_FIELDS).toEqual(["sunoTaskId", "sunoStemIds"])
|
|
109
|
+
})
|
|
110
|
+
})
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
checkVideoToVideoClipLength,
|
|
4
|
+
isClipPricedV2vProvider,
|
|
5
|
+
V2V_CLIP_RATE_IDS,
|
|
6
|
+
videoToVideoBilledSeconds,
|
|
7
|
+
videoToVideoClipPrice,
|
|
8
|
+
videoToVideoClipRateOf,
|
|
9
|
+
videoToVideoEstimatePrice,
|
|
10
|
+
videoToVideoSentResolution,
|
|
11
|
+
wanVideoEditRateFromSeconds,
|
|
12
|
+
} from "../video-to-video-pricing.js"
|
|
13
|
+
|
|
14
|
+
/** The rows as seeded (STATIC_CREDIT_COSTS / migration 671), base credits. */
|
|
15
|
+
const ROWS: Readonly<Record<string, number>> = {
|
|
16
|
+
"wan-videoedit": 320,
|
|
17
|
+
"wan-videoedit:1080p:per-4s": 240,
|
|
18
|
+
"happyhorse-edit:720p:per-4s": 560,
|
|
19
|
+
"happyhorse-edit:1080p:per-4s": 960,
|
|
20
|
+
}
|
|
21
|
+
const rowOf = (id: string) => ROWS[id]
|
|
22
|
+
/** The base a price stands for, as every lane charges it: a rate × units rounded up once, else the flat row. */
|
|
23
|
+
const base = (p: { creditId: string; units?: number }) => (p.units === undefined ? ROWS[p.creditId]! : Math.ceil(ROWS[p.creditId]! * p.units))
|
|
24
|
+
|
|
25
|
+
const priceOf = (provider: "happyhorse-edit" | "wan-videoedit", resolution: unknown, clipSec: number, videoEditDuration?: unknown) => {
|
|
26
|
+
const check = checkVideoToVideoClipLength(provider, clipSec, videoEditDuration)
|
|
27
|
+
if (!check.ok) throw new Error(check.message)
|
|
28
|
+
return videoToVideoClipPrice(provider, resolution, check.billedSeconds, rowOf)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe("Video to Video priced by the clip's length", () => {
|
|
32
|
+
it("only HappyHorse Edit and Wan 2.7 VideoEdit are priced by their clip", () => {
|
|
33
|
+
expect(isClipPricedV2vProvider("happyhorse-edit")).toBe(true)
|
|
34
|
+
expect(isClipPricedV2vProvider("wan-videoedit")).toBe(true)
|
|
35
|
+
for (const other of ["wan", "wan-flash", "runway-aleph", "luma-modify", "seedance-2-5", undefined]) {
|
|
36
|
+
expect(isClipPricedV2vProvider(other)).toBe(false)
|
|
37
|
+
expect(videoToVideoClipRateOf(other, "720p")).toBeUndefined()
|
|
38
|
+
}
|
|
39
|
+
expect(V2V_CLIP_RATE_IDS).toEqual(["happyhorse-edit:720p:per-4s", "happyhorse-edit:1080p:per-4s", "wan-videoedit:1080p:per-4s"])
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe("HappyHorse Edit", () => {
|
|
43
|
+
it("bills every started half-second of the clip, forgiving float noise only", () => {
|
|
44
|
+
expect(videoToVideoBilledSeconds("happyhorse-edit", 3)).toBe(3)
|
|
45
|
+
expect(videoToVideoBilledSeconds("happyhorse-edit", 3.0000000001)).toBe(3)
|
|
46
|
+
expect(videoToVideoBilledSeconds("happyhorse-edit", 3.01)).toBe(3.5)
|
|
47
|
+
expect(videoToVideoBilledSeconds("happyhorse-edit", 10.04)).toBe(10.5)
|
|
48
|
+
expect(videoToVideoBilledSeconds("happyhorse-edit", 10.5)).toBe(10.5)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it("worked examples: 3.00 s at 720p = 420, 10.04 s at 720p = 1,470, 3.00 s at 1080p = 720 (base)", () => {
|
|
52
|
+
const a = priceOf("happyhorse-edit", "720p", 3)
|
|
53
|
+
expect(a).toEqual({ creditId: "happyhorse-edit:720p:per-4s", units: 0.75 })
|
|
54
|
+
expect(base(a)).toBe(420)
|
|
55
|
+
const b = priceOf("happyhorse-edit", undefined, 10.04)
|
|
56
|
+
expect(b).toEqual({ creditId: "happyhorse-edit:720p:per-4s", units: 2.625 })
|
|
57
|
+
expect(base(b)).toBe(1470)
|
|
58
|
+
const c = priceOf("happyhorse-edit", "1080p", 3)
|
|
59
|
+
expect(c).toEqual({ creditId: "happyhorse-edit:1080p:per-4s", units: 0.75 })
|
|
60
|
+
expect(base(c)).toBe(720)
|
|
61
|
+
expect(base(priceOf("happyhorse-edit", "720p", 60))).toBe(8400)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it("prices and sends 720p unless the request says 1080p", () => {
|
|
65
|
+
expect(videoToVideoSentResolution("happyhorse-edit", undefined)).toBe("720p")
|
|
66
|
+
expect(videoToVideoSentResolution("happyhorse-edit", "480p")).toBe("720p")
|
|
67
|
+
expect(videoToVideoSentResolution("happyhorse-edit", "720p")).toBe("720p")
|
|
68
|
+
expect(videoToVideoSentResolution("happyhorse-edit", "1080p")).toBe("1080p")
|
|
69
|
+
expect(videoToVideoClipRateOf("happyhorse-edit", "480p")?.rateId).toBe("happyhorse-edit:720p:per-4s")
|
|
70
|
+
// Every other model's resolution is left as sent.
|
|
71
|
+
expect(videoToVideoSentResolution("wan", "1080p")).toBe("1080p")
|
|
72
|
+
expect(videoToVideoSentResolution("wan-videoedit", undefined)).toBeUndefined()
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("refuses a clip shorter than 3 s or longer than 60 s, with no grace", () => {
|
|
76
|
+
expect(checkVideoToVideoClipLength("happyhorse-edit", 2.99)).toMatchObject({ ok: false, code: "video_too_short" })
|
|
77
|
+
expect(checkVideoToVideoClipLength("happyhorse-edit", 3)).toEqual({ ok: true, billedSeconds: 3 })
|
|
78
|
+
expect(checkVideoToVideoClipLength("happyhorse-edit", 60)).toEqual({ ok: true, billedSeconds: 60 })
|
|
79
|
+
const long = checkVideoToVideoClipLength("happyhorse-edit", 60.02)
|
|
80
|
+
expect(long).toMatchObject({ ok: false, code: "video_too_long" })
|
|
81
|
+
expect(long.ok ? "" : long.message).toMatch(/at most 60 seconds\. Trim the video first\./)
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
describe("Wan 2.7 VideoEdit", () => {
|
|
86
|
+
it("bills the clip it delivers: the clip's length, or the shorter length asked for, whole seconds after 0.05 s", () => {
|
|
87
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 6, "0")).toBe(6)
|
|
88
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 6, undefined)).toBe(6)
|
|
89
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 6.05)).toBe(6)
|
|
90
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 6.06)).toBe(7)
|
|
91
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 9, "5")).toBe(5)
|
|
92
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 3, "5")).toBe(3)
|
|
93
|
+
expect(videoToVideoBilledSeconds("wan-videoedit", 10.04, "10")).toBe(10)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it("is charged the larger of its flat row and its rate: 3 s stays 320, 5 s 320, 6 s 360, 10 s 600 (base)", () => {
|
|
97
|
+
expect(priceOf("wan-videoedit", "1080p", 3)).toEqual({ creditId: "wan-videoedit" })
|
|
98
|
+
expect(base(priceOf("wan-videoedit", "1080p", 3))).toBe(320)
|
|
99
|
+
expect(base(priceOf("wan-videoedit", "1080p", 5))).toBe(320)
|
|
100
|
+
expect(priceOf("wan-videoedit", "1080p", 6)).toEqual({ creditId: "wan-videoedit:1080p:per-4s", units: 1.5 })
|
|
101
|
+
expect(base(priceOf("wan-videoedit", "1080p", 6))).toBe(360)
|
|
102
|
+
expect(base(priceOf("wan-videoedit", undefined, 10))).toBe(600)
|
|
103
|
+
// Asked for 5 s of a 10 s clip: 5 billed seconds, the flat row.
|
|
104
|
+
expect(base(priceOf("wan-videoedit", "1080p", 10, "5"))).toBe(320)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it("never costs less than the flat row, at any length it takes", () => {
|
|
108
|
+
for (let tenths = 20; tenths <= 100; tenths++) {
|
|
109
|
+
const p = priceOf("wan-videoedit", "1080p", tenths / 10)
|
|
110
|
+
expect(base(p)).toBeGreaterThanOrEqual(320)
|
|
111
|
+
expect(base(p)).toBe(Math.max(320, Math.ceil((240 * videoToVideoBilledSeconds("wan-videoedit", tenths / 10)) / 4)))
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it("follows the live rows: a repriced row moves where the rate takes over", () => {
|
|
116
|
+
expect(wanVideoEditRateFromSeconds("1080p", rowOf)).toBe(6)
|
|
117
|
+
expect(wanVideoEditRateFromSeconds("1080p", (id) => (id === "wan-videoedit" ? 100 : ROWS[id]))).toBe(2)
|
|
118
|
+
expect(wanVideoEditRateFromSeconds("1080p", (id) => (id === "wan-videoedit" ? 10_000 : ROWS[id]))).toBeUndefined()
|
|
119
|
+
// A rate the table does not price never wins.
|
|
120
|
+
expect(videoToVideoClipPrice("wan-videoedit", "1080p", 10, (id) => (id === "wan-videoedit" ? 320 : undefined))).toEqual({ creditId: "wan-videoedit" })
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it("720p is charged at the 1080p rate for now", () => {
|
|
124
|
+
expect(videoToVideoClipRateOf("wan-videoedit", "720p")?.rateId).toBe("wan-videoedit:1080p:per-4s")
|
|
125
|
+
expect(base(priceOf("wan-videoedit", "720p", 10))).toBe(600)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it("refuses a clip shorter than 2 s or past 10 s by more than 0.05 s (a clip within it is billed at 10 s)", () => {
|
|
129
|
+
expect(checkVideoToVideoClipLength("wan-videoedit", 1.9)).toMatchObject({ ok: false, code: "video_too_short" })
|
|
130
|
+
expect(checkVideoToVideoClipLength("wan-videoedit", 2)).toEqual({ ok: true, billedSeconds: 2 })
|
|
131
|
+
expect(checkVideoToVideoClipLength("wan-videoedit", 10.05)).toEqual({ ok: true, billedSeconds: 10 })
|
|
132
|
+
expect(checkVideoToVideoClipLength("wan-videoedit", 10.06)).toMatchObject({ ok: false, code: "video_too_long" })
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
describe("estimates", () => {
|
|
137
|
+
it("quote the known length as a run bills it", () => {
|
|
138
|
+
expect(videoToVideoEstimatePrice("happyhorse-edit", "720p", undefined, 10.04, rowOf)).toEqual({ creditId: "happyhorse-edit:720p:per-4s", units: 2.625, lengthKnown: true })
|
|
139
|
+
expect(videoToVideoEstimatePrice("wan-videoedit", "1080p", "0", 4, rowOf)).toEqual({ creditId: "wan-videoedit", lengthKnown: true })
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
it("quote the longest clip the model takes when the length is not known — never below the hold", () => {
|
|
143
|
+
const hh = videoToVideoEstimatePrice("happyhorse-edit", "720p", undefined, undefined, rowOf)
|
|
144
|
+
expect(hh).toEqual({ creditId: "happyhorse-edit:720p:per-4s", units: 15, lengthKnown: false })
|
|
145
|
+
const wan = videoToVideoEstimatePrice("wan-videoedit", "1080p", "0", null, rowOf)
|
|
146
|
+
expect(wan).toEqual({ creditId: "wan-videoedit:1080p:per-4s", units: 2.5, lengthKnown: false })
|
|
147
|
+
for (let tenths = 30; tenths <= 600; tenths += 7) expect(base(hh)).toBeGreaterThanOrEqual(base(priceOf("happyhorse-edit", "720p", tenths / 10)))
|
|
148
|
+
for (let tenths = 20; tenths <= 100; tenths++) expect(base(wan)).toBeGreaterThanOrEqual(base(priceOf("wan-videoedit", "1080p", tenths / 10)))
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
})
|