feeef 0.9.5 → 0.10.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/build/index.js
CHANGED
|
@@ -4305,6 +4305,13 @@ var PixelReportMode = /* @__PURE__ */ ((PixelReportMode2) => {
|
|
|
4305
4305
|
PixelReportMode2["both"] = "both";
|
|
4306
4306
|
return PixelReportMode2;
|
|
4307
4307
|
})(PixelReportMode || {});
|
|
4308
|
+
var PixelStatusDimension = /* @__PURE__ */ ((PixelStatusDimension2) => {
|
|
4309
|
+
PixelStatusDimension2["orderStatus"] = "orderStatus";
|
|
4310
|
+
PixelStatusDimension2["deliveryStatus"] = "deliveryStatus";
|
|
4311
|
+
PixelStatusDimension2["paymentStatus"] = "paymentStatus";
|
|
4312
|
+
PixelStatusDimension2["customStatus"] = "customStatus";
|
|
4313
|
+
return PixelStatusDimension2;
|
|
4314
|
+
})(PixelStatusDimension || {});
|
|
4308
4315
|
var SecurityTreatment = /* @__PURE__ */ ((SecurityTreatment2) => {
|
|
4309
4316
|
SecurityTreatment2["block"] = "block";
|
|
4310
4317
|
SecurityTreatment2["warning"] = "warning";
|
|
@@ -4670,6 +4677,18 @@ var AI_BILLING = getLegacyAiBillingFlat(FALLBACK_AI_EXCHANGE_RATE);
|
|
|
4670
4677
|
function findModel(models, modelId, fallbackId) {
|
|
4671
4678
|
return models.find((m) => m.id === modelId) || models.find((m) => m.id === fallbackId) || models[0];
|
|
4672
4679
|
}
|
|
4680
|
+
function pickCatalogTokenPricingPerM(catalog, modelId) {
|
|
4681
|
+
if (!catalog?.data?.length) return null;
|
|
4682
|
+
const row = catalog.data.find((r) => r?.id === modelId);
|
|
4683
|
+
const p = row?.pricing;
|
|
4684
|
+
const promptPerToken = Number(p?.prompt);
|
|
4685
|
+
const completionPerToken = Number(p?.completion);
|
|
4686
|
+
if (!Number.isFinite(promptPerToken) && !Number.isFinite(completionPerToken)) return null;
|
|
4687
|
+
const inTok = Number.isFinite(promptPerToken) ? promptPerToken : 0;
|
|
4688
|
+
const outTok = Number.isFinite(completionPerToken) ? completionPerToken : 0;
|
|
4689
|
+
if (inTok <= 0 && outTok <= 0) return null;
|
|
4690
|
+
return { input: inTok * 1e6, output: outTok * 1e6 };
|
|
4691
|
+
}
|
|
4673
4692
|
function modelHasVoiceCapability(model) {
|
|
4674
4693
|
const caps = model?.capabilities;
|
|
4675
4694
|
if (!Array.isArray(caps)) return false;
|
|
@@ -4742,6 +4761,7 @@ var AiCalculator = class {
|
|
|
4742
4761
|
MEDIA_RESOLUTION_HIGH: 10
|
|
4743
4762
|
},
|
|
4744
4763
|
models: config.models ?? [],
|
|
4764
|
+
modelsCatalog: config.modelsCatalog,
|
|
4745
4765
|
billing
|
|
4746
4766
|
};
|
|
4747
4767
|
}
|
|
@@ -4866,7 +4886,8 @@ var AiCalculator = class {
|
|
|
4866
4886
|
const { exchangeRate } = this.config;
|
|
4867
4887
|
const model = findModel(this.config.models, modelId, "gemini-3-flash-preview");
|
|
4868
4888
|
const tokenPricing = model?.pricing?.find((p) => p.unit === "tokens");
|
|
4869
|
-
|
|
4889
|
+
const catalogPricing = tokenPricing ? null : pickCatalogTokenPricingPerM(this.config.modelsCatalog, modelId);
|
|
4890
|
+
if (!tokenPricing && !catalogPricing || totalTokens < tg.freeTierMaxPromptTokens) {
|
|
4870
4891
|
return {
|
|
4871
4892
|
providerCostUsd: 0,
|
|
4872
4893
|
providerCostDzd: 0,
|
|
@@ -4881,8 +4902,8 @@ var AiCalculator = class {
|
|
|
4881
4902
|
}
|
|
4882
4903
|
};
|
|
4883
4904
|
}
|
|
4884
|
-
const inputPrice = tokenPricing
|
|
4885
|
-
const outputPrice = tokenPricing
|
|
4905
|
+
const inputPrice = tokenPricing?.input ?? catalogPricing?.input ?? 0;
|
|
4906
|
+
const outputPrice = tokenPricing?.output ?? catalogPricing?.output ?? 0;
|
|
4886
4907
|
const providerCostUsd = estimatedPromptTokens / 1e6 * inputPrice + estimatedOutputTokens / 1e6 * outputPrice;
|
|
4887
4908
|
const providerCostDzd = providerCostUsd * exchangeRate;
|
|
4888
4909
|
const userCostDzd = roundMoney(providerCostDzd * mult);
|
|
@@ -5079,6 +5100,7 @@ export {
|
|
|
5079
5100
|
OrderStatus,
|
|
5080
5101
|
PaymentStatus,
|
|
5081
5102
|
PixelReportMode,
|
|
5103
|
+
PixelStatusDimension,
|
|
5082
5104
|
ProcolisDeliveryIntegrationApi,
|
|
5083
5105
|
ProductRepository,
|
|
5084
5106
|
ProductStatus,
|