opencode-pollinations-plugin 5.2.0 → 5.2.2

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.
@@ -228,12 +228,15 @@ export async function handleChatCompletion(req, res, bodyRaw) {
228
228
  isFallbackActive = true;
229
229
  fallbackReason = "Quota Unreachable (Safety)";
230
230
  }
231
- else if (quota.tierRemaining <= 0.1) {
232
- log(`[SafetyNet] AlwaysFree Mode: Daily Tier Empty. Switching to Free Fallback.`);
233
- actualModel = config.fallbacks.free.main.replace('free/', '');
234
- isEnterprise = false;
235
- isFallbackActive = true;
236
- fallbackReason = "Daily Tier Empty (Wallet Protected)";
231
+ else {
232
+ const tierRatio = quota.tierLimit > 0 ? (quota.tierRemaining / quota.tierLimit) : 0;
233
+ if (tierRatio <= (config.thresholds.tier / 100)) {
234
+ log(`[SafetyNet] AlwaysFree Mode: Tier (${(tierRatio * 100).toFixed(1)}%) <= Threshold (${config.thresholds.tier}%). Switching.`);
235
+ actualModel = config.fallbacks.free.main.replace('free/', '');
236
+ isEnterprise = false;
237
+ isFallbackActive = true;
238
+ fallbackReason = `Daily Tier < ${config.thresholds.tier}% (Wallet Protected)`;
239
+ }
237
240
  }
238
241
  }
239
242
  }
@@ -246,12 +249,12 @@ export async function handleChatCompletion(req, res, bodyRaw) {
246
249
  isFallbackActive = true;
247
250
  fallbackReason = "Quota Unreachable (Safety)";
248
251
  }
249
- else if (quota.walletBalance < 0.10 && quota.tierRemaining <= 0.1) {
250
- log(`[SafetyNet] Pro Mode: Wallet Critical (<$0.10). Switching to Free Fallback.`);
252
+ else if (quota.walletBalance < config.thresholds.wallet && quota.tierRemaining <= 0.1) { // Tier is loose here, wallet is primary
253
+ log(`[SafetyNet] Pro Mode: Wallet Critical (<$${config.thresholds.wallet}). Switching to Free Fallback.`);
251
254
  actualModel = config.fallbacks.free.main.replace('free/', '');
252
255
  isEnterprise = false;
253
256
  isFallbackActive = true;
254
- fallbackReason = "Wallet Critical";
257
+ fallbackReason = `Wallet < $${config.thresholds.wallet}`;
255
258
  }
256
259
  }
257
260
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.1)",
4
- "version": "5.2.0",
4
+ "version": "5.2.2",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {