功能增加
This commit is contained in:
1 parent
b340fc7ad7
commit
f1993eb388
69 files changed
+2243
-162
No files matched your search
@@ -0,0 +1,31 @@
|
||||
export const MINIMAX_H3_MODEL = "MiniMax-H3";
|
||||
|
||||
export function minimaxH3VideoPriceFenPerSecond(resolution: unknown) {
|
||||
return String(resolution || "").trim().toUpperCase() === "2K" ? 80 : 50;
|
||||
}
|
||||
|
||||
export function calculateMinimaxH3ActualAmountFen(input: {
|
||||
resolution?: unknown;
|
||||
outputSeconds: number;
|
||||
inputVideoSeconds?: number;
|
||||
inputImageCount?: number;
|
||||
markupMultiplier: number;
|
||||
}) {
|
||||
const outputSeconds = integer(input.outputSeconds);
|
||||
const inputVideoSeconds = nonNegativeInteger(input.inputVideoSeconds);
|
||||
const inputImageCount = nonNegativeInteger(input.inputImageCount);
|
||||
if (outputSeconds <= 0) throw new Error("MiniMax H3 实际输出时长必须大于 0。");
|
||||
if (!Number.isFinite(input.markupMultiplier) || input.markupMultiplier < 1) throw new Error("MiniMax H3 计费倍率不能低于 1.00。");
|
||||
const standardAmountFen = (outputSeconds + inputVideoSeconds) * minimaxH3VideoPriceFenPerSecond(input.resolution)
|
||||
+ Math.max(0, inputImageCount - 5) * 20;
|
||||
return Math.ceil(standardAmountFen * input.markupMultiplier);
|
||||
}
|
||||
|
||||
function integer(value: unknown) {
|
||||
const number = Number(value);
|
||||
return Number.isInteger(number) ? number : 0;
|
||||
}
|
||||
|
||||
function nonNegativeInteger(value: unknown) {
|
||||
return Math.max(0, integer(value));
|
||||
}
|
||||
Reference in new issue
Block a user