opencode-pollinations-plugin 6.0.0-beta.24 → 6.0.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/README.md +88 -134
- package/dist/index.js +54 -86
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,165 +1,119 @@
|
|
|
1
|
-
# 🌸 Pollinations AI Plugin for OpenCode
|
|
1
|
+
# 🌸 Pollinations AI Plugin for OpenCode
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
|
-
<img src="https://avatars.githubusercontent.com/u/88394740?s=400&v=4" alt="Pollinations.ai Logo" width="
|
|
4
|
+
<img src="https://avatars.githubusercontent.com/u/88394740?s=400&v=4" alt="Pollinations.ai Logo" width="150">
|
|
5
5
|
<br>
|
|
6
|
-
<b>The Bridge between OpenCode and the Pollinations.ai Ecosystem
|
|
6
|
+
<b>The Bridge between OpenCode and the Pollinations.ai Ecosystem</b>
|
|
7
7
|
<br>
|
|
8
|
-
Access
|
|
8
|
+
Access 25+ AI models with Vision, Reasoning, and Tools support.
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
<div align="center">
|
|
12
12
|
|
|
13
|
-

|
|
14
14
|

|
|
15
|
-

|
|
16
16
|
|
|
17
|
-
[📜
|
|
17
|
+
[📜 Changelog](./CHANGELOG.md) | [🛣️ Roadmap](./ROADMAP.md)
|
|
18
18
|
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
---
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## ✨ Features
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
25
|
+
- **👁️ Vision Support**: Send images to AI models (OpenAI, Claude, Gemini, Kimi)
|
|
26
|
+
- **🧠 Reasoning Models**: Access advanced thinking models (DeepSeek, Kimi, Perplexity)
|
|
27
|
+
- **🛠️ Native Tools**: Full function calling support for compatible models
|
|
28
|
+
- **🔐 Secure Auth**: Native OpenCode `/connect` integration
|
|
29
|
+
- **🔄 Hot-Reload**: Change API keys without restarting OpenCode
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
---
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
<img src="https://github.com/fkom13/opencode-pollinations-plugin/raw/main/docs/images/connect.png" alt="Connect Command" width="800">
|
|
34
|
-
<br>
|
|
35
|
-
<em>Easy Connection with /connect or /pollinations config apiKey</em>
|
|
36
|
-
</p>
|
|
33
|
+
## 🐝 Understanding Pollen & Tiers
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
<img src="https://github.com/fkom13/opencode-pollinations-plugin/raw/main/docs/images/usage_dashboard.png" alt="Usage Dashboard" width="800">
|
|
40
|
-
<br>
|
|
41
|
-
<em>Integrated Usage Dashboard (/pollinations usage)</em>
|
|
42
|
-
</p>
|
|
35
|
+
**Pollen** is Pollinations' unified credit system. $1 ≈ 1 Pollen.
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
| Tier | Daily Grant | Requirement |
|
|
38
|
+
|:-----|:------------|:------------|
|
|
39
|
+
| 🦠 **Microbe** | 0.1 Pollen | Flagged accounts |
|
|
40
|
+
| 🌱 **Spore** | 1 Pollen | Sign up |
|
|
41
|
+
| 🌿 **Seed** | 3 Pollen | Active GitHub dev (8+ points) |
|
|
42
|
+
| 🌸 **Flower** | 10 Pollen | Published app |
|
|
43
|
+
| 🍯 **Nectar** | 20 Pollen | Major contributor |
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
<img src="https://github.com/fkom13/opencode-pollinations-plugin/raw/main/docs/images/free_add.png" alt="Free Chat Example" width="800">
|
|
52
|
-
<br>
|
|
53
|
-
<em>Free Universe Chat (Supported by Pollinations Ads)</em>
|
|
54
|
-
</p>
|
|
45
|
+
> 💡 This plugin was published to the OpenCode ecosystem, granting its author **Flower** tier (10 Pollen/day).
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
<img src="https://github.com/fkom13/opencode-pollinations-plugin/raw/main/docs/images/plan_1.png" alt="Plan Build Step 1" width="400">
|
|
58
|
-
<img src="https://github.com/fkom13/opencode-pollinations-plugin/raw/main/docs/images/plan_2.png" alt="Plan Build Step 2" width="400">
|
|
59
|
-
<br>
|
|
60
|
-
<em>Integrated Plan Building Workflow</em>
|
|
61
|
-
</p>
|
|
47
|
+
---
|
|
62
48
|
|
|
63
|
-
##
|
|
49
|
+
## 🚀 Quick Start
|
|
64
50
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
- **Smart Mode Switching**: Prevents Limited Keys from entering "Pro" mode to avoid confusing errors.
|
|
71
|
-
- **📊 Real-time Dashboard**: Track your **Pollen** usage, Tier Status, and Wallet Balance inside OpenCode.
|
|
72
|
-
- **🔇 Stealth Mode (v5.4.7)**: Status notifications are now strictly limited to Pollinations Enter (Paid) sessions. No more cluttered notifications when using other providers like Nvidia or Google AI.
|
|
51
|
+
### 1. Install Plugin
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g opencode-pollinations-plugin
|
|
54
|
+
npx opencode-pollinations-plugin
|
|
55
|
+
```
|
|
73
56
|
|
|
74
|
-
|
|
57
|
+
### 2. Connect Your Account
|
|
58
|
+
```
|
|
59
|
+
/connect
|
|
60
|
+
```
|
|
61
|
+
Select **pollinations** → Enter your API key from [enter.pollinations.ai](https://enter.pollinations.ai)
|
|
62
|
+
|
|
63
|
+
### 3. Start Using
|
|
64
|
+
Select any `pollinations/*` model in OpenCode and chat!
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 👁️ Vision Support
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- **
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```json
|
|
116
|
-
{
|
|
117
|
-
"plugin": [
|
|
118
|
-
"opencode-pollinations-plugin"
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
*Note: If OpenCode fails to find it, use the absolute path to the global install.*
|
|
123
|
-
|
|
124
|
-
## 🚀 Publication (The "Registry")
|
|
125
|
-
OpenCode uses NPM as its registry. To publish:
|
|
126
|
-
|
|
127
|
-
1. **Publish to NPM**:
|
|
128
|
-
```bash
|
|
129
|
-
npm login
|
|
130
|
-
npm publish
|
|
131
|
-
```
|
|
132
|
-
2. **Join Ecosystem**: Submit a Pull Request to [OpenCode Ecosystem](https://github.com/opencode-ai/ecosystem) to list your plugin officially.
|
|
133
|
-
*Once accepted, users can find it via documentation or future registry commands.*
|
|
134
|
-
|
|
135
|
-
## 🚀 Getting Started
|
|
136
|
-
|
|
137
|
-
### 1. The Basics (Free Mode)
|
|
138
|
-
Just type in the chat. You are in **Manual Mode** by default.
|
|
139
|
-
- Model: `openai` (GPT-4o Mini equivalent)
|
|
140
|
-
- Model: `mistral` (Mistral Nemo)
|
|
141
|
-
|
|
142
|
-
### 🔑 Configuration (API Key)
|
|
143
|
-
|
|
144
|
-
1. Run the setup command:
|
|
145
|
-
```bash
|
|
146
|
-
/connect
|
|
147
|
-
```
|
|
148
|
-
2. Choose "pollinations" and enter your key if you have one (or leave blank for free tier).
|
|
149
|
-
3. **IMPORTANT**: You must **restart OpenCode** for the model list to update with your new tier (e.g. to see Paid models).
|
|
150
|
-
|
|
151
|
-
### 🤖 Models
|
|
152
|
-
|
|
153
|
-
### 🔑 Types de Clés Supportés
|
|
154
|
-
- **Clés Standard (`sk-...`)**: Accès complet (Modèles + Dashboard Usage + Quota).
|
|
155
|
-
- **Clés Limitées**: Accès Génération uniquement. Le dashboard affichera une alerte de restriction (v5.4.11).
|
|
156
|
-
- **Support Legacy**: Les anciennes clés (`sk_...`) sont aussi acceptées.
|
|
70
|
+
The following models support image input:
|
|
71
|
+
|
|
72
|
+
| Model | Vision | Reasoning | Tools |
|
|
73
|
+
|-------|:------:|:---------:|:-----:|
|
|
74
|
+
| `openai` / `openai-large` | ✅ | - | ✅ |
|
|
75
|
+
| `gemini` / `gemini-search` | ✅ | - | ✅ |
|
|
76
|
+
| `claude` / `claude-large` | ✅ | - | ✅ |
|
|
77
|
+
| `kimi` | ✅ | ✅ | - |
|
|
78
|
+
| `openai-audio` | ✅ | - | ✅ |
|
|
79
|
+
|
|
80
|
+
**Usage**: Simply paste an image in the chat or use an image URL. The plugin handles encoding automatically.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📊 Available Models (25+)
|
|
85
|
+
|
|
86
|
+
### Text/Chat Models
|
|
87
|
+
- **OpenAI**: `openai`, `openai-fast`, `openai-large`
|
|
88
|
+
- **Gemini**: `gemini`, `gemini-fast`, `gemini-search`, `gemini-large` 💎
|
|
89
|
+
- **Claude**: `claude-fast`, `claude`, `claude-large` 💎
|
|
90
|
+
- **Reasoning**: `deepseek`, `kimi`, `perplexity-reasoning`
|
|
91
|
+
- **Code**: `qwen-coder`, `mistral`
|
|
92
|
+
- **Fast**: `nova-fast`, `grok`
|
|
93
|
+
|
|
94
|
+
### Paid-Only Models (💎)
|
|
95
|
+
These require purchased credits (not daily grants):
|
|
96
|
+
- `claude-large`, `gemini-large`, `veo`, `seedream-pro`
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🔧 Commands
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
/pollinations usage # View Pollen balance
|
|
104
|
+
/pollinations usage full # Detailed model breakdown
|
|
105
|
+
/pollinations status # Plugin health check
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
157
109
|
|
|
158
110
|
## 🔗 Links
|
|
159
111
|
|
|
160
|
-
- **
|
|
161
|
-
- **Discord
|
|
162
|
-
- **
|
|
112
|
+
- **Get API Key**: [enter.pollinations.ai](https://enter.pollinations.ai)
|
|
113
|
+
- **Discord**: [Join Community](https://discord.gg/pollinations-ai-885844321461485618)
|
|
114
|
+
- **GitHub**: [Plugin Repository](https://github.com/fkom13/opencode-pollinations-plugin)
|
|
115
|
+
|
|
116
|
+
---
|
|
163
117
|
|
|
164
118
|
## 📜 License
|
|
165
119
|
|
package/dist/index.js
CHANGED
|
@@ -92,80 +92,7 @@ const startProxy = () => {
|
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
// === AUTH HOOK: Native /connect Integration ===
|
|
95
|
-
|
|
96
|
-
provider: 'pollinations',
|
|
97
|
-
// LOADER: Called by OpenCode when it needs credentials
|
|
98
|
-
// This enables HOT RELOAD - called before each request that needs auth
|
|
99
|
-
loader: async (auth, provider) => {
|
|
100
|
-
log('[AuthHook] loader() called - fetching credentials');
|
|
101
|
-
try {
|
|
102
|
-
const authData = await auth();
|
|
103
|
-
if (authData && 'key' in authData && authData.key) {
|
|
104
|
-
log(`[AuthHook] Got key from OpenCode auth: ${authData.key.substring(0, 8)}...`);
|
|
105
|
-
// Sync to our config for other parts of the plugin
|
|
106
|
-
saveConfig({ apiKey: authData.key });
|
|
107
|
-
return { apiKey: authData.key };
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
catch (e) {
|
|
111
|
-
log(`[AuthHook] loader() error: ${e}`);
|
|
112
|
-
}
|
|
113
|
-
// Fallback to our own config
|
|
114
|
-
const config = loadConfig();
|
|
115
|
-
if (config.apiKey) {
|
|
116
|
-
log(`[AuthHook] Using key from plugin config: ${config.apiKey.substring(0, 8)}...`);
|
|
117
|
-
return { apiKey: config.apiKey };
|
|
118
|
-
}
|
|
119
|
-
log('[AuthHook] No API key available');
|
|
120
|
-
return {};
|
|
121
|
-
},
|
|
122
|
-
// METHODS: Define how user can authenticate
|
|
123
|
-
methods: [{
|
|
124
|
-
type: 'api',
|
|
125
|
-
label: 'API Key',
|
|
126
|
-
prompts: [{
|
|
127
|
-
type: 'text',
|
|
128
|
-
key: 'apiKey',
|
|
129
|
-
message: 'Enter your Pollinations API Key',
|
|
130
|
-
placeholder: 'sk_...',
|
|
131
|
-
validate: (value) => {
|
|
132
|
-
if (!value || value.length < 10) {
|
|
133
|
-
return 'API key must be at least 10 characters';
|
|
134
|
-
}
|
|
135
|
-
if (!value.startsWith('sk_') && !value.startsWith('sk-')) {
|
|
136
|
-
return 'API key should start with sk_ or sk-';
|
|
137
|
-
}
|
|
138
|
-
return undefined; // Valid
|
|
139
|
-
}
|
|
140
|
-
}],
|
|
141
|
-
authorize: async (inputs) => {
|
|
142
|
-
log(`[AuthHook] authorize() called with key: ${inputs?.apiKey?.substring(0, 8)}...`);
|
|
143
|
-
if (!inputs?.apiKey) {
|
|
144
|
-
return { type: 'failed' };
|
|
145
|
-
}
|
|
146
|
-
// Validate key by testing API
|
|
147
|
-
try {
|
|
148
|
-
const response = await fetch('https://gen.pollinations.ai/text/models', {
|
|
149
|
-
headers: { 'Authorization': `Bearer ${inputs.apiKey}` }
|
|
150
|
-
});
|
|
151
|
-
if (response.ok) {
|
|
152
|
-
log('[AuthHook] Key validated successfully');
|
|
153
|
-
// Save to our config for immediate use
|
|
154
|
-
saveConfig({ apiKey: inputs.apiKey });
|
|
155
|
-
return { type: 'success', key: inputs.apiKey };
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
log(`[AuthHook] Key validation failed: ${response.status}`);
|
|
159
|
-
return { type: 'failed' };
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
catch (e) {
|
|
163
|
-
log(`[AuthHook] Key validation error: ${e}`);
|
|
164
|
-
return { type: 'failed' };
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}]
|
|
168
|
-
});
|
|
95
|
+
// Auth Hook moved inside plugin to access context
|
|
169
96
|
// === PLUGIN EXPORT ===
|
|
170
97
|
export const PollinationsPlugin = async (ctx) => {
|
|
171
98
|
log(`Plugin Initializing v${require('../package.json').version}...`);
|
|
@@ -232,20 +159,61 @@ export const PollinationsPlugin = async (ctx) => {
|
|
|
232
159
|
}
|
|
233
160
|
};
|
|
234
161
|
return {
|
|
235
|
-
// AUTH HOOK: Native /connect integration
|
|
236
|
-
auth:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
162
|
+
// AUTH HOOK: Native /connect integration (INLINED)
|
|
163
|
+
auth: {
|
|
164
|
+
provider: 'pollinations',
|
|
165
|
+
loader: async (auth, provider) => {
|
|
166
|
+
log('[AuthHook] loader() called');
|
|
167
|
+
try {
|
|
168
|
+
const authData = await auth();
|
|
169
|
+
if (authData && 'key' in authData) {
|
|
170
|
+
const k = authData.key;
|
|
171
|
+
saveConfig({ apiKey: k });
|
|
172
|
+
return { apiKey: k };
|
|
173
|
+
}
|
|
246
174
|
}
|
|
247
|
-
|
|
175
|
+
catch (e) {
|
|
176
|
+
log(`[AuthHook] loader error: ${e}`);
|
|
177
|
+
}
|
|
178
|
+
const config = loadConfig();
|
|
179
|
+
if (config.apiKey)
|
|
180
|
+
return { apiKey: config.apiKey };
|
|
181
|
+
return {};
|
|
182
|
+
},
|
|
183
|
+
methods: [{
|
|
184
|
+
type: 'api',
|
|
185
|
+
label: 'Pollinations API Key',
|
|
186
|
+
prompts: [{
|
|
187
|
+
type: 'text',
|
|
188
|
+
key: 'apiKey',
|
|
189
|
+
message: 'Enter Pollinations API Key (starts with sk_)',
|
|
190
|
+
validate: (v) => (!v || v.length < 10) ? 'Invalid key' : undefined
|
|
191
|
+
}],
|
|
192
|
+
authorize: async (inputs) => {
|
|
193
|
+
log(`[AuthHook] authorize() called`);
|
|
194
|
+
if (!inputs?.apiKey)
|
|
195
|
+
return { type: 'failed' };
|
|
196
|
+
try {
|
|
197
|
+
const r = await fetch('https://gen.pollinations.ai/text/models', {
|
|
198
|
+
headers: { 'Authorization': `Bearer ${inputs.apiKey}` }
|
|
199
|
+
});
|
|
200
|
+
if (r.ok) {
|
|
201
|
+
log('[AuthHook] Success. Saving & Refreshing Config...');
|
|
202
|
+
saveConfig({ apiKey: inputs.apiKey });
|
|
203
|
+
// CRITICAL: Refresh config IMMEDIATELY after successful auth
|
|
204
|
+
await refreshProviderConfig();
|
|
205
|
+
return { type: 'success', key: inputs.apiKey };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
log(`[AuthHook] Auth error: ${e}`);
|
|
210
|
+
}
|
|
211
|
+
return { type: 'failed' };
|
|
212
|
+
}
|
|
213
|
+
}]
|
|
248
214
|
},
|
|
215
|
+
// Event hook removed (logic moved to authorize)
|
|
216
|
+
event: async ({ event }) => { },
|
|
249
217
|
async config(config) {
|
|
250
218
|
log("[Hook] config() called");
|
|
251
219
|
// Generate models based on current auth state
|
package/package.json
CHANGED