n8n-nodes-pollinations-ai 1.2.0 → 1.3.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.
@@ -1,17 +0,0 @@
1
- {
2
- "node": "n8n-nodes-pollinations-ai.pollinationsChatModel",
3
- "nodeVersion": "1.0",
4
- "codexVersion": "1.0",
5
- "categories": ["AI"],
6
- "subcategories": {
7
- "AI": ["Language Models", "Chat Models"]
8
- },
9
- "resources": {
10
- "primaryDocumentation": [
11
- {
12
- "url": "https://enter.pollinations.ai/api/docs"
13
- }
14
- ]
15
- },
16
- "alias": ["pollinations", "chat", "llm", "ai", "language model", "gpt", "claude", "gemini", "mistral", "deepseek", "grok", "chat model", "openai compatible"]
17
- }
@@ -1,247 +0,0 @@
1
- import type {
2
- ILoadOptionsFunctions,
3
- INodePropertyOptions,
4
- INodeType,
5
- INodeTypeDescription,
6
- ISupplyDataFunctions,
7
- SupplyData,
8
- } from 'n8n-workflow';
9
- import { ChatOpenAI } from '@langchain/openai';
10
-
11
- export class PollinationsChatModel implements INodeType {
12
- description: INodeTypeDescription = {
13
- displayName: 'Pollinations Chat Model',
14
- name: 'pollinationsChatModel',
15
- icon: 'file:pollinations.svg',
16
- group: ['transform'],
17
- version: 1,
18
- description: 'Use Pollinations AI chat models with AI Agents and LLM Chains',
19
- defaults: {
20
- name: 'Pollinations Chat Model',
21
- },
22
- codex: {
23
- categories: ['AI'],
24
- subcategories: {
25
- AI: ['Language Models', 'Chat Models'],
26
- },
27
- resources: {
28
- primaryDocumentation: [
29
- {
30
- url: 'https://enter.pollinations.ai/api/docs',
31
- },
32
- ],
33
- },
34
- },
35
- // Sub-node: no main inputs, output is ai_languageModel
36
- inputs: [],
37
- outputs: ['ai_languageModel'],
38
- outputNames: ['Model'],
39
- credentials: [
40
- {
41
- name: 'pollinationsApi',
42
- required: true,
43
- },
44
- ],
45
- properties: [
46
- // Model - dynamic loading
47
- {
48
- displayName: 'Model',
49
- name: 'model',
50
- type: 'options',
51
- default: 'openai',
52
- typeOptions: {
53
- loadOptionsMethod: 'getChatModels',
54
- },
55
- description: 'The model to use for chat completions',
56
- },
57
- // Temperature
58
- {
59
- displayName: 'Temperature',
60
- name: 'temperature',
61
- type: 'number',
62
- default: 1,
63
- typeOptions: {
64
- minValue: 0,
65
- maxValue: 2,
66
- numberPrecision: 1,
67
- },
68
- description: 'Controls randomness: 0 = deterministic, 2 = very creative',
69
- },
70
- // Options collection
71
- {
72
- displayName: 'Options',
73
- name: 'options',
74
- type: 'collection',
75
- placeholder: 'Add Option',
76
- default: {},
77
- options: [
78
- {
79
- displayName: 'Max Tokens',
80
- name: 'maxTokens',
81
- type: 'number',
82
- default: 0,
83
- description: 'Maximum tokens in response. 0 uses model default.',
84
- typeOptions: {
85
- minValue: 0,
86
- },
87
- },
88
- {
89
- displayName: 'Top P',
90
- name: 'topP',
91
- type: 'number',
92
- default: 1,
93
- typeOptions: {
94
- minValue: 0,
95
- maxValue: 1,
96
- numberPrecision: 2,
97
- },
98
- description: 'Nucleus sampling: consider tokens with top_p probability mass',
99
- },
100
- {
101
- displayName: 'Frequency Penalty',
102
- name: 'frequencyPenalty',
103
- type: 'number',
104
- default: 0,
105
- typeOptions: {
106
- minValue: -2,
107
- maxValue: 2,
108
- numberPrecision: 1,
109
- },
110
- description: 'Reduce repetition of token sequences. Higher values decrease repetition.',
111
- },
112
- {
113
- displayName: 'Presence Penalty',
114
- name: 'presencePenalty',
115
- type: 'number',
116
- default: 0,
117
- typeOptions: {
118
- minValue: -2,
119
- maxValue: 2,
120
- numberPrecision: 1,
121
- },
122
- description: 'Increase likelihood of new topics. Higher values encourage novelty.',
123
- },
124
- {
125
- displayName: 'Timeout',
126
- name: 'timeout',
127
- type: 'number',
128
- default: 60000,
129
- typeOptions: {
130
- minValue: 1000,
131
- },
132
- description: 'Request timeout in milliseconds',
133
- },
134
- ],
135
- },
136
- ],
137
- };
138
-
139
- methods = {
140
- loadOptions: {
141
- async getChatModels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
142
- try {
143
- const credentials = await this.getCredentials('pollinationsApi');
144
- const apiKey = credentials.apiKey as string;
145
-
146
- const response = await this.helpers.httpRequest({
147
- method: 'GET',
148
- url: 'https://gen.pollinations.ai/text/models',
149
- headers: {
150
- Authorization: `Bearer ${apiKey}`,
151
- },
152
- });
153
-
154
- if (Array.isArray(response)) {
155
- // Filter only text models (exclude image/video models)
156
- const textModels = response.filter(
157
- (model: { output_modalities?: string[] }) =>
158
- model.output_modalities?.includes('text') &&
159
- !model.output_modalities?.includes('image') &&
160
- !model.output_modalities?.includes('video'),
161
- );
162
-
163
- return textModels.map(
164
- (model: {
165
- name: string;
166
- description: string;
167
- pricing?: { completionTextTokens?: number };
168
- }) => {
169
- let displayName = model.description || model.name;
170
-
171
- // Add pricing info if available (responses per pollen)
172
- if (model.pricing?.completionTextTokens) {
173
- const responsesPerPollen = Math.floor(1 / model.pricing.completionTextTokens);
174
- displayName += ` (~${responsesPerPollen.toLocaleString()} resp/$)`;
175
- }
176
-
177
- return {
178
- name: displayName,
179
- value: model.name,
180
- };
181
- },
182
- );
183
- }
184
-
185
- // Fallback if API fails
186
- return [
187
- { name: 'OpenAI GPT-4o Mini', value: 'openai' },
188
- { name: 'OpenAI GPT-4o Mini (Fast)', value: 'openai-fast' },
189
- { name: 'OpenAI GPT-4o (Large)', value: 'openai-large' },
190
- { name: 'Claude Sonnet 3.5', value: 'claude' },
191
- { name: 'Claude (Fast)', value: 'claude-fast' },
192
- { name: 'Claude (Large)', value: 'claude-large' },
193
- { name: 'Gemini', value: 'gemini' },
194
- { name: 'Gemini (Fast)', value: 'gemini-fast' },
195
- { name: 'Gemini (Large)', value: 'gemini-large' },
196
- { name: 'DeepSeek V3', value: 'deepseek' },
197
- { name: 'Mistral', value: 'mistral' },
198
- { name: 'Grok', value: 'grok' },
199
- ];
200
- } catch {
201
- // Fallback if API fails
202
- return [
203
- { name: 'OpenAI GPT-4o Mini', value: 'openai' },
204
- { name: 'OpenAI GPT-4o Mini (Fast)', value: 'openai-fast' },
205
- { name: 'OpenAI GPT-4o (Large)', value: 'openai-large' },
206
- { name: 'Claude Sonnet 3.5', value: 'claude' },
207
- { name: 'Mistral', value: 'mistral' },
208
- { name: 'DeepSeek V3', value: 'deepseek' },
209
- ];
210
- }
211
- },
212
- },
213
- };
214
-
215
- async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
216
- const credentials = await this.getCredentials('pollinationsApi');
217
- const apiKey = credentials.apiKey as string;
218
-
219
- const model = this.getNodeParameter('model', 0) as string;
220
- const temperature = this.getNodeParameter('temperature', 0) as number;
221
- const options = this.getNodeParameter('options', 0, {}) as {
222
- maxTokens?: number;
223
- topP?: number;
224
- frequencyPenalty?: number;
225
- presencePenalty?: number;
226
- timeout?: number;
227
- };
228
-
229
- const chatModel = new ChatOpenAI({
230
- model,
231
- temperature,
232
- maxTokens: options.maxTokens || undefined,
233
- topP: options.topP,
234
- frequencyPenalty: options.frequencyPenalty,
235
- presencePenalty: options.presencePenalty,
236
- timeout: options.timeout,
237
- configuration: {
238
- baseURL: 'https://gen.pollinations.ai/v1',
239
- },
240
- apiKey,
241
- });
242
-
243
- return {
244
- response: chatModel,
245
- };
246
- }
247
- }
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "strict": true,
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- "target": "ES2021",
7
- "lib": ["ES2021"],
8
- "declaration": true,
9
- "skipLibCheck": true,
10
- "esModuleInterop": true,
11
- "resolveJsonModule": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "outDir": "./dist",
14
- "rootDir": "."
15
- },
16
- "include": [
17
- "credentials/**/*.ts",
18
- "nodes/**/*.ts",
19
- "index.ts"
20
- ],
21
- "exclude": [
22
- "node_modules",
23
- "dist"
24
- ]
25
- }