n8n-nodes-grok-reasoning 0.1.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 ADDED
@@ -0,0 +1,56 @@
1
+ # n8n-nodes-grok-reasoning
2
+
3
+ An [n8n](https://n8n.io) community node that adds an **xAI Grok Chat Model** with a **Reasoning Effort** control.
4
+
5
+ It is a faithful clone of n8n's built-in xAI Grok Chat Model node (`@n8n/n8n-nodes-langchain.lmChatXAiGrok`) — same connection style, same options — with one addition: the [`reasoning_effort`](https://docs.x.ai/developers/model-capabilities/text/reasoning) parameter, so you can trade off thinking depth against latency directly from the node.
6
+
7
+ Connect it to an **AI Agent** or **Basic LLM Chain** node as the Chat Model sub-node.
8
+
9
+ ## Features
10
+
11
+ - Works as a Chat Model sub-node for AI Agent / AI Chain nodes.
12
+ - Dynamically loads available Grok models from the xAI API.
13
+ - **Reasoning Effort** dropdown: `none` · `low` · `medium` · `high`.
14
+ - Standard options: temperature, top-p, max tokens, frequency/presence penalty, JSON response format, timeout, retries.
15
+
16
+ ### Reasoning Effort
17
+
18
+ | Value | Behaviour |
19
+ | -------- | --------- |
20
+ | `none` | Disables reasoning entirely; no thinking tokens. Fastest. |
21
+ | `low` | Some reasoning tokens, but still fast. Good for general agent work. (default) |
22
+ | `medium` | More thinking for less latency-sensitive applications. |
23
+ | `high` | More reasoning tokens for deeper thinking. Best for hard problems. |
24
+
25
+ The value is sent to the xAI API as the `reasoning_effort` body parameter. Only reasoning-capable Grok models honour it (e.g. grok-4 and newer). When reasoning is active (anything other than `none`), the xAI API ignores `temperature`, `frequency_penalty` and `presence_penalty`, so the node omits them automatically to avoid request errors.
26
+
27
+ ## Installation
28
+
29
+ In n8n: **Settings → Community Nodes → Install**, then enter:
30
+
31
+ ```
32
+ n8n-nodes-grok-reasoning
33
+ ```
34
+
35
+ Or install manually:
36
+
37
+ ```bash
38
+ npm install n8n-nodes-grok-reasoning
39
+ ```
40
+
41
+ ## Credentials
42
+
43
+ Create an **xAI Grok API** credential:
44
+
45
+ - **API Key** — your key from <https://console.x.ai/>.
46
+ - **Base URL** — defaults to `https://api.x.ai/v1`.
47
+
48
+ ## Usage
49
+
50
+ 1. Add an **AI Agent** (or **Basic LLM Chain**) node.
51
+ 2. Add the **xAI Grok Chat Model (Reasoning Effort)** node and connect it to the agent's Chat Model input.
52
+ 3. Pick a model, set **Reasoning Effort**, and configure any other options.
53
+
54
+ ## License
55
+
56
+ [MIT](https://opensource.org/licenses/MIT)
@@ -0,0 +1,9 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class XAiGrokApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XAiGrokApi = void 0;
4
+ class XAiGrokApi {
5
+ name = 'xAiGrokApi';
6
+ displayName = 'xAI Grok API';
7
+ documentationUrl = 'https://docs.x.ai/';
8
+ properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: { password: true },
14
+ default: '',
15
+ required: true,
16
+ description: 'Your xAI API key from https://console.x.ai/',
17
+ },
18
+ {
19
+ displayName: 'Base URL',
20
+ name: 'url',
21
+ type: 'string',
22
+ default: 'https://api.x.ai/v1',
23
+ description: 'The base URL for the xAI API. Change this only if using a proxy or alternative endpoint.',
24
+ },
25
+ ];
26
+ authenticate = {
27
+ type: 'generic',
28
+ properties: {
29
+ headers: {
30
+ Authorization: '=Bearer {{$credentials.apiKey}}',
31
+ },
32
+ },
33
+ };
34
+ test = {
35
+ request: {
36
+ baseURL: '={{$credentials.url}}',
37
+ url: '/models',
38
+ method: 'GET',
39
+ },
40
+ };
41
+ }
42
+ exports.XAiGrokApi = XAiGrokApi;
43
+ //# sourceMappingURL=XAiGrokApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XAiGrokApi.credentials.js","sourceRoot":"","sources":["../../credentials/XAiGrokApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,UAAU;IACtB,IAAI,GAAG,YAAY,CAAC;IAEpB,WAAW,GAAG,cAAc,CAAC;IAE7B,gBAAgB,GAAG,oBAAoB,CAAC;IAExC,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,6CAA6C;SAC1D;QACD;YACC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,qBAAqB;YAC9B,WAAW,EAAE,0FAA0F;SACvG;KACD,CAAC;IAEF,YAAY,GAAyB;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACX,OAAO,EAAE;gBACR,aAAa,EAAE,iCAAiC;aAChD;SACD;KACD,CAAC;IAEF,IAAI,GAA2B;QAC9B,OAAO,EAAE;YACR,OAAO,EAAE,uBAAuB;YAChC,GAAG,EAAE,SAAS;YACd,MAAM,EAAE,KAAK;SACb;KACD,CAAC;CACF;AA1CD,gCA0CC"}
@@ -0,0 +1,19 @@
1
+ import { type INodeType, type INodeTypeDescription, type ISupplyDataFunctions, type SupplyData } from 'n8n-workflow';
2
+ /**
3
+ * xAI Grok Chat Model — with the `reasoning_effort` parameter.
4
+ *
5
+ * A faithful community-node clone of n8n's built-in xAI Grok Chat Model
6
+ * (`@n8n/n8n-nodes-langchain.lmChatXAiGrok`). The xAI API is OpenAI-compatible,
7
+ * so this wraps LangChain's ChatOpenAI pointed at the xAI base URL.
8
+ *
9
+ * The one addition over the built-in node is the **Reasoning Effort** control,
10
+ * which sends the `reasoning_effort` body parameter documented at
11
+ * https://docs.x.ai/developers/model-capabilities/text/reasoning
12
+ * Accepted values: none | low | medium | high.
13
+ *
14
+ * Connect this node to an AI Agent / AI Chain node as the Chat Model sub-node.
15
+ */
16
+ export declare class XAiGrok implements INodeType {
17
+ description: INodeTypeDescription;
18
+ supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
19
+ }
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XAiGrok = void 0;
4
+ const openai_1 = require("@langchain/openai");
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ /**
7
+ * xAI Grok Chat Model — with the `reasoning_effort` parameter.
8
+ *
9
+ * A faithful community-node clone of n8n's built-in xAI Grok Chat Model
10
+ * (`@n8n/n8n-nodes-langchain.lmChatXAiGrok`). The xAI API is OpenAI-compatible,
11
+ * so this wraps LangChain's ChatOpenAI pointed at the xAI base URL.
12
+ *
13
+ * The one addition over the built-in node is the **Reasoning Effort** control,
14
+ * which sends the `reasoning_effort` body parameter documented at
15
+ * https://docs.x.ai/developers/model-capabilities/text/reasoning
16
+ * Accepted values: none | low | medium | high.
17
+ *
18
+ * Connect this node to an AI Agent / AI Chain node as the Chat Model sub-node.
19
+ */
20
+ class XAiGrok {
21
+ description = {
22
+ displayName: 'xAI Grok Chat Model (Reasoning Effort)',
23
+ name: 'xAiGrok',
24
+ icon: 'file:grok.svg',
25
+ group: ['transform'],
26
+ version: 1,
27
+ description: 'xAI Grok chat model with reasoning_effort control. Connect this to an AI Agent node as the Chat Model.',
28
+ defaults: {
29
+ name: 'xAI Grok Chat Model',
30
+ },
31
+ codex: {
32
+ categories: ['AI'],
33
+ subcategories: {
34
+ AI: ['Language Models', 'Root Nodes'],
35
+ 'Language Models': ['Chat Models (Recommended)'],
36
+ },
37
+ resources: {
38
+ primaryDocumentation: [
39
+ {
40
+ url: 'https://docs.x.ai/developers/model-capabilities/text/reasoning',
41
+ },
42
+ ],
43
+ },
44
+ },
45
+ // No regular inputs — this is a sub-node (Chat Model provider).
46
+ inputs: [],
47
+ outputs: [n8n_workflow_1.NodeConnectionTypes.AiLanguageModel],
48
+ outputNames: ['Model'],
49
+ credentials: [
50
+ {
51
+ name: 'xAiGrokApi',
52
+ required: true,
53
+ },
54
+ ],
55
+ requestDefaults: {
56
+ ignoreHttpStatusErrors: true,
57
+ baseURL: '={{ $credentials?.url }}',
58
+ },
59
+ properties: [
60
+ {
61
+ displayName: 'Connect this node to the <b>Chat Model</b> input of an AI Agent or Basic LLM Chain node.',
62
+ name: 'connectionNotice',
63
+ type: 'notice',
64
+ default: '',
65
+ },
66
+ {
67
+ displayName: 'If using JSON response format, you must include the word "json" in your prompt. Reasoning Effort is only honoured by reasoning-capable Grok models (e.g. grok-4 and newer).',
68
+ name: 'notice',
69
+ type: 'notice',
70
+ default: '',
71
+ displayOptions: {
72
+ show: {
73
+ '/options.responseFormat': ['json_object'],
74
+ },
75
+ },
76
+ },
77
+ {
78
+ displayName: 'Model',
79
+ name: 'model',
80
+ type: 'options',
81
+ description: 'The model which will generate the completion. <a href="https://docs.x.ai/docs/models">Learn more</a>.',
82
+ typeOptions: {
83
+ loadOptions: {
84
+ routing: {
85
+ request: {
86
+ method: 'GET',
87
+ url: '/models',
88
+ },
89
+ output: {
90
+ postReceive: [
91
+ {
92
+ type: 'rootProperty',
93
+ properties: {
94
+ property: 'data',
95
+ },
96
+ },
97
+ {
98
+ type: 'setKeyValue',
99
+ properties: {
100
+ name: '={{$responseItem.id}}',
101
+ value: '={{$responseItem.id}}',
102
+ },
103
+ },
104
+ {
105
+ type: 'sort',
106
+ properties: {
107
+ key: 'name',
108
+ },
109
+ },
110
+ ],
111
+ },
112
+ },
113
+ },
114
+ },
115
+ default: 'grok-4',
116
+ },
117
+ {
118
+ displayName: 'Reasoning Effort',
119
+ name: 'reasoningEffort',
120
+ type: 'options',
121
+ options: [
122
+ {
123
+ name: 'None',
124
+ value: 'none',
125
+ description: 'Disables reasoning entirely; no thinking tokens are used. Fastest.',
126
+ },
127
+ {
128
+ name: 'Low',
129
+ value: 'low',
130
+ description: 'Uses some reasoning tokens, but still fast. Good for general agent work.',
131
+ },
132
+ {
133
+ name: 'Medium',
134
+ value: 'medium',
135
+ description: 'More thinking for less latency-sensitive applications.',
136
+ },
137
+ {
138
+ name: 'High',
139
+ value: 'high',
140
+ description: 'Uses more reasoning tokens for deeper thinking. Best for hard problems.',
141
+ },
142
+ ],
143
+ default: 'low',
144
+ description: 'Controls how extensively the model deliberates before responding. Sends the xAI reasoning_effort parameter. Only supported by reasoning-capable Grok models.',
145
+ },
146
+ {
147
+ displayName: 'Options',
148
+ name: 'options',
149
+ placeholder: 'Add Option',
150
+ description: 'Additional options to add',
151
+ type: 'collection',
152
+ default: {},
153
+ options: [
154
+ {
155
+ displayName: 'Frequency Penalty',
156
+ name: 'frequencyPenalty',
157
+ default: 0,
158
+ typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
159
+ description: "Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. Ignored while reasoning_effort is active.",
160
+ type: 'number',
161
+ },
162
+ {
163
+ displayName: 'Maximum Number of Tokens',
164
+ name: 'maxTokens',
165
+ default: -1,
166
+ description: 'The maximum number of tokens to generate in the completion. -1 lets the model decide.',
167
+ type: 'number',
168
+ typeOptions: {
169
+ maxValue: 131072,
170
+ },
171
+ },
172
+ {
173
+ displayName: 'Response Format',
174
+ name: 'responseFormat',
175
+ default: 'text',
176
+ type: 'options',
177
+ options: [
178
+ {
179
+ name: 'Text',
180
+ value: 'text',
181
+ description: 'Regular text response',
182
+ },
183
+ {
184
+ name: 'JSON',
185
+ value: 'json_object',
186
+ description: 'Enables JSON mode, which should guarantee the message the model generates is valid JSON',
187
+ },
188
+ ],
189
+ },
190
+ {
191
+ displayName: 'Presence Penalty',
192
+ name: 'presencePenalty',
193
+ default: 0,
194
+ typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
195
+ description: "Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. Ignored while reasoning_effort is active.",
196
+ type: 'number',
197
+ },
198
+ {
199
+ displayName: 'Sampling Temperature',
200
+ name: 'temperature',
201
+ default: 0.7,
202
+ typeOptions: { maxValue: 2, minValue: 0, numberPrecision: 1 },
203
+ description: 'Controls randomness: lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',
204
+ type: 'number',
205
+ },
206
+ {
207
+ displayName: 'Timeout',
208
+ name: 'timeout',
209
+ default: 360000,
210
+ description: 'Maximum amount of time a request is allowed to take in milliseconds',
211
+ type: 'number',
212
+ },
213
+ {
214
+ displayName: 'Max Retries',
215
+ name: 'maxRetries',
216
+ default: 2,
217
+ description: 'Maximum number of retries to attempt',
218
+ type: 'number',
219
+ },
220
+ {
221
+ displayName: 'Top P',
222
+ name: 'topP',
223
+ default: 1,
224
+ typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
225
+ description: 'Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered. We generally recommend altering this or temperature but not both.',
226
+ type: 'number',
227
+ },
228
+ ],
229
+ },
230
+ ],
231
+ };
232
+ async supplyData(itemIndex) {
233
+ const credentials = await this.getCredentials('xAiGrokApi');
234
+ const modelName = this.getNodeParameter('model', itemIndex);
235
+ const reasoningEffort = this.getNodeParameter('reasoningEffort', itemIndex, 'low');
236
+ const options = this.getNodeParameter('options', itemIndex, {});
237
+ const baseURL = credentials.url || 'https://api.x.ai/v1';
238
+ const timeout = options.timeout ?? 360000;
239
+ const configuration = {
240
+ baseURL,
241
+ };
242
+ // When reasoning is active, xAI rejects frequency/presence penalties and `stop`.
243
+ // So only forward those penalties when reasoning_effort is "none".
244
+ const reasoningActive = reasoningEffort !== 'none';
245
+ const modelKwargs = {
246
+ // xAI's OpenAI-compatible endpoint errors on `stream_options`; suppress it
247
+ // (same fix the built-in n8n Grok node applies).
248
+ stream_options: undefined,
249
+ // The headline feature: send xAI's reasoning_effort parameter.
250
+ reasoning_effort: reasoningEffort,
251
+ };
252
+ if (options.responseFormat) {
253
+ modelKwargs.response_format = { type: options.responseFormat };
254
+ }
255
+ const model = new openai_1.ChatOpenAI({
256
+ apiKey: credentials.apiKey,
257
+ model: modelName,
258
+ maxTokens: options.maxTokens === -1 ? undefined : options.maxTokens,
259
+ temperature: reasoningActive ? undefined : options.temperature,
260
+ topP: options.topP,
261
+ frequencyPenalty: reasoningActive ? undefined : options.frequencyPenalty,
262
+ presencePenalty: reasoningActive ? undefined : options.presencePenalty,
263
+ timeout,
264
+ maxRetries: options.maxRetries ?? 2,
265
+ configuration,
266
+ modelKwargs,
267
+ });
268
+ return {
269
+ response: model,
270
+ };
271
+ }
272
+ }
273
+ exports.XAiGrok = XAiGrok;
274
+ //# sourceMappingURL=XAiGrok.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XAiGrok.node.js","sourceRoot":"","sources":["../../../nodes/XAiGrok/XAiGrok.node.ts"],"names":[],"mappings":";;;AAAA,8CAAmE;AACnE,+CAMsB;AAEtB;;;;;;;;;;;;;GAaG;AACH,MAAa,OAAO;IACnB,WAAW,GAAyB;QACnC,WAAW,EAAE,wCAAwC;QACrD,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,wGAAwG;QACrH,QAAQ,EAAE;YACT,IAAI,EAAE,qBAAqB;SAC3B;QACD,KAAK,EAAE;YACN,UAAU,EAAE,CAAC,IAAI,CAAC;YAClB,aAAa,EAAE;gBACd,EAAE,EAAE,CAAC,iBAAiB,EAAE,YAAY,CAAC;gBACrC,iBAAiB,EAAE,CAAC,2BAA2B,CAAC;aAChD;YACD,SAAS,EAAE;gBACV,oBAAoB,EAAE;oBACrB;wBACC,GAAG,EAAE,gE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AC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW;YAC9D,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB;YACxE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe;YACtE,OAAO;YACP,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC;YACnC,aAAa;YACb,WAAW;SACX,CAAC,CAAC;QAEH,OAAO;YACN,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC;CACD;AA/RD,0BA+RC"}
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <rect width="64" height="64" rx="12" fill="#000000"/>
3
+ <path fill="#ffffff" d="M20.5 14h7.2l8.1 11.5L44.7 14h6.8L39.3 31.3 52 50h-7.2l-8.9-12.7L26.9 50H20l13.1-18.8L20.5 14z"/>
4
+ </svg>
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // n8n loads nodes/credentials via the "n8n" field in package.json.
2
+ // This file exists only to satisfy the "main" entry.
3
+ module.exports = {};
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "n8n-nodes-grok-reasoning",
3
+ "version": "0.1.0",
4
+ "description": "n8n community node: xAI Grok Chat Model with the reasoning_effort parameter (none/low/medium/high). A faithful clone of n8n's built-in xAI Grok node, plus a Reasoning Effort control. Connect this as the Chat Model sub-node to your AI Agent.",
5
+ "license": "MIT",
6
+ "homepage": "https://www.npmjs.com/package/n8n-nodes-grok-reasoning",
7
+ "keywords": [
8
+ "n8n-community-node-package",
9
+ "n8n",
10
+ "grok",
11
+ "xai",
12
+ "x.ai",
13
+ "grok-4",
14
+ "reasoning",
15
+ "reasoning-effort",
16
+ "ai-agent",
17
+ "chat-model",
18
+ "langchain"
19
+ ],
20
+ "author": {
21
+ "name": "adcom"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://www.npmjs.com/package/n8n-nodes-grok-reasoning"
26
+ },
27
+ "main": "index.js",
28
+ "scripts": {
29
+ "build": "tsc && gulp build:icons",
30
+ "dev": "tsc --watch",
31
+ "format": "prettier nodes credentials --write",
32
+ "lint": "eslint nodes credentials package.json",
33
+ "lintfix": "eslint nodes credentials package.json --fix",
34
+ "prepublishOnly": "npm run build"
35
+ },
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "n8n": {
40
+ "n8nNodesApiVersion": 1,
41
+ "credentials": [
42
+ "dist/credentials/XAiGrokApi.credentials.js"
43
+ ],
44
+ "nodes": [
45
+ "dist/nodes/XAiGrok/XAiGrok.node.js"
46
+ ]
47
+ },
48
+ "devDependencies": {
49
+ "@langchain/core": "^1.1.48",
50
+ "@langchain/openai": "^1.0.0",
51
+ "@types/node": "^20.19.32",
52
+ "gulp": "^4.0.2",
53
+ "n8n-workflow": "*",
54
+ "prettier": "^3.3.2",
55
+ "typescript": "^5.5.3"
56
+ },
57
+ "peerDependencies": {
58
+ "@langchain/core": ">=0.2.0",
59
+ "@langchain/openai": ">=0.3.0",
60
+ "n8n-workflow": "*"
61
+ }
62
+ }