opencode-pollinations-plugin 5.7.0 → 5.8.1
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.
|
@@ -19,9 +19,14 @@ function log(msg) {
|
|
|
19
19
|
// Force output to stderr for CLI visibility if needed, but clean.
|
|
20
20
|
}
|
|
21
21
|
// Fetch Helper
|
|
22
|
+
// Fetch Helper
|
|
22
23
|
function fetchJson(url, headers = {}) {
|
|
23
24
|
return new Promise((resolve, reject) => {
|
|
24
|
-
const
|
|
25
|
+
const finalHeaders = {
|
|
26
|
+
...headers,
|
|
27
|
+
'User-Agent': 'Mozilla/5.0 (compatible; OpenCode/5.8.1; +https://opencode.ai)'
|
|
28
|
+
};
|
|
29
|
+
const req = https.get(url, { headers: finalHeaders }, (res) => {
|
|
25
30
|
let data = '';
|
|
26
31
|
res.on('data', chunk => data += chunk);
|
|
27
32
|
res.on('end', () => {
|
|
@@ -39,7 +44,7 @@ function fetchJson(url, headers = {}) {
|
|
|
39
44
|
log(`Network Error for ${url}: ${e.message}`);
|
|
40
45
|
reject(e);
|
|
41
46
|
});
|
|
42
|
-
req.setTimeout(
|
|
47
|
+
req.setTimeout(15000, () => {
|
|
43
48
|
req.destroy();
|
|
44
49
|
reject(new Error('Timeout'));
|
|
45
50
|
});
|
|
@@ -53,11 +58,10 @@ function formatName(id, censored = true) {
|
|
|
53
58
|
return clean;
|
|
54
59
|
}
|
|
55
60
|
// --- MAIN GENERATOR logic ---
|
|
56
|
-
// --- MAIN GENERATOR logic ---
|
|
57
61
|
export async function generatePollinationsConfig(forceApiKey, forceStrict = false) {
|
|
58
62
|
const config = loadConfig();
|
|
59
63
|
const modelsOutput = [];
|
|
60
|
-
log(`Starting Configuration (
|
|
64
|
+
log(`Starting Configuration (v5.8.1)...`);
|
|
61
65
|
// Use forced key (from Hook) or cached key
|
|
62
66
|
const effectiveKey = forceApiKey || config.apiKey;
|
|
63
67
|
// 1. FREE UNIVERSE
|
|
@@ -93,7 +97,8 @@ export async function generatePollinationsConfig(forceApiKey, forceStrict = fals
|
|
|
93
97
|
// 2. ENTERPRISE UNIVERSE
|
|
94
98
|
if (effectiveKey && effectiveKey.length > 5 && effectiveKey !== 'dummy') {
|
|
95
99
|
try {
|
|
96
|
-
|
|
100
|
+
// Use /text/models for full metadata (input_modalities, tools, reasoning, pricing)
|
|
101
|
+
const enterListRaw = await fetchJson('https://gen.pollinations.ai/text/models', {
|
|
97
102
|
'Authorization': `Bearer ${effectiveKey}`
|
|
98
103
|
});
|
|
99
104
|
const enterList = Array.isArray(enterListRaw) ? enterListRaw : (enterListRaw.data || []);
|
|
@@ -134,6 +139,32 @@ export async function generatePollinationsConfig(forceApiKey, forceStrict = fals
|
|
|
134
139
|
}
|
|
135
140
|
return modelsOutput;
|
|
136
141
|
}
|
|
142
|
+
// --- CAPABILITY ICONS ---
|
|
143
|
+
function getCapabilityIcons(raw) {
|
|
144
|
+
const icons = [];
|
|
145
|
+
// Vision: accepts images
|
|
146
|
+
if (raw.input_modalities?.includes('image'))
|
|
147
|
+
icons.push('👁️');
|
|
148
|
+
// Audio Input
|
|
149
|
+
if (raw.input_modalities?.includes('audio'))
|
|
150
|
+
icons.push('🎙️');
|
|
151
|
+
// Audio Output
|
|
152
|
+
if (raw.output_modalities?.includes('audio'))
|
|
153
|
+
icons.push('🔊');
|
|
154
|
+
// Reasoning capability
|
|
155
|
+
if (raw.reasoning === true)
|
|
156
|
+
icons.push('🧠');
|
|
157
|
+
// Web Search (from description)
|
|
158
|
+
if (raw.description?.toLowerCase().includes('search') ||
|
|
159
|
+
raw.name?.includes('search') ||
|
|
160
|
+
raw.name?.includes('perplexity')) {
|
|
161
|
+
icons.push('🔍');
|
|
162
|
+
}
|
|
163
|
+
// Tool/Function calling
|
|
164
|
+
if (raw.tools === true)
|
|
165
|
+
icons.push('💻');
|
|
166
|
+
return icons.length > 0 ? ` ${icons.join('')}` : '';
|
|
167
|
+
}
|
|
137
168
|
// --- MAPPING ENGINE ---
|
|
138
169
|
function mapModel(raw, prefix, namePrefix) {
|
|
139
170
|
const rawId = raw.id || raw.name;
|
|
@@ -151,7 +182,9 @@ function mapModel(raw, prefix, namePrefix) {
|
|
|
151
182
|
if (raw.paid_only) {
|
|
152
183
|
namePrefixFinal = namePrefix.replace('[Enter]', '[💎 Paid]');
|
|
153
184
|
}
|
|
154
|
-
|
|
185
|
+
// Get capability icons from API metadata
|
|
186
|
+
const capabilityIcons = getCapabilityIcons(raw);
|
|
187
|
+
const finalName = `${namePrefixFinal}${baseName}${capabilityIcons}`;
|
|
155
188
|
const modelObj = {
|
|
156
189
|
id: fullId,
|
|
157
190
|
name: finalName,
|
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.
|
|
4
|
+
"version": "5.8.1",
|
|
5
5
|
"description": "Native Pollinations.ai Provider Plugin for OpenCode",
|
|
6
6
|
"publisher": "pollinations",
|
|
7
7
|
"repository": {
|
|
@@ -55,4 +55,4 @@
|
|
|
55
55
|
"@types/node": "^20.0.0",
|
|
56
56
|
"typescript": "^5.0.0"
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}
|