Scale generation billing charges to 1-to-100 credits
This commit is contained in:
@@ -19,6 +19,9 @@ const ENTERPRISE_VIDEO_ALLOWED_MODELS = new Set([
|
||||
"pixverse-c1-i2v",
|
||||
]);
|
||||
|
||||
const CREDITS_PER_CNY = 100;
|
||||
const CREDIT_UNITS_PER_CREDIT = 100;
|
||||
|
||||
function normalizeModel(value) {
|
||||
return String(value || "").trim().toLowerCase();
|
||||
}
|
||||
@@ -102,7 +105,7 @@ function getEnterpriseVideoCreditRate(input) {
|
||||
|
||||
function calculateEnterpriseVideoCredits(input) {
|
||||
const duration = normalizeEnterpriseVideoDuration(input.durationSeconds || input.duration);
|
||||
return Number((getEnterpriseVideoCreditRate(input) * duration).toFixed(2));
|
||||
return Number((getEnterpriseVideoCreditRate(input) * duration * CREDITS_PER_CNY).toFixed(2));
|
||||
}
|
||||
|
||||
function calculateEnterpriseVideoCost(input) {
|
||||
@@ -113,7 +116,7 @@ function calculateEnterpriseVideoCost(input) {
|
||||
resolution,
|
||||
durationSeconds,
|
||||
});
|
||||
const rateCentsPerSecond = Math.round(rateCreditsPerSecond * 100);
|
||||
const rateCentsPerSecond = Math.round(rateCreditsPerSecond * CREDITS_PER_CNY * CREDIT_UNITS_PER_CREDIT);
|
||||
return {
|
||||
resolution,
|
||||
durationSeconds,
|
||||
|
||||
Reference in New Issue
Block a user