opencode-pollinations-plugin 5.2.3 → 5.2.4
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/server/proxy.js +14 -6
- package/package.json +1 -1
package/dist/server/proxy.js
CHANGED
|
@@ -249,12 +249,20 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
249
249
|
isFallbackActive = true;
|
|
250
250
|
fallbackReason = "Quota Unreachable (Safety)";
|
|
251
251
|
}
|
|
252
|
-
else
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
252
|
+
else {
|
|
253
|
+
const tierRatio = quota.tierLimit > 0 ? (quota.tierRemaining / quota.tierLimit) : 0;
|
|
254
|
+
// Logic: Fallback if Wallet is Low (< Threshold) AND Tier is Exhausted (< Threshold %)
|
|
255
|
+
// Wait, user wants priority to Free Tier.
|
|
256
|
+
// If Free Tier is available (Ratio > Threshold), we usage it (don't fallback).
|
|
257
|
+
// If Free Tier is exhausted (Ratio <= Threshold), THEN check Wallet.
|
|
258
|
+
// If Wallet also Low, THEN Fallback.
|
|
259
|
+
if (quota.walletBalance < config.thresholds.wallet && tierRatio <= (config.thresholds.tier / 100)) {
|
|
260
|
+
log(`[SafetyNet] Pro Mode: Wallet < $${config.thresholds.wallet} AND Tier < ${config.thresholds.tier}%. Switching.`);
|
|
261
|
+
actualModel = config.fallbacks.free.main.replace('free/', '');
|
|
262
|
+
isEnterprise = false;
|
|
263
|
+
isFallbackActive = true;
|
|
264
|
+
fallbackReason = `Wallet & Tier Critical`;
|
|
265
|
+
}
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
268
|
}
|
package/package.json
CHANGED