@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
package/src/llm-models.ts
CHANGED
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
export type LlmTier = "economy" | "standard" | "premium"
|
|
17
17
|
export type KieApiFormat = "chat-completions" | "messages" | "responses"
|
|
18
|
+
|
|
19
|
+
/** How a document is sent to a model, per lane (see `LlmModelDef.fileWire`). */
|
|
20
|
+
export interface LlmFileWire {
|
|
21
|
+
/** The shape on the aggregator's lane: `input-file` (responses dialect) or `image-url` (chat-completions dialect). */
|
|
22
|
+
kie: "input-file" | "image-url"
|
|
23
|
+
/** The shape on the vendor's own API, for a model that has one. */
|
|
24
|
+
direct?: "inline-data"
|
|
25
|
+
}
|
|
18
26
|
export type LlmVendor = "anthropic" | "deepseek" | "google" | "moonshot" | "openai" | "xai"
|
|
19
27
|
|
|
20
28
|
export const LLM_REASONING_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"] as const
|
|
@@ -118,6 +126,30 @@ export interface LlmModelDef {
|
|
|
118
126
|
* and `kieSlugOrModel` (`gemini-3.1-pro` → `gemini-3.1-pro-preview`).
|
|
119
127
|
*/
|
|
120
128
|
directGeminiModel?: string
|
|
129
|
+
/**
|
|
130
|
+
* How a document (PDF) is sent to this model on each lane that can serve it
|
|
131
|
+
* (decided 2026-11-17). Declared by exactly the models whose modality caps
|
|
132
|
+
* say `file` ({@link llmAcceptsFiles}); a lane's builder sends a document
|
|
133
|
+
* only in the shape named here and refuses one on a model that names none,
|
|
134
|
+
* so a file is never dropped on the way.
|
|
135
|
+
*
|
|
136
|
+
* `kie`:
|
|
137
|
+
* - `"input-file"`: an inline `input_file` part on the responses dialect.
|
|
138
|
+
* - `"image-url"`: an `image_url` part on the chat-completions dialect,
|
|
139
|
+
* holding a `data:application/pdf;base64,…` URL or an https link whose
|
|
140
|
+
* path ends in `.pdf`. That dialect silently drops the `file` and
|
|
141
|
+
* `input_file` shapes (a billed answer about no file), so this is the one
|
|
142
|
+
* shape sent there.
|
|
143
|
+
*
|
|
144
|
+
* `direct`: `"inline-data"`, an `application/pdf` inline part on the vendor's
|
|
145
|
+
* own API. Set on every file model that declares a direct lane, and on no
|
|
146
|
+
* other.
|
|
147
|
+
*
|
|
148
|
+
* Never derived from the dialect: a model gets a shape only by its own
|
|
149
|
+
* probe, recorded with its date on the entry, and
|
|
150
|
+
* `llm-models.test.ts` lists every declaration by model.
|
|
151
|
+
*/
|
|
152
|
+
fileWire?: LlmFileWire
|
|
121
153
|
/**
|
|
122
154
|
* Try the direct-vendor lane FIRST for this model, with KIE as the failure
|
|
123
155
|
* fallback. Absent (while `directGeminiModel` is set) = KIE first, direct
|
|
@@ -725,6 +757,19 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
|
|
|
725
757
|
// `models/gemini-4-hydrogen` (models.list, 2026-11-16: input 1,048,576,
|
|
726
758
|
// output 65,536).
|
|
727
759
|
directGeminiModel: "gemini-4-hydrogen",
|
|
760
|
+
// Reads PDF files (decided 2026-11-17). Measured on KIE 2026-11-17: a PDF
|
|
761
|
+
// is read only as an `image_url` part (a `data:application/pdf` URL, or an
|
|
762
|
+
// https link ending in `.pdf`); the `file` and `input_file` shapes are
|
|
763
|
+
// dropped, billed. Read correctly at 1, 5, 14 and 15 pages (facts from
|
|
764
|
+
// pages 2, 8 and 11), up to 2.2 MB by link and 1.36 million characters
|
|
765
|
+
// inline; 1,280 to 2,670 prompt tokens a page. Google's own API reads an
|
|
766
|
+
// inline `application/pdf` part (probed 2026-11-17, thinking LOW): the
|
|
767
|
+
// same three documents answered correctly with almost the same counts —
|
|
768
|
+
// 5 pages 13,332 prompt tokens (KIE 13,357), 14 pages 28,048 (28,068),
|
|
769
|
+
// 15 pages and 2.2 MB 19,207 (19,220) — 520 image tokens a page plus the
|
|
770
|
+
// page's text. Not measured on either lane: a blank or scanned page, more
|
|
771
|
+
// than 15 pages, more than 2.2 MB, several files in one call.
|
|
772
|
+
fileWire: { kie: "image-url", direct: "inline-data" },
|
|
728
773
|
// KIE accepted reasoning_effort low / medium / high / xhigh (xhigh reasons
|
|
729
774
|
// clearly deeper); Google 400s thinkingLevel MINIMAL on this model ("not
|
|
730
775
|
// supported") and answers LOW / MEDIUM / HIGH / XHIGH (probed 2026-11-16).
|
|
@@ -1012,6 +1057,8 @@ export const LLM_MODELS: readonly LlmModelDef[] = [
|
|
|
1012
1057
|
// `effortPriced`. The charge follows what KIE states or reports.
|
|
1013
1058
|
kieSlugOrModel: "gpt-6-1-terra",
|
|
1014
1059
|
vendor: "openai",
|
|
1060
|
+
// A PDF goes inline as an `input_file` part (probed 2026-11-13).
|
|
1061
|
+
fileWire: { kie: "input-file" },
|
|
1015
1062
|
structuredOutputMode: "responses-json-schema",
|
|
1016
1063
|
supportsImages: true,
|
|
1017
1064
|
maxOutputTokens: 16384,
|
|
@@ -1634,9 +1681,10 @@ export function defaultReasoningEffort(feature: string, modelId?: string): LlmRe
|
|
|
1634
1681
|
* input requires a separate audio-capable model we don't route to today.
|
|
1635
1682
|
*
|
|
1636
1683
|
* `file` (decided 2026-11-13): the model reads documents (PDF) sent with the
|
|
1637
|
-
* call. Declared on
|
|
1638
|
-
* derived for any other: absent means
|
|
1639
|
-
* {@link llmAcceptsFiles}.
|
|
1684
|
+
* call. Declared on each model that does — GPT-6.1 Terra, and Gemini 4
|
|
1685
|
+
* Hydrogen from 2026-11-17 — and never derived for any other: absent means
|
|
1686
|
+
* no. Read it through {@link llmAcceptsFiles}. A model that declares it also
|
|
1687
|
+
* declares how a file is sent to it (`fileWire` on its registry entry).
|
|
1640
1688
|
*/
|
|
1641
1689
|
export const LLM_MODALITY_CAPS: Record<string, LlmModalityCaps> = {
|
|
1642
1690
|
// Keeps full caps after KIE dropped its channel (2026-11-13): it stays a
|
|
@@ -1686,7 +1734,10 @@ export const LLM_MODALITY_CAPS: Record<string, LlmModalityCaps> = {
|
|
|
1686
1734
|
// audio were not probed. Google's own API (where a media call is pinned
|
|
1687
1735
|
// when this install has a Gemini key, as Carbon's) lists video and audio
|
|
1688
1736
|
// input for it; not probed with media.
|
|
1689
|
-
|
|
1737
|
+
// It also reads documents (PDF, decided 2026-11-17; `fileWire` on its
|
|
1738
|
+
// registry entry says how each lane is sent one). The `file` cap is read only
|
|
1739
|
+
// by the LLM nodes (`llmAcceptsFiles`), so it enrols the model in nothing else.
|
|
1740
|
+
"gemini-4-hydrogen": { image: true, video: true, audio: true, file: true },
|
|
1690
1741
|
"claude-haiku-4.5": { image: true, video: false, audio: false },
|
|
1691
1742
|
"claude-haiku-5.5": { image: true, video: false, audio: false },
|
|
1692
1743
|
"claude-sonnet-4.6": { image: true, video: false, audio: false },
|
|
@@ -1769,6 +1820,11 @@ export function llmAcceptsFiles(modelId: string | undefined): boolean {
|
|
|
1769
1820
|
return Boolean(modelId && LLM_MODALITY_CAPS[modelId]?.file)
|
|
1770
1821
|
}
|
|
1771
1822
|
|
|
1823
|
+
/** How `modelId` is sent a document on each lane (`fileWire` on its registry entry); `undefined` for a model that reads none. */
|
|
1824
|
+
export function llmFileWire(modelId: string | undefined): LlmFileWire | undefined {
|
|
1825
|
+
return llmAcceptsFiles(modelId) ? LLM_MODELS.find((m) => m.id === modelId)?.fileWire : undefined
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1772
1828
|
/** The models that read documents, in registry order — what a refusal names. */
|
|
1773
1829
|
export const LLM_FILE_MODELS: readonly LlmModelDef[] = LLM_MODELS.filter((m) => llmAcceptsFiles(m.id))
|
|
1774
1830
|
|
package/src/model-catalog.ts
CHANGED
|
@@ -3195,8 +3195,8 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3195
3195
|
maker: "alibaba",
|
|
3196
3196
|
label: "Wan 2.6",
|
|
3197
3197
|
series: "Wan",
|
|
3198
|
-
description: "Wan 2.6 — text-to-video and video-to-video under a single id.",
|
|
3199
|
-
useCases: ["v2v", "t2v", "
|
|
3198
|
+
description: "Wan 2.6 — text-to-video and video-to-video under a single id. Its video-to-video makes a new clip featuring the subject of the input video, in the scene the prompt describes; it does not edit or restyle the clip.",
|
|
3199
|
+
useCases: ["v2v", "t2v", "reference"],
|
|
3200
3200
|
durations: [5],
|
|
3201
3201
|
defaultDuration: 5,
|
|
3202
3202
|
resolutions: ["720p", "1080p"],
|
|
@@ -3213,7 +3213,7 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3213
3213
|
maker: "alibaba",
|
|
3214
3214
|
label: "Wan Flash V2V",
|
|
3215
3215
|
series: "Wan",
|
|
3216
|
-
description: "Faster Wan
|
|
3216
|
+
description: "Faster Wan 2.6 video-to-video: a new clip featuring the subject of the input video, in the scene the prompt describes (not an edit or restyle of the clip); optional audio and multi-shot.",
|
|
3217
3217
|
useCases: ["v2v", "fast"],
|
|
3218
3218
|
pricing: [{ identifier: "wan-flash", credits: 100 }],
|
|
3219
3219
|
},
|
|
@@ -3225,10 +3225,13 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3225
3225
|
maker: "alibaba",
|
|
3226
3226
|
label: "Wan 2.7 VideoEdit",
|
|
3227
3227
|
series: "Wan",
|
|
3228
|
-
description: "Guided video editing with optional reference image, audio control, and prompt expansion.",
|
|
3228
|
+
description: "Guided video editing of a 2-10s clip with optional reference image, audio control, and prompt expansion; priced per second of the clip it delivers, never below the listed price.",
|
|
3229
3229
|
useCases: ["v2v", "restyle", "reference"],
|
|
3230
3230
|
resolutions: ["720p", "1080p"],
|
|
3231
|
-
pricing: [
|
|
3231
|
+
pricing: [
|
|
3232
|
+
{ identifier: "wan-videoedit", credits: 320, note: "the least a run costs" },
|
|
3233
|
+
{ identifier: "wan-videoedit:1080p:per-4s", credits: 240, note: "per 4 seconds of the clip it delivers (720p at this row too); charged per whole second, never below the flat row" },
|
|
3234
|
+
],
|
|
3232
3235
|
},
|
|
3233
3236
|
// ── Wan 2.7 ──
|
|
3234
3237
|
"wan-2.7": {
|
|
@@ -3446,11 +3449,13 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3446
3449
|
maker: "alibaba",
|
|
3447
3450
|
label: "HappyHorse Edit",
|
|
3448
3451
|
series: "HappyHorse",
|
|
3449
|
-
description: "HappyHorse video-edit — video-to-video transformation
|
|
3452
|
+
description: "HappyHorse video-edit — video-to-video transformation of a 3-60s clip, 720p/1080p output; priced per started half-second of the clip, above the listed flat price.",
|
|
3450
3453
|
useCases: ["v2v", "restyle"],
|
|
3451
3454
|
resolutions: ["720p", "1080p"],
|
|
3452
3455
|
pricing: [
|
|
3453
|
-
{ identifier: "happyhorse-edit", credits: 350, note: "
|
|
3456
|
+
{ identifier: "happyhorse-edit", credits: 350, note: "flat row of runs priced before per-clip-second pricing" },
|
|
3457
|
+
{ identifier: "happyhorse-edit:720p:per-4s", credits: 560, note: "720p (default): per 4 seconds of the clip; charged per started half-second" },
|
|
3458
|
+
{ identifier: "happyhorse-edit:1080p:per-4s", credits: 960, note: "1080p: per 4 seconds of the clip; charged per started half-second" },
|
|
3454
3459
|
],
|
|
3455
3460
|
},
|
|
3456
3461
|
// ── Vidu (ShengShu Technology) ──
|
|
@@ -3953,6 +3958,8 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3953
3958
|
{ identifier: "motion-transfer:15s", credits: 230 },
|
|
3954
3959
|
{ identifier: "motion-transfer:30s", credits: 450 },
|
|
3955
3960
|
{ identifier: "motion-transfer:1080p:10s", credits: 230 },
|
|
3961
|
+
{ identifier: "motion-transfer:720p:per-4s", credits: 126, note: "720p: per 4 seconds of the driving video; charged per whole second" },
|
|
3962
|
+
{ identifier: "motion-transfer:1080p:per-4s", credits: 203, note: "1080p: per 4 seconds of the driving video; charged per whole second" },
|
|
3956
3963
|
],
|
|
3957
3964
|
},
|
|
3958
3965
|
"kling-3.0-motion": {
|
|
@@ -3972,16 +3979,20 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3972
3979
|
{ identifier: "kling-3.0-motion:5s", credits: 150 },
|
|
3973
3980
|
{ identifier: "kling-3.0-motion:10s", credits: 300 },
|
|
3974
3981
|
{ identifier: "kling-3.0-motion:1080p:10s", credits: 500 },
|
|
3982
|
+
{ identifier: "kling-3.0-motion:720p:per-4s", credits: 228, note: "720p: per 4 seconds of the driving video; charged per whole second" },
|
|
3983
|
+
{ identifier: "kling-3.0-motion:1080p:per-4s", credits: 302, note: "1080p: per 4 seconds of the driving video; charged per whole second" },
|
|
3975
3984
|
],
|
|
3976
3985
|
},
|
|
3977
3986
|
// Wan Animate (decided 2026-11-12): catalog entries so a deployment's model
|
|
3978
3987
|
// restriction can name them. Before, `models.allow` could not withhold them
|
|
3979
3988
|
// while the Motion Transfer node and /v1/motion-transfer kept running them
|
|
3980
|
-
// beside the Kling models.
|
|
3981
|
-
//
|
|
3982
|
-
//
|
|
3983
|
-
// size `normalizeModelInput` moves it to
|
|
3984
|
-
// the size a request naming none has always
|
|
3989
|
+
// beside the Kling models. Replace runs at three sizes; Move at 720p only (the
|
|
3990
|
+
// one size the provider takes for it). A size a model does not have (Move's
|
|
3991
|
+
// 480p / 580p, the route's 1080p) runs, and is charged, as 720p —
|
|
3992
|
+
// `defaultResolution`, the size `normalizeModelInput` moves it to
|
|
3993
|
+
// (`motionTransferResolution`), and the size a request naming none has always
|
|
3994
|
+
// run at. Each is charged per second of the driving video at its `:per-4s`
|
|
3995
|
+
// row, never below its flat row for the size it runs at.
|
|
3985
3996
|
"wan-animate-move": {
|
|
3986
3997
|
id: "wan-animate-move",
|
|
3987
3998
|
kind: "video",
|
|
@@ -3992,12 +4003,14 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
3992
4003
|
series: "Wan",
|
|
3993
4004
|
description: "Wan 2.2 Animate: moves the subject of a still image with the motion of a driving video.",
|
|
3994
4005
|
useCases: ["motion-transfer", "cheap"],
|
|
3995
|
-
resolutions: ["
|
|
4006
|
+
resolutions: ["720p"],
|
|
3996
4007
|
defaultResolution: "720p",
|
|
3997
4008
|
pricing: [
|
|
3998
|
-
|
|
3999
|
-
{ identifier: "wan-animate-move:
|
|
4000
|
-
{ identifier: "wan-animate-move
|
|
4009
|
+
// 720p first: the size Move runs at, so its default variant's price.
|
|
4010
|
+
{ identifier: "wan-animate-move:720p", credits: 410, note: "720p, the only size it runs at" },
|
|
4011
|
+
{ identifier: "wan-animate-move", credits: 255, note: "480p (runs, and is charged, as 720p)" },
|
|
4012
|
+
{ identifier: "wan-animate-move:580p", credits: 330, note: "580p (runs, and is charged, as 720p)" },
|
|
4013
|
+
{ identifier: "wan-animate-move:720p:per-4s", credits: 125, note: "per 4 seconds of the driving video, never below the 720p row; charged per whole second" },
|
|
4001
4014
|
],
|
|
4002
4015
|
},
|
|
4003
4016
|
"wan-animate-replace": {
|
|
@@ -4016,6 +4029,9 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
4016
4029
|
{ identifier: "wan-animate-replace", credits: 255, note: "480p" },
|
|
4017
4030
|
{ identifier: "wan-animate-replace:580p", credits: 330, note: "580p" },
|
|
4018
4031
|
{ identifier: "wan-animate-replace:720p", credits: 410, note: "720p" },
|
|
4032
|
+
{ identifier: "wan-animate-replace:480p:per-4s", credits: 60, note: "480p: per 4 seconds of the driving video, never below the 480p row; charged per whole second" },
|
|
4033
|
+
{ identifier: "wan-animate-replace:580p:per-4s", credits: 95, note: "580p: per 4 seconds of the driving video, never below the 580p row; charged per whole second" },
|
|
4034
|
+
{ identifier: "wan-animate-replace:720p:per-4s", credits: 125, note: "720p: per 4 seconds of the driving video, never below the 720p row; charged per whole second" },
|
|
4019
4035
|
],
|
|
4020
4036
|
},
|
|
4021
4037
|
|
|
@@ -4154,9 +4170,10 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
4154
4170
|
},
|
|
4155
4171
|
// LatentSync, HeyGen Lipsync Precision and Lipsync 2 Pro run on Replicate
|
|
4156
4172
|
// (providers/replicate/lip-sync.ts). Listed so a deployment's model
|
|
4157
|
-
// restriction can name them (decided 2026-11-12)
|
|
4158
|
-
//
|
|
4159
|
-
//
|
|
4173
|
+
// restriction can name them (decided 2026-11-12). They take no size: the
|
|
4174
|
+
// result keeps the size of the video they are given. LatentSync holds the
|
|
4175
|
+
// bucket of its audio's length and is charged what the run used
|
|
4176
|
+
// (`isLipSyncChargedAtRunCost`, decided 2026-11-18).
|
|
4160
4177
|
"latentsync": {
|
|
4161
4178
|
id: "latentsync",
|
|
4162
4179
|
kind: "video",
|
|
@@ -4165,9 +4182,15 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
4165
4182
|
maker: "bytedance",
|
|
4166
4183
|
label: "LatentSync",
|
|
4167
4184
|
series: "LatentSync",
|
|
4168
|
-
description: "Diffusion lip sync on an existing video — strong on singing and expressive vocals. Video input.",
|
|
4185
|
+
description: "Diffusion lip sync on an existing video — strong on singing and expressive vocals. Video input, charged by what the run uses.",
|
|
4169
4186
|
useCases: ["lip-sync", "dubbing", "video-to-video"],
|
|
4170
|
-
pricing: [
|
|
4187
|
+
pricing: [
|
|
4188
|
+
{ identifier: "latentsync:15s", credits: 100, note: "hold — the run is charged what it used" },
|
|
4189
|
+
{ identifier: "latentsync:30s", credits: 160, note: "hold" },
|
|
4190
|
+
{ identifier: "latentsync:60s", credits: 280, note: "hold" },
|
|
4191
|
+
{ identifier: "latentsync:120s", credits: 520, note: "hold" },
|
|
4192
|
+
{ identifier: "latentsync:300s", credits: 1240, note: "hold, 5-min ceiling" },
|
|
4193
|
+
],
|
|
4171
4194
|
},
|
|
4172
4195
|
"heygen-lipsync-precision": {
|
|
4173
4196
|
id: "heygen-lipsync-precision",
|
|
@@ -4927,9 +4950,9 @@ const AUDIO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
4927
4950
|
maker: "elevenlabs",
|
|
4928
4951
|
label: "ElevenLabs Voice Isolation",
|
|
4929
4952
|
series: "ElevenLabs",
|
|
4930
|
-
description: "Strip background noise / music from a vocal track.",
|
|
4953
|
+
description: "Strip background noise / music from a vocal track. Audio up to 30 minutes; priced per started 10 seconds of the audio.",
|
|
4931
4954
|
useCases: ["cleanup", "isolation"],
|
|
4932
|
-
pricing: [{ identifier: "elevenlabs-isolation", credits:
|
|
4955
|
+
pricing: [{ identifier: "elevenlabs-isolation:per-10s", credits: 10, note: "per started 10 seconds of the audio, up to 30 minutes" }],
|
|
4933
4956
|
},
|
|
4934
4957
|
"elevenlabs-dubbing": {
|
|
4935
4958
|
id: "elevenlabs-dubbing",
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a Motion Transfer run is priced (decided 2026-11-18): from the length of
|
|
3
|
+
* its DRIVING video as the server reads it, never a length the caller
|
|
4
|
+
* declares.
|
|
5
|
+
*
|
|
6
|
+
* - Every model is refused below {@link MOTION_TRANSFER_MIN_SEC} and past its
|
|
7
|
+
* limit ({@link motionTransferMaxSec}: Kling 2.6 and Kling 3.0 take 10
|
|
8
|
+
* seconds while the character keeps the image's orientation — the default —
|
|
9
|
+
* and 30 while it follows the video's; Wan Animate takes 30). A clip up to
|
|
10
|
+
* `CLIP_PRICE_GRACE_SEC` past a limit is accepted and priced at it.
|
|
11
|
+
* - Every model and size is charged per second of that video
|
|
12
|
+
* ({@link MOTION_TRANSFER_SECOND_RATES}): its rate row × the billed seconds
|
|
13
|
+
* ÷ the seconds the row prices, rounded up once, marked up once — the hold
|
|
14
|
+
* IS the charge.
|
|
15
|
+
* - Wan Animate keeps its flat price by size as a FLOOR: a run is charged the
|
|
16
|
+
* larger of its rate's figure and its floor row, compared as base credits
|
|
17
|
+
* ({@link motionTransferChargedPrice}), and the run is
|
|
18
|
+
* charged at the row that won — the floor row once, or the rate row × its
|
|
19
|
+
* units — so the usage log, the whole-run quote id (`<rate>:<N>u`) and the
|
|
20
|
+
* flat row's own price each name exactly what was charged.
|
|
21
|
+
*
|
|
22
|
+
* Billed seconds are the length rounded up to a whole second after the house
|
|
23
|
+
* grace ({@link motionTransferBilledSeconds}). The route, the workflow run,
|
|
24
|
+
* the MCP verb (which calls the route) and both estimates read this one
|
|
25
|
+
* module. The old length-tier rows (`buildMotionCreditModelIdentifier`) are no
|
|
26
|
+
* run's price any more; they stay for older code and saved quotes.
|
|
27
|
+
*/
|
|
28
|
+
import { motionTransferResolution } from "./credit-identifiers.js"
|
|
29
|
+
import { CLIP_PRICE_GRACE_SEC, gracedMeasuredSec } from "./priced-clip-seconds.js"
|
|
30
|
+
|
|
31
|
+
/** Float noise: a length that is arithmetic can land a hair past a limit, and must not be refused for it. */
|
|
32
|
+
const FLOAT_NOISE_SEC = 1e-9
|
|
33
|
+
|
|
34
|
+
/** The shortest driving video any Motion Transfer model takes. */
|
|
35
|
+
export const MOTION_TRANSFER_MIN_SEC = 3
|
|
36
|
+
|
|
37
|
+
/** The longest driving video Kling 2.6 / Kling 3.0 take while the character keeps the image's orientation. */
|
|
38
|
+
export const MOTION_TRANSFER_IMAGE_ORIENTATION_MAX_SEC = 10
|
|
39
|
+
|
|
40
|
+
/** The longest driving video any Motion Transfer model takes (Kling following the video's orientation, Wan Animate). */
|
|
41
|
+
export const MOTION_TRANSFER_MAX_SEC = 30
|
|
42
|
+
|
|
43
|
+
/** The orientation a run uses: `"video"` only when it says so; anything else (absent included) is the default, `"image"`. */
|
|
44
|
+
export function motionTransferOrientation(characterOrientation: unknown): "image" | "video" {
|
|
45
|
+
return characterOrientation === "video" ? "video" : "image"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const isWanAnimate = (provider: string): boolean => provider === "wan-animate-move" || provider === "wan-animate-replace"
|
|
49
|
+
|
|
50
|
+
/** The longest driving video a run of `provider` at `characterOrientation` takes. */
|
|
51
|
+
export function motionTransferMaxSec(provider: string, characterOrientation: unknown): number {
|
|
52
|
+
if (isWanAnimate(provider)) return MOTION_TRANSFER_MAX_SEC
|
|
53
|
+
return motionTransferOrientation(characterOrientation) === "video" ? MOTION_TRANSFER_MAX_SEC : MOTION_TRANSFER_IMAGE_ORIENTATION_MAX_SEC
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A per-second rate: the row that prices `rateSeconds` seconds of driving video, and the floor a run of it never goes below. */
|
|
57
|
+
export interface MotionTransferSecondRate {
|
|
58
|
+
readonly rateId: string
|
|
59
|
+
readonly rateSeconds: number
|
|
60
|
+
/**
|
|
61
|
+
* The row a run of this model and size is never charged below (Wan Animate:
|
|
62
|
+
* its flat price for the size the request names); absent when the rate
|
|
63
|
+
* alone prices the run (Kling).
|
|
64
|
+
*/
|
|
65
|
+
readonly floorId?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Every rate row prices four seconds, so its value stays a whole credit and dividing by 4 is exact in floating point. */
|
|
69
|
+
const PER_4S = 4
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The rate of every model and size, keyed `<provider>:<charged size>`.
|
|
73
|
+
* Wan Animate Move runs at 720p only (its catalog entry lists that one size,
|
|
74
|
+
* so `motionTransferResolution` sends and charges any size it names as 720p).
|
|
75
|
+
*/
|
|
76
|
+
export const MOTION_TRANSFER_SECOND_RATES: Readonly<Record<string, MotionTransferSecondRate>> = {
|
|
77
|
+
"kling:720p": { rateId: "motion-transfer:720p:per-4s", rateSeconds: PER_4S },
|
|
78
|
+
"kling:1080p": { rateId: "motion-transfer:1080p:per-4s", rateSeconds: PER_4S },
|
|
79
|
+
"kling-3.0:720p": { rateId: "kling-3.0-motion:720p:per-4s", rateSeconds: PER_4S },
|
|
80
|
+
"kling-3.0:1080p": { rateId: "kling-3.0-motion:1080p:per-4s", rateSeconds: PER_4S },
|
|
81
|
+
"wan-animate-replace:480p": { rateId: "wan-animate-replace:480p:per-4s", rateSeconds: PER_4S, floorId: "wan-animate-replace" },
|
|
82
|
+
"wan-animate-replace:580p": { rateId: "wan-animate-replace:580p:per-4s", rateSeconds: PER_4S, floorId: "wan-animate-replace:580p" },
|
|
83
|
+
"wan-animate-replace:720p": { rateId: "wan-animate-replace:720p:per-4s", rateSeconds: PER_4S, floorId: "wan-animate-replace:720p" },
|
|
84
|
+
"wan-animate-move:720p": { rateId: "wan-animate-move:720p:per-4s", rateSeconds: PER_4S, floorId: "wan-animate-move:720p" },
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Every per-second rate row, once each. */
|
|
88
|
+
export const MOTION_TRANSFER_RATE_IDS: readonly string[] = [...new Set(Object.values(MOTION_TRANSFER_SECOND_RATES).map((r) => r.rateId))]
|
|
89
|
+
|
|
90
|
+
/** Every floor row a per-second rate names, once each. */
|
|
91
|
+
export const MOTION_TRANSFER_FLOOR_IDS: readonly string[] = [
|
|
92
|
+
...new Set(Object.values(MOTION_TRANSFER_SECOND_RATES).flatMap((r) => (r.floorId === undefined ? [] : [r.floorId]))),
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
/** The model a run of `provider` runs: a model Motion Transfer has, else its default (Kling 2.6), as the route and the workflow run resolve it. */
|
|
96
|
+
function runProvider(provider: unknown): string {
|
|
97
|
+
return typeof provider === "string" && Object.keys(MOTION_TRANSFER_SECOND_RATES).some((k) => k.startsWith(`${provider}:`)) ? provider : "kling"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The size a run is CHARGED at: the size it runs at (`motionTransferResolution`),
|
|
102
|
+
* and for Kling any size but 1080p is charged as 720p (its rows have no other).
|
|
103
|
+
*/
|
|
104
|
+
function chargedSize(provider: string, resolution: unknown): string {
|
|
105
|
+
const sized = motionTransferResolution(provider, typeof resolution === "string" && resolution !== "" ? resolution : "720p").resolution
|
|
106
|
+
if (isWanAnimate(provider)) return sized
|
|
107
|
+
return sized === "1080p" ? "1080p" : "720p"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The per-second rate a run of `provider` at `resolution` is charged at; a model Motion Transfer does not have is priced as its default (Kling 2.6). */
|
|
111
|
+
export function motionTransferRateOf(provider: unknown, resolution: unknown): MotionTransferSecondRate {
|
|
112
|
+
const model = runProvider(provider)
|
|
113
|
+
const key = `${model}:${chargedSize(model, resolution)}`
|
|
114
|
+
// Every size `motionTransferResolution` answers has an entry (motion-transfer-pricing.test.ts); a size it does not is priced at the model's 720p.
|
|
115
|
+
return MOTION_TRANSFER_SECOND_RATES[key] ?? MOTION_TRANSFER_SECOND_RATES[`${model}:720p`]!
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The whole seconds a driving video read at `measuredSec` is billed for:
|
|
120
|
+
* rounded up after forgiving `CLIP_PRICE_GRACE_SEC` past a whole second, at
|
|
121
|
+
* least one. THE one rounding every lane reads.
|
|
122
|
+
*/
|
|
123
|
+
export function motionTransferBilledSeconds(measuredSec: number): number {
|
|
124
|
+
return Math.max(1, Math.ceil(gracedMeasuredSec(measuredSec)))
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** A Motion Transfer run's price: the row it is charged at and, for a rate row, the units of it. */
|
|
128
|
+
export interface MotionTransferPrice {
|
|
129
|
+
/** The row the run reserves: a per-second rate row, or (once {@link motionTransferChargedPrice} chose it) a floor row. */
|
|
130
|
+
readonly creditId: string
|
|
131
|
+
/** Units of the rate row the run is charged (billed seconds ÷ the rate's seconds); undefined for a floor row, charged once. */
|
|
132
|
+
readonly units?: number
|
|
133
|
+
/** The floor row the rate is compared with (Wan Animate) before the run is charged; undefined once chosen, and for Kling. */
|
|
134
|
+
readonly floorId?: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The rate price of a run of `provider` at `resolution` whose driving video is
|
|
139
|
+
* billed for `billedSeconds` whole seconds: the rate row and its units, and
|
|
140
|
+
* the floor row it is compared with ({@link motionTransferChargedPrice}).
|
|
141
|
+
*/
|
|
142
|
+
export function motionTransferPrice(provider: string, resolution: unknown, billedSeconds: number): MotionTransferPrice {
|
|
143
|
+
const rate = motionTransferRateOf(provider, resolution)
|
|
144
|
+
return { creditId: rate.rateId, units: billedSeconds / rate.rateSeconds, ...(rate.floorId !== undefined ? { floorId: rate.floorId } : {}) }
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The row a run is CHARGED at — THE floor rule every lane reads: a price with
|
|
149
|
+
* no floor is its rate; one with a floor is charged its floor row when the
|
|
150
|
+
* floor's figure is at least the rate's figure for the run (a tie goes to the
|
|
151
|
+
* floor: the same credits, at today's row), else its rate row × the units.
|
|
152
|
+
* `perSecond` and `floor` must be figures of the same kind — both base credits
|
|
153
|
+
* (the server: the rate row × the units rounded up once, and the floor row)
|
|
154
|
+
* or both charged credits (the editor, from the server's quotes). A figure
|
|
155
|
+
* that is not known leaves the rate (whose own lookup refuses an unpriced
|
|
156
|
+
* row).
|
|
157
|
+
*/
|
|
158
|
+
export function motionTransferChargedPrice(
|
|
159
|
+
price: MotionTransferPrice,
|
|
160
|
+
figures: { readonly perSecond: number | undefined; readonly floor: number | undefined },
|
|
161
|
+
): MotionTransferPrice {
|
|
162
|
+
const rate: MotionTransferPrice = { creditId: price.creditId, ...(price.units !== undefined ? { units: price.units } : {}) }
|
|
163
|
+
if (price.floorId === undefined || figures.perSecond === undefined || figures.floor === undefined) return rate
|
|
164
|
+
return figures.floor >= figures.perSecond ? { creditId: price.floorId } : rate
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* {@link motionTransferChargedPrice} from base rows (`baseOf`: a row's base
|
|
169
|
+
* credits, undefined when it is priced nowhere), with the base credits the
|
|
170
|
+
* run is charged, as base credits: the rate row × the units rounded up once,
|
|
171
|
+
* or the floor row.
|
|
172
|
+
*/
|
|
173
|
+
export function motionTransferBaseCharge(
|
|
174
|
+
price: MotionTransferPrice,
|
|
175
|
+
baseOf: (creditId: string) => number | undefined,
|
|
176
|
+
): MotionTransferPrice & { readonly baseCredits: number | undefined } {
|
|
177
|
+
const rateBase = baseOf(price.creditId)
|
|
178
|
+
const perSecond = rateBase === undefined ? undefined : Math.ceil(rateBase * (price.units ?? 1))
|
|
179
|
+
const floor = price.floorId === undefined ? undefined : baseOf(price.floorId)
|
|
180
|
+
const charged = motionTransferChargedPrice(price, { perSecond, floor })
|
|
181
|
+
return { ...charged, baseCredits: charged.units === undefined ? floor : perSecond }
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** What the length check answers for a measured driving video. */
|
|
185
|
+
export type MotionTransferLengthCheck =
|
|
186
|
+
| { readonly ok: true; readonly billedSeconds: number }
|
|
187
|
+
| { readonly ok: false; readonly code: "video_too_short" | "video_too_long"; readonly message: string }
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Whether a driving video measured at `measuredSec` can run on `provider` at
|
|
191
|
+
* `characterOrientation`, and the seconds it is billed for. Shorter than
|
|
192
|
+
* {@link MOTION_TRANSFER_MIN_SEC} is refused; past the limit by more than
|
|
193
|
+
* `CLIP_PRICE_GRACE_SEC` is refused; a clip within that grace is billed at the
|
|
194
|
+
* limit.
|
|
195
|
+
*/
|
|
196
|
+
export function checkMotionTransferLength(provider: string, characterOrientation: unknown, measuredSec: number): MotionTransferLengthCheck {
|
|
197
|
+
if (measuredSec < MOTION_TRANSFER_MIN_SEC) {
|
|
198
|
+
return {
|
|
199
|
+
ok: false,
|
|
200
|
+
code: "video_too_short",
|
|
201
|
+
message: `The motion video is ${measuredSec.toFixed(1)} seconds. Motion Transfer needs a motion video of at least ${MOTION_TRANSFER_MIN_SEC} seconds.`,
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const max = motionTransferMaxSec(provider, characterOrientation)
|
|
205
|
+
if (measuredSec > max + CLIP_PRICE_GRACE_SEC + FLOAT_NOISE_SEC) {
|
|
206
|
+
const followVideo = !isWanAnimate(provider) && motionTransferOrientation(characterOrientation) === "image"
|
|
207
|
+
? ` (or ${MOTION_TRANSFER_MAX_SEC} seconds with the character following the video's orientation)`
|
|
208
|
+
: ""
|
|
209
|
+
return {
|
|
210
|
+
ok: false,
|
|
211
|
+
code: "video_too_long",
|
|
212
|
+
message: `The motion video is ${measuredSec.toFixed(1)} seconds. This model takes at most ${max} seconds${followVideo}. Trim the video first.`,
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return { ok: true, billedSeconds: Math.min(max, motionTransferBilledSeconds(measuredSec)) }
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The billed seconds an ESTIMATE quotes before the video is measured: the
|
|
220
|
+
* length the graph gives, at most the limit, billed as a run bills it; a
|
|
221
|
+
* length it does not know quotes the limit — the most the run can be charged
|
|
222
|
+
* (decided 2026-11-18), marked as an estimate by the caller.
|
|
223
|
+
*/
|
|
224
|
+
export function motionTransferEstimateSeconds(provider: string, characterOrientation: unknown, knownSec?: number | null): number {
|
|
225
|
+
const max = motionTransferMaxSec(provider, characterOrientation)
|
|
226
|
+
if (knownSec == null || !Number.isFinite(knownSec) || knownSec <= 0) return max
|
|
227
|
+
return Math.min(max, motionTransferBilledSeconds(Math.max(MOTION_TRANSFER_MIN_SEC, knownSec)))
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** The price an estimate quotes ({@link motionTransferEstimateSeconds}), and whether it stood in for an unknown length. */
|
|
231
|
+
export function motionTransferEstimatePrice(
|
|
232
|
+
provider: string,
|
|
233
|
+
resolution: unknown,
|
|
234
|
+
characterOrientation: unknown,
|
|
235
|
+
knownSec?: number | null,
|
|
236
|
+
): MotionTransferPrice & { readonly lengthKnown: boolean } {
|
|
237
|
+
const lengthKnown = knownSec != null && Number.isFinite(knownSec) && knownSec > 0
|
|
238
|
+
return { ...motionTransferPrice(provider, resolution, motionTransferEstimateSeconds(provider, characterOrientation, knownSec)), lengthKnown }
|
|
239
|
+
}
|
package/src/node-runtime-keys.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SUNO_SEPARATE_META_FIELDS, SUNO_SEPARATE_RESULT_FIELDS } from "./suno-separate.js"
|
|
1
|
+
import { SUNO_SEPARATE_ID_FIELDS, SUNO_SEPARATE_META_FIELDS, SUNO_SEPARATE_RESULT_FIELDS } from "./suno-separate.js"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Field names on a node's `data` that hold runtime / result / transient execution
|
|
@@ -203,7 +203,7 @@ export const NODE_TYPE_EXECUTION_DATA_KEYS: Readonly<Record<string, readonly str
|
|
|
203
203
|
"ugc-clips": ["ugcOutputs", "quote"],
|
|
204
204
|
"ugc-clip": ["ugcOutputs", "clipWarnings", "durationSec", "rerenderPending"],
|
|
205
205
|
"ugc-cards": ["ugcOutputs"],
|
|
206
|
-
"suno-separate": [...SUNO_SEPARATE_RESULT_FIELDS, ...SUNO_SEPARATE_META_FIELDS.filter((key) => key !== "stemName")],
|
|
206
|
+
"suno-separate": [...SUNO_SEPARATE_RESULT_FIELDS, ...SUNO_SEPARATE_META_FIELDS.filter((key) => key !== "stemName"), ...SUNO_SEPARATE_ID_FIELDS],
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/** Is `key` execution data (run state or a run's result) on a node of `type`: global, or that type's own? */
|
package/src/producer-types.ts
CHANGED
|
@@ -71,6 +71,8 @@ export const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet("VIDEO_P
|
|
|
71
71
|
"video-sfx",
|
|
72
72
|
"suno-music-video",
|
|
73
73
|
"merge-video-audio",
|
|
74
|
+
// Replace Audio (Nodaro Cloud plugin): the video with its sound replaced → video.
|
|
75
|
+
"replace-audio",
|
|
74
76
|
"add-captions",
|
|
75
77
|
"resize-video",
|
|
76
78
|
"social-media-format",
|
package/src/suno-separate.ts
CHANGED
|
@@ -159,6 +159,57 @@ export type SunoSeparateResultField = (typeof SUNO_SEPARATE_RESULT_FIELDS)[numbe
|
|
|
159
159
|
/** Non-URL fields a run's output records about how it ran. */
|
|
160
160
|
export const SUNO_SEPARATE_META_FIELDS = ["separateType", "stemName", "engineUsed", "sunoRefused", "fallbackReason"] as const
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* The Suno ids a run's output carries for its stems: `sunoTaskId`, the
|
|
164
|
+
* separation task, and `sunoStemIds`, each stem's or take's own id by its
|
|
165
|
+
* result field (`{ vocalUrl: "<id>", … }`). Suno Convert to WAV takes a stem
|
|
166
|
+
* by the separation's task id and the stem's id. A run that Demucs or the
|
|
167
|
+
* connected cloud delivered has none, and neither has an output written before
|
|
168
|
+
* the ids were kept.
|
|
169
|
+
*/
|
|
170
|
+
export const SUNO_SEPARATE_ID_FIELDS = ["sunoTaskId", "sunoStemIds"] as const
|
|
171
|
+
|
|
172
|
+
/** The result field behind a handle (old spellings included); the primary field for any other handle, or none. */
|
|
173
|
+
export function sunoSeparateHandleField(
|
|
174
|
+
output: Readonly<Record<string, unknown>>,
|
|
175
|
+
handle: string | null | undefined,
|
|
176
|
+
): SunoSeparateResultField | undefined {
|
|
177
|
+
switch (handle) {
|
|
178
|
+
case "vocals":
|
|
179
|
+
case "vocal":
|
|
180
|
+
case "vocal-out":
|
|
181
|
+
return "vocalUrl"
|
|
182
|
+
case "instrumental":
|
|
183
|
+
case "instrumental-out":
|
|
184
|
+
return "instrumentalUrl"
|
|
185
|
+
case "isolated":
|
|
186
|
+
return "isolatedUrl"
|
|
187
|
+
case "without":
|
|
188
|
+
return "withoutUrl"
|
|
189
|
+
default: {
|
|
190
|
+
const primary = sunoSeparatePrimaryUrl(output)
|
|
191
|
+
return primary === undefined ? undefined : SUNO_SEPARATE_RESULT_FIELDS.find((field) => str(output[field]) === primary)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The Suno ids of the stem behind one handle — the separation's task id and
|
|
198
|
+
* that stem's own id — or undefined when the output does not carry both (a
|
|
199
|
+
* Demucs or cloud run, an older output, a stem that did not come back).
|
|
200
|
+
*/
|
|
201
|
+
export function sunoSeparateHandleIds(
|
|
202
|
+
output: Readonly<Record<string, unknown>>,
|
|
203
|
+
handle: string | null | undefined,
|
|
204
|
+
): { readonly taskId: string; readonly audioId: string } | undefined {
|
|
205
|
+
const taskId = str(output.sunoTaskId)
|
|
206
|
+
const ids = output.sunoStemIds
|
|
207
|
+
if (!taskId || typeof ids !== "object" || ids === null || Array.isArray(ids)) return undefined
|
|
208
|
+
const field = sunoSeparateHandleField(output, handle)
|
|
209
|
+
const audioId = field ? str((ids as Record<string, unknown>)[field]) : undefined
|
|
210
|
+
return audioId ? { taskId, audioId } : undefined
|
|
211
|
+
}
|
|
212
|
+
|
|
162
213
|
function str(v: unknown): string | undefined {
|
|
163
214
|
return typeof v === "string" && v !== "" ? v : undefined
|
|
164
215
|
}
|