opencode-pollinations-plugin 5.4.10 → 5.4.12
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 +5 -0
- package/dist/server/commands.js +18 -13
- package/dist/server/config.d.ts +2 -0
- package/dist/server/config.js +10 -2
- package/dist/server/generate-config.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,6 +146,11 @@ Just type in the chat. You are in **Manual Mode** by default.
|
|
|
146
146
|
|
|
147
147
|
### 🤖 Models
|
|
148
148
|
|
|
149
|
+
### 🔑 Types de Clés Supportés
|
|
150
|
+
- **Clés Standard (`sk-...`)**: Accès complet (Modèles + Dashboard Usage + Quota).
|
|
151
|
+
- **Clés Limitées**: Accès Génération uniquement. Le dashboard affichera une alerte de restriction (v5.4.11).
|
|
152
|
+
- **Support Legacy**: Les anciennes clés (`sk_...`) sont aussi acceptées.
|
|
153
|
+
|
|
149
154
|
## 🔗 Links
|
|
150
155
|
|
|
151
156
|
- **Pollinations Website**: [pollinations.ai](https://pollinations.ai)
|
package/dist/server/commands.js
CHANGED
|
@@ -147,21 +147,26 @@ async function handleUsageCommand(args) {
|
|
|
147
147
|
response += `- **Wallet**: $${quota.walletBalance.toFixed(2)}\n`;
|
|
148
148
|
response += `- **Reset**: ${resetDate} (dans ${durationStr})\n`;
|
|
149
149
|
if (isFull && config.apiKey) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const lastReset = calculateResetDate(quota.nextResetAt);
|
|
153
|
-
const stats = calculateCurrentPeriodStats(usageData.usage, lastReset, quota.tierLimit);
|
|
154
|
-
response += `\n### 📊 Détail Période (depuis ${lastReset.toLocaleTimeString()})\n`;
|
|
155
|
-
response += `**Total Requêtes**: ${stats.totalRequests} | **Tokens**: In ${formatTokens(stats.inputTokens)} / Out ${formatTokens(stats.outputTokens)}\n\n`;
|
|
156
|
-
response += `| Modèle | Reqs | Coût | Tokens |\n`;
|
|
157
|
-
response += `| :--- | :---: | :---: | :---: |\n`;
|
|
158
|
-
const sorted = Array.from(stats.models.entries()).sort((a, b) => b[1].cost - a[1].cost);
|
|
159
|
-
for (const [model, data] of sorted) {
|
|
160
|
-
response += `| \`${model}\` | ${data.requests} | ${formatPollen(data.cost)} | ${formatTokens(data.inputTokens + data.outputTokens)} |\n`;
|
|
161
|
-
}
|
|
150
|
+
if (config.keyHasAccessToProfile === false) {
|
|
151
|
+
response += `\n> ⚠️ *Votre clé API ne permet pas l'accès aux détails d'usage (Restriction).*`;
|
|
162
152
|
}
|
|
163
153
|
else {
|
|
164
|
-
|
|
154
|
+
const usageData = await getDetailedUsage(config.apiKey);
|
|
155
|
+
if (usageData && usageData.usage) {
|
|
156
|
+
const lastReset = calculateResetDate(quota.nextResetAt);
|
|
157
|
+
const stats = calculateCurrentPeriodStats(usageData.usage, lastReset, quota.tierLimit);
|
|
158
|
+
response += `\n### 📊 Détail Période (depuis ${lastReset.toLocaleTimeString()})\n`;
|
|
159
|
+
response += `**Total Requêtes**: ${stats.totalRequests} | **Tokens**: In ${formatTokens(stats.inputTokens)} / Out ${formatTokens(stats.outputTokens)}\n\n`;
|
|
160
|
+
response += `| Modèle | Reqs | Coût | Tokens |\n`;
|
|
161
|
+
response += `| :--- | :---: | :---: | :---: |\n`;
|
|
162
|
+
const sorted = Array.from(stats.models.entries()).sort((a, b) => b[1].cost - a[1].cost);
|
|
163
|
+
for (const [model, data] of sorted) {
|
|
164
|
+
response += `| \`${model}\` | ${data.requests} | ${formatPollen(data.cost)} | ${formatTokens(data.inputTokens + data.outputTokens)} |\n`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
response += `\n> ⚠️ *Impossible de récupérer l'historique détaillé.*\n`;
|
|
169
|
+
}
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
172
|
else if (isFull) {
|
package/dist/server/config.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export interface PollinationsConfigV5 {
|
|
|
2
2
|
version: string | number;
|
|
3
3
|
mode: 'manual' | 'alwaysfree' | 'pro';
|
|
4
4
|
apiKey?: string;
|
|
5
|
+
keyHasAccessToProfile?: boolean;
|
|
5
6
|
gui: {
|
|
6
7
|
status: 'none' | 'alert' | 'all';
|
|
7
8
|
logs: 'none' | 'error' | 'verbose';
|
|
@@ -27,6 +28,7 @@ export declare function saveConfig(updates: Partial<PollinationsConfigV5>): {
|
|
|
27
28
|
version: string;
|
|
28
29
|
mode: "manual" | "alwaysfree" | "pro";
|
|
29
30
|
apiKey?: string;
|
|
31
|
+
keyHasAccessToProfile?: boolean;
|
|
30
32
|
gui: {
|
|
31
33
|
status: "none" | "alert" | "all";
|
|
32
34
|
logs: "none" | "error" | "verbose";
|
package/dist/server/config.js
CHANGED
|
@@ -28,6 +28,7 @@ const DEFAULT_CONFIG_V5 = {
|
|
|
28
28
|
enter: { agent: 'free/openai-fast' }
|
|
29
29
|
},
|
|
30
30
|
enablePaidTools: false,
|
|
31
|
+
keyHasAccessToProfile: true, // Default true for legacy keys
|
|
31
32
|
statusBar: true
|
|
32
33
|
};
|
|
33
34
|
function logConfig(msg) {
|
|
@@ -60,8 +61,15 @@ function readConfigFromDisk() {
|
|
|
60
61
|
catch (e) {
|
|
61
62
|
logConfig(`Error loading config: ${e}`);
|
|
62
63
|
}
|
|
63
|
-
// 2. Auth Store (
|
|
64
|
-
|
|
64
|
+
// 2. Auth Store (Fallback ONLY if config.json didn't exist or we are in a clear state)
|
|
65
|
+
// If config.json exists, it is the source of truth. We shouldn't resurrect old keys from auth.json
|
|
66
|
+
// UNLESS config.json is "empty" (just created default).
|
|
67
|
+
// But how to know?
|
|
68
|
+
// New logic: If Custom Config was loaded (fs.exists(CONFIG_FILE)), we trust it.
|
|
69
|
+
// We only check Auth Store if NO custom config exists OR if custom config is explicitly "manual" and we want to auto-discover?
|
|
70
|
+
// User complaint: "Old key comes back".
|
|
71
|
+
// Fix: If config.json exists, we DO NOT check auth.json.
|
|
72
|
+
if (!fs.existsSync(CONFIG_FILE) && !keyFound) {
|
|
65
73
|
try {
|
|
66
74
|
if (fs.existsSync(AUTH_FILE)) {
|
|
67
75
|
const raw = fs.readFileSync(AUTH_FILE, 'utf-8');
|
|
@@ -93,7 +93,7 @@ export async function generatePollinationsConfig(forceApiKey) {
|
|
|
93
93
|
// 2. ENTERPRISE UNIVERSE
|
|
94
94
|
if (effectiveKey && effectiveKey.length > 5 && effectiveKey !== 'dummy') {
|
|
95
95
|
try {
|
|
96
|
-
const enterListRaw = await fetchJson('https://gen.pollinations.ai/
|
|
96
|
+
const enterListRaw = await fetchJson('https://gen.pollinations.ai/models', {
|
|
97
97
|
'Authorization': `Bearer ${effectiveKey}`
|
|
98
98
|
});
|
|
99
99
|
const enterList = Array.isArray(enterListRaw) ? enterListRaw : (enterListRaw.data || []);
|
package/package.json
CHANGED