n8n-nodes-claude-pro 1.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/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/credentials/ClaudeProApi.credentials.d.ts +9 -0
- package/dist/credentials/ClaudeProApi.credentials.js +40 -0
- package/dist/credentials/ClaudeProApi.credentials.js.map +1 -0
- package/dist/nodes/ClaudePro/ClaudePro.node.d.ts +5 -0
- package/dist/nodes/ClaudePro/ClaudePro.node.js +326 -0
- package/dist/nodes/ClaudePro/ClaudePro.node.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 chynten
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# n8n-nodes-claude-pro
|
|
2
|
+
|
|
3
|
+
An n8n community node for calling Claude (Anthropic) using a **setup-token** for authentication. No Claude CLI installation required on the n8n server.
|
|
4
|
+
|
|
5
|
+
## Why this node?
|
|
6
|
+
|
|
7
|
+
Existing n8n community nodes for Claude require the Claude Code CLI installed on the server and use browser-based OAuth. This doesn't work for hosted/remote n8n instances where you can't run `claude login` interactively.
|
|
8
|
+
|
|
9
|
+
This node uses a different approach: generate a setup-token on your local machine, paste it into n8n credentials, and the node calls the Claude API directly with Bearer auth.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
1. Install the [Claude CLI](https://docs.anthropic.com/en/docs/claude-code/overview) on your **local machine**
|
|
14
|
+
2. Log in: `claude login`
|
|
15
|
+
3. Generate a setup token: `claude setup-token`
|
|
16
|
+
4. Copy the token output
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### Community Nodes (recommended)
|
|
21
|
+
|
|
22
|
+
1. Go to **Settings > Community Nodes** in your n8n instance
|
|
23
|
+
2. Search for `n8n-nodes-claude-pro`
|
|
24
|
+
3. Install
|
|
25
|
+
|
|
26
|
+
### Manual Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cd ~/.n8n/custom
|
|
30
|
+
npm install n8n-nodes-claude-pro
|
|
31
|
+
# or link a local clone:
|
|
32
|
+
ln -s /path/to/claude-pro-node ~/.n8n/custom/node_modules/n8n-nodes-claude-pro
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Restart n8n after installation.
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
### Credentials
|
|
40
|
+
|
|
41
|
+
1. In n8n, go to **Credentials > New Credential**
|
|
42
|
+
2. Search for "Claude Pro Setup Token"
|
|
43
|
+
3. Paste your setup token from `claude setup-token`
|
|
44
|
+
4. Click **Test** to verify the token works
|
|
45
|
+
|
|
46
|
+
### Node Parameters
|
|
47
|
+
|
|
48
|
+
| Parameter | Default | Description |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| Model | Claude Sonnet 4 | Choose between Opus 4, Sonnet 4, Haiku 3.5 |
|
|
51
|
+
| Prompt | — | The message to send (required). Supports expressions. |
|
|
52
|
+
| System Prompt | empty | Optional system-level instructions |
|
|
53
|
+
| Max Tokens | 4096 | Maximum response length (1–128,000) |
|
|
54
|
+
| Temperature | 1.0 | Randomness control (0.0–2.0) |
|
|
55
|
+
| Streaming | false | Use SSE streaming (collected before output) |
|
|
56
|
+
| Extended Thinking | false | Enable chain-of-thought reasoning |
|
|
57
|
+
| Thinking Budget | 10000 | Token budget for thinking (shown when thinking enabled) |
|
|
58
|
+
|
|
59
|
+
### Output
|
|
60
|
+
|
|
61
|
+
Each item returns:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"text": "Claude's response",
|
|
66
|
+
"thinking": "Chain-of-thought (if extended thinking enabled)",
|
|
67
|
+
"model": "claude-sonnet-4-20250514",
|
|
68
|
+
"stopReason": "end_turn",
|
|
69
|
+
"usage": {
|
|
70
|
+
"inputTokens": 25,
|
|
71
|
+
"outputTokens": 150
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Error Handling
|
|
77
|
+
|
|
78
|
+
The node provides clear error messages:
|
|
79
|
+
|
|
80
|
+
- **401**: Setup token is invalid or expired. Run `claude setup-token` again.
|
|
81
|
+
- **403**: Token does not have permission for the selected model.
|
|
82
|
+
- **429**: Rate limited. Retry after a delay.
|
|
83
|
+
- **400**: Forwards the Anthropic error message.
|
|
84
|
+
- **500/529**: Anthropic API error. Retry later.
|
|
85
|
+
|
|
86
|
+
Enable **Continue On Fail** in the node settings to receive errors as JSON output instead of stopping the workflow.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git clone <repo-url>
|
|
92
|
+
cd claude-pro-node
|
|
93
|
+
npm install
|
|
94
|
+
npm run build
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To test locally with n8n:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ln -s $(pwd) ~/.n8n/custom/node_modules/n8n-nodes-claude-pro
|
|
101
|
+
# restart n8n
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ClaudeProApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClaudeProApi = void 0;
|
|
4
|
+
class ClaudeProApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'claudeProApi';
|
|
7
|
+
this.displayName = 'Claude Pro Setup Token';
|
|
8
|
+
this.documentationUrl = 'https://docs.anthropic.com/en/docs/claude-code/cli-reference#claude-setup-token';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Setup Token',
|
|
12
|
+
name: 'setupToken',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: { password: true },
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'Token generated by running "claude setup-token" on a machine with Claude CLI installed',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
this.authenticate = {
|
|
21
|
+
type: 'generic',
|
|
22
|
+
properties: {
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: '=Bearer {{$credentials.setupToken}}',
|
|
25
|
+
'anthropic-version': '2023-06-01',
|
|
26
|
+
'content-type': 'application/json',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
this.test = {
|
|
31
|
+
request: {
|
|
32
|
+
baseURL: 'https://api.anthropic.com',
|
|
33
|
+
url: '/v1/models',
|
|
34
|
+
method: 'GET',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ClaudeProApi = ClaudeProApi;
|
|
40
|
+
//# sourceMappingURL=ClaudeProApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeProApi.credentials.js","sourceRoot":"","sources":["../../credentials/ClaudeProApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IAAzB;QACE,SAAI,GAAG,cAAc,CAAC;QACtB,gBAAW,GAAG,wBAAwB,CAAC;QACvC,qBAAgB,GAAG,iFAAiF,CAAC;QAErG,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,wFAAwF;aAC3F;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,qCAAqC;oBACpD,mBAAmB,EAAE,YAAY;oBACjC,cAAc,EAAE,kBAAkB;iBACnC;aACF;SACF,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,YAAY;gBACjB,MAAM,EAAE,KAAK;aACd;SACF,CAAC;IACJ,CAAC;CAAA;AApCD,oCAoCC"}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClaudePro = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
function formatApiError(error) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const statusCode = error.httpCode || error.statusCode || error.code;
|
|
9
|
+
if (statusCode === 401) {
|
|
10
|
+
return 'Setup token is invalid or expired. Run `claude setup-token` again.';
|
|
11
|
+
}
|
|
12
|
+
if (statusCode === 403) {
|
|
13
|
+
return 'Token does not have permission for this model.';
|
|
14
|
+
}
|
|
15
|
+
if (statusCode === 429) {
|
|
16
|
+
return 'Rate limited by Anthropic API. Retry after a delay.';
|
|
17
|
+
}
|
|
18
|
+
if (statusCode === 529 || statusCode === 500) {
|
|
19
|
+
return 'Anthropic API error. Retry later.';
|
|
20
|
+
}
|
|
21
|
+
if (statusCode === 400) {
|
|
22
|
+
const msg = error.message || ((_b = (_a = error.body) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) || 'Bad request';
|
|
23
|
+
return `Anthropic API error: ${msg}`;
|
|
24
|
+
}
|
|
25
|
+
return error.message || 'Unknown error occurred';
|
|
26
|
+
}
|
|
27
|
+
function parseSSE(raw, fallbackModel) {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
|
+
const lines = raw.split('\n');
|
|
30
|
+
let text = '';
|
|
31
|
+
let thinking = '';
|
|
32
|
+
let model = fallbackModel;
|
|
33
|
+
let stopReason = '';
|
|
34
|
+
let inputTokens = 0;
|
|
35
|
+
let outputTokens = 0;
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
if (!line.startsWith('data: '))
|
|
38
|
+
continue;
|
|
39
|
+
const data = line.slice(6).trim();
|
|
40
|
+
if (data === '[DONE]')
|
|
41
|
+
break;
|
|
42
|
+
let event;
|
|
43
|
+
try {
|
|
44
|
+
event = JSON.parse(data);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
switch (event.type) {
|
|
50
|
+
case 'message_start':
|
|
51
|
+
if ((_a = event.message) === null || _a === void 0 ? void 0 : _a.model)
|
|
52
|
+
model = event.message.model;
|
|
53
|
+
if ((_c = (_b = event.message) === null || _b === void 0 ? void 0 : _b.usage) === null || _c === void 0 ? void 0 : _c.input_tokens) {
|
|
54
|
+
inputTokens = event.message.usage.input_tokens;
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case 'content_block_delta':
|
|
58
|
+
if (((_d = event.delta) === null || _d === void 0 ? void 0 : _d.type) === 'text_delta') {
|
|
59
|
+
text += event.delta.text || '';
|
|
60
|
+
}
|
|
61
|
+
else if (((_e = event.delta) === null || _e === void 0 ? void 0 : _e.type) === 'thinking_delta') {
|
|
62
|
+
thinking += event.delta.thinking || '';
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 'message_delta':
|
|
66
|
+
if ((_f = event.delta) === null || _f === void 0 ? void 0 : _f.stop_reason)
|
|
67
|
+
stopReason = event.delta.stop_reason;
|
|
68
|
+
if ((_g = event.usage) === null || _g === void 0 ? void 0 : _g.output_tokens)
|
|
69
|
+
outputTokens = event.usage.output_tokens;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
text,
|
|
75
|
+
thinking,
|
|
76
|
+
model,
|
|
77
|
+
stopReason,
|
|
78
|
+
usage: { inputTokens, outputTokens },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async function executeStreamingFallback(context,
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
body) {
|
|
84
|
+
const https = require('https');
|
|
85
|
+
const credentials = await context.getCredentials('claudeProApi');
|
|
86
|
+
const token = credentials.setupToken;
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
const postData = JSON.stringify(body);
|
|
89
|
+
const options = {
|
|
90
|
+
hostname: 'api.anthropic.com',
|
|
91
|
+
path: '/v1/messages',
|
|
92
|
+
method: 'POST',
|
|
93
|
+
headers: {
|
|
94
|
+
Authorization: `Bearer ${token}`,
|
|
95
|
+
'anthropic-version': '2023-06-01',
|
|
96
|
+
'content-type': 'application/json',
|
|
97
|
+
'content-length': Buffer.byteLength(postData),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
+
const req = https.request(options, (res) => {
|
|
102
|
+
let rawData = '';
|
|
103
|
+
res.on('data', (chunk) => {
|
|
104
|
+
rawData += chunk.toString();
|
|
105
|
+
});
|
|
106
|
+
res.on('end', () => {
|
|
107
|
+
if (res.statusCode && res.statusCode >= 400) {
|
|
108
|
+
const error = new Error(`HTTP ${res.statusCode}: ${rawData}`);
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
+
error.statusCode = res.statusCode;
|
|
111
|
+
reject(error);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const parsed = parseSSE(rawData, body.model);
|
|
115
|
+
resolve({ json: { ...parsed } });
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
req.on('error', (error) => reject(error));
|
|
120
|
+
req.write(postData);
|
|
121
|
+
req.end();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
class ClaudePro {
|
|
125
|
+
constructor() {
|
|
126
|
+
this.description = {
|
|
127
|
+
displayName: 'Claude Pro',
|
|
128
|
+
name: 'claudePro',
|
|
129
|
+
icon: 'file:claude-pro.svg',
|
|
130
|
+
group: ['transform'],
|
|
131
|
+
version: 1,
|
|
132
|
+
subtitle: '={{$parameter["model"]}}',
|
|
133
|
+
description: 'Send messages to Claude via setup-token authentication. No CLI required.',
|
|
134
|
+
defaults: {
|
|
135
|
+
name: 'Claude Pro',
|
|
136
|
+
},
|
|
137
|
+
inputs: ['main'],
|
|
138
|
+
outputs: ['main'],
|
|
139
|
+
credentials: [
|
|
140
|
+
{
|
|
141
|
+
name: 'claudeProApi',
|
|
142
|
+
required: true,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
properties: [
|
|
146
|
+
{
|
|
147
|
+
displayName: 'Model',
|
|
148
|
+
name: 'model',
|
|
149
|
+
type: 'options',
|
|
150
|
+
options: [
|
|
151
|
+
{ name: 'Claude Opus 4', value: 'claude-opus-4-0-20250514' },
|
|
152
|
+
{ name: 'Claude Sonnet 4', value: 'claude-sonnet-4-20250514' },
|
|
153
|
+
{ name: 'Claude Haiku 3.5', value: 'claude-3-5-haiku-20241022' },
|
|
154
|
+
],
|
|
155
|
+
default: 'claude-sonnet-4-20250514',
|
|
156
|
+
description: 'The Claude model to use',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Prompt',
|
|
160
|
+
name: 'prompt',
|
|
161
|
+
type: 'string',
|
|
162
|
+
typeOptions: { rows: 6 },
|
|
163
|
+
default: '',
|
|
164
|
+
required: true,
|
|
165
|
+
description: 'The message to send to Claude. Supports n8n expressions.',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: 'System Prompt',
|
|
169
|
+
name: 'systemPrompt',
|
|
170
|
+
type: 'string',
|
|
171
|
+
typeOptions: { rows: 4 },
|
|
172
|
+
default: '',
|
|
173
|
+
description: 'Optional system prompt to set context for Claude',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Max Tokens',
|
|
177
|
+
name: 'maxTokens',
|
|
178
|
+
type: 'number',
|
|
179
|
+
typeOptions: { minValue: 1, maxValue: 128000 },
|
|
180
|
+
default: 4096,
|
|
181
|
+
description: 'Maximum number of tokens in the response',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Temperature',
|
|
185
|
+
name: 'temperature',
|
|
186
|
+
type: 'number',
|
|
187
|
+
typeOptions: { minValue: 0, maxValue: 2, numberPrecision: 1 },
|
|
188
|
+
default: 1.0,
|
|
189
|
+
description: 'Controls randomness. Lower values are more deterministic.',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
displayName: 'Streaming',
|
|
193
|
+
name: 'streaming',
|
|
194
|
+
type: 'boolean',
|
|
195
|
+
default: false,
|
|
196
|
+
description: 'Whether to use SSE streaming. Response is still collected fully before output.',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
displayName: 'Extended Thinking',
|
|
200
|
+
name: 'extendedThinking',
|
|
201
|
+
type: 'boolean',
|
|
202
|
+
default: false,
|
|
203
|
+
description: 'Whether to enable chain-of-thought reasoning',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
displayName: 'Thinking Budget',
|
|
207
|
+
name: 'thinkingBudget',
|
|
208
|
+
type: 'number',
|
|
209
|
+
typeOptions: { minValue: 1024, maxValue: 128000 },
|
|
210
|
+
default: 10000,
|
|
211
|
+
displayOptions: {
|
|
212
|
+
show: {
|
|
213
|
+
extendedThinking: [true],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
description: 'Max tokens for the thinking process',
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
async execute() {
|
|
222
|
+
const items = this.getInputData();
|
|
223
|
+
const returnData = [];
|
|
224
|
+
for (let i = 0; i < items.length; i++) {
|
|
225
|
+
try {
|
|
226
|
+
const model = this.getNodeParameter('model', i);
|
|
227
|
+
const prompt = this.getNodeParameter('prompt', i);
|
|
228
|
+
const systemPrompt = this.getNodeParameter('systemPrompt', i, '');
|
|
229
|
+
const maxTokens = this.getNodeParameter('maxTokens', i, 4096);
|
|
230
|
+
const temperature = this.getNodeParameter('temperature', i, 1.0);
|
|
231
|
+
const streaming = this.getNodeParameter('streaming', i, false);
|
|
232
|
+
const extendedThinking = this.getNodeParameter('extendedThinking', i, false);
|
|
233
|
+
const thinkingBudget = extendedThinking
|
|
234
|
+
? this.getNodeParameter('thinkingBudget', i, 10000)
|
|
235
|
+
: undefined;
|
|
236
|
+
if (!prompt.trim()) {
|
|
237
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Prompt cannot be empty', {
|
|
238
|
+
itemIndex: i,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
242
|
+
const body = {
|
|
243
|
+
model,
|
|
244
|
+
max_tokens: maxTokens,
|
|
245
|
+
messages: [{ role: 'user', content: prompt }],
|
|
246
|
+
stream: streaming,
|
|
247
|
+
};
|
|
248
|
+
if (systemPrompt.trim()) {
|
|
249
|
+
body.system = systemPrompt;
|
|
250
|
+
}
|
|
251
|
+
if (extendedThinking && thinkingBudget) {
|
|
252
|
+
body.thinking = {
|
|
253
|
+
type: 'enabled',
|
|
254
|
+
budget_tokens: thinkingBudget,
|
|
255
|
+
};
|
|
256
|
+
// Temperature must be 1 when extended thinking is enabled
|
|
257
|
+
body.temperature = 1;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
body.temperature = temperature;
|
|
261
|
+
}
|
|
262
|
+
let result;
|
|
263
|
+
if (streaming) {
|
|
264
|
+
try {
|
|
265
|
+
const response = await this.helpers.httpRequest({
|
|
266
|
+
method: 'POST',
|
|
267
|
+
url: 'https://api.anthropic.com/v1/messages',
|
|
268
|
+
body,
|
|
269
|
+
returnFullResponse: true,
|
|
270
|
+
encoding: 'text',
|
|
271
|
+
json: false,
|
|
272
|
+
headers: {
|
|
273
|
+
'content-type': 'application/json',
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
const rawBody = typeof response.body === 'string' ? response.body : JSON.stringify(response.body);
|
|
277
|
+
const parsed = parseSSE(rawBody, model);
|
|
278
|
+
result = { json: { ...parsed } };
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
// Fallback: use native https for SSE if n8n helpers don't handle it
|
|
282
|
+
result = await executeStreamingFallback(this, body);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
const response = (await this.helpers.httpRequest({
|
|
287
|
+
method: 'POST',
|
|
288
|
+
url: 'https://api.anthropic.com/v1/messages',
|
|
289
|
+
body,
|
|
290
|
+
}));
|
|
291
|
+
const textBlocks = response.content.filter((b) => b.type === 'text');
|
|
292
|
+
const thinkingBlocks = response.content.filter((b) => b.type === 'thinking');
|
|
293
|
+
result = {
|
|
294
|
+
json: {
|
|
295
|
+
text: textBlocks.map((b) => b.text || '').join(''),
|
|
296
|
+
thinking: thinkingBlocks.map((b) => b.text || '').join(''),
|
|
297
|
+
model: response.model,
|
|
298
|
+
stopReason: response.stop_reason,
|
|
299
|
+
usage: {
|
|
300
|
+
inputTokens: response.usage.input_tokens,
|
|
301
|
+
outputTokens: response.usage.output_tokens,
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
returnData.push(result);
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
if (this.continueOnFail()) {
|
|
310
|
+
returnData.push({
|
|
311
|
+
json: { error: formatApiError(error) },
|
|
312
|
+
pairedItem: { item: i },
|
|
313
|
+
});
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), formatApiError(error), { itemIndex: i });
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return [returnData];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
exports.ClaudePro = ClaudePro;
|
|
326
|
+
//# sourceMappingUR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;AAlND,8BAkNC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-claude-pro",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "n8n node for Claude Pro via setup-token authentication. No CLI required on the server.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"claude",
|
|
9
|
+
"anthropic",
|
|
10
|
+
"ai",
|
|
11
|
+
"llm"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Claude Pro Node Contributors"
|
|
16
|
+
},
|
|
17
|
+
"main": "dist/nodes/ClaudePro/ClaudePro.node.js",
|
|
18
|
+
"n8n": {
|
|
19
|
+
"n8nNodesApiVersion": 1,
|
|
20
|
+
"nodes": [
|
|
21
|
+
"dist/nodes/ClaudePro/ClaudePro.node.js"
|
|
22
|
+
],
|
|
23
|
+
"credentials": [
|
|
24
|
+
"dist/credentials/ClaudeProApi.credentials.js"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"dev": "tsc --watch",
|
|
30
|
+
"lint": "eslint . --ext .ts",
|
|
31
|
+
"lint:fix": "eslint . --ext .ts --fix"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"n8n-workflow": "*"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"n8n-core": "^1.70.0",
|
|
41
|
+
"n8n-workflow": "^1.70.0",
|
|
42
|
+
"typescript": "^5.7.0",
|
|
43
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
45
|
+
"eslint": "^8.57.0",
|
|
46
|
+
"prettier": "^3.4.0"
|
|
47
|
+
}
|
|
48
|
+
}
|