opencode-pollinations-plugin 5.8.4-beta.16 → 5.8.4-beta.17

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.
@@ -216,16 +216,16 @@ export async function handleChatCompletion(req, res, bodyRaw) {
216
216
  // LOAD QUOTA FOR SAFETY CHECKS
217
217
  const { getQuotaStatus, formatQuotaForToast } = await import('./quota.js');
218
218
  const quota = await getQuotaStatus(false);
219
- // A. Resolve Base Target
220
- // A. Resolve Base Target
219
+ // A. Resolve Base Target - v6.0: All models go to gen.pollinations.ai
220
+ // Strip any legacy prefixes for backwards compatibility
221
221
  if (actualModel.startsWith('enter/') || actualModel.startsWith('enter-')) {
222
- isEnterprise = true;
223
222
  actualModel = actualModel.replace(/^enter[-/]/, '');
224
223
  }
225
224
  else if (actualModel.startsWith('free/') || actualModel.startsWith('free-')) {
226
- isEnterprise = false;
227
225
  actualModel = actualModel.replace(/^free[-/]/, '');
228
226
  }
227
+ // v6.0: Everything is enterprise now (requires API key)
228
+ isEnterprise = true;
229
229
  // A.1 PAID MODEL ENFORCEMENT (V5.5 Strategy)
230
230
  // Check dynamic list saved by generate-config.ts
231
231
  if (isEnterprise) {
@@ -337,24 +337,16 @@ export async function handleChatCompletion(req, res, bodyRaw) {
337
337
  }
338
338
  }
339
339
  }
340
- // C. Construct URL & Headers
341
- if (isEnterprise) {
342
- if (!config.apiKey) {
343
- emitLogToast('error', "Missing API Key for Enterprise Model", 'Proxy Error');
344
- res.writeHead(401, { 'Content-Type': 'application/json' });
345
- res.end(JSON.stringify({ error: { message: "API Key required for Enterprise models." } }));
346
- return;
347
- }
348
- targetUrl = 'https://gen.pollinations.ai/v1/chat/completions';
349
- authHeader = `Bearer ${config.apiKey}`;
350
- log(`Routing to ENTERPRISE: ${actualModel}`);
351
- }
352
- else {
353
- targetUrl = 'https://text.pollinations.ai/openai/chat/completions';
354
- authHeader = undefined;
355
- log(`Routing to FREE: ${actualModel} ${isFallbackActive ? '(FALLBACK)' : ''}`);
356
- // emitLogToast('info', `Routing to: FREE UNIVERSE (${actualModel})`, 'Pollinations Routing'); // Too noisy
340
+ // C. Construct URL & Headers - v6.0: Always gen.pollinations.ai
341
+ if (!config.apiKey) {
342
+ emitLogToast('error', "Missing API Key - Use /pollinations connect <key>", 'Proxy Error');
343
+ res.writeHead(401, { 'Content-Type': 'application/json' });
344
+ res.end(JSON.stringify({ error: { message: "API Key required. Use /pollinations connect <your_key> to connect." } }));
345
+ return;
357
346
  }
347
+ targetUrl = 'https://gen.pollinations.ai/v1/chat/completions';
348
+ authHeader = `Bearer ${config.apiKey}`;
349
+ log(`Routing to gen.pollinations.ai: ${actualModel}`);
358
350
  // NOTIFY SWITCH
359
351
  if (isFallbackActive) {
360
352
  emitStatusToast('warning', `⚠️ Safety Net: ${actualModel} (${fallbackReason})`, 'Pollinations Safety');
@@ -594,10 +586,10 @@ export async function handleChatCompletion(req, res, bodyRaw) {
594
586
  // 2. Notify
595
587
  emitStatusToast('warning', `⚠️ Safety Net: ${actualModel} (${fallbackReason})`, 'Pollinations Safety');
596
588
  emitLogToast('warning', `Recovering from ${fetchRes.status} -> Switching to ${actualModel}`, 'Safety Net');
597
- // 3. Re-Prepare Request
598
- targetUrl = 'https://text.pollinations.ai/openai/chat/completions';
589
+ // 3. Re-Prepare Request - v6.0: Stay on gen.pollinations.ai
590
+ targetUrl = 'https://gen.pollinations.ai/v1/chat/completions';
599
591
  const retryHeaders = { ...headers };
600
- delete retryHeaders['Authorization']; // Free = No Auth
592
+ // Keep Authorization for gen.pollinations.ai
601
593
  const retryBody = { ...proxyBody, model: actualModel };
602
594
  // 4. Retry Fetch
603
595
  const retryRes = await fetchWithRetry(targetUrl, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.6)",
4
- "version": "5.8.4-beta.16",
4
+ "version": "5.8.4-beta.17",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {