n8n-nodes-vercel-ai-sdk-universal-temp 0.1.2 → 0.1.4
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/dist/credentials/DeepSeekApi.credentials.js +12 -3
- package/dist/credentials/DeepSeekApi.credentials.js.map +1 -1
- package/dist/credentials/GoogleGenerativeAIApi.credentials.js +12 -3
- package/dist/credentials/GoogleGenerativeAIApi.credentials.js.map +1 -1
- package/dist/credentials/GroqApi.credentials.js +12 -3
- package/dist/credentials/GroqApi.credentials.js.map +1 -1
- package/dist/credentials/OpenAiApi.credentials.js +11 -2
- package/dist/credentials/OpenAiApi.credentials.js.map +1 -1
- package/dist/credentials/OpenRouterApi.credentials.js +11 -2
- package/dist/credentials/OpenRouterApi.credentials.js.map +1 -1
- package/dist/nodes/UniversalAI/UniversalAI.node.js +56 -207
- package/dist/nodes/UniversalAI/UniversalAI.node.js.map +1 -1
- package/dist/nodes/UniversalAI/model-lists.d.ts +55 -0
- package/dist/nodes/UniversalAI/model-lists.js +218 -0
- package/dist/nodes/UniversalAI/model-lists.js.map +1 -0
- package/dist/nodes/UniversalEmbedding/UniversalEmbedding.node.js +17 -52
- package/dist/nodes/UniversalEmbedding/UniversalEmbedding.node.js.map +1 -1
- package/dist/nodes/UniversalImageGen/UniversalImageGen.node.js +17 -47
- package/dist/nodes/UniversalImageGen/UniversalImageGen.node.js.map +1 -1
- package/dist/nodes/UniversalSpeechGen/UniversalSpeechGen.node.js +0 -9
- package/dist/nodes/UniversalSpeechGen/UniversalSpeechGen.node.js.map +1 -1
- package/dist/nodes/UniversalTranscription/UniversalTranscription.node.js +0 -9
- package/dist/nodes/UniversalTranscription/UniversalTranscription.node.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -13,7 +13,16 @@ class DeepSeekApi {
|
|
13
13
|
type: 'string',
|
14
14
|
typeOptions: { password: true },
|
15
15
|
default: '',
|
16
|
-
required:
|
16
|
+
required: false,
|
17
|
+
description: 'Your DeepSeek API key',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
displayName: 'Base URL',
|
21
|
+
name: 'baseUrl',
|
22
|
+
type: 'string',
|
23
|
+
default: 'https://api.deepseek.com',
|
24
|
+
required: false,
|
25
|
+
description: 'Custom base URL for DeepSeek API',
|
17
26
|
},
|
18
27
|
];
|
19
28
|
this.authenticate = {
|
@@ -26,8 +35,8 @@ class DeepSeekApi {
|
|
26
35
|
};
|
27
36
|
this.test = {
|
28
37
|
request: {
|
29
|
-
baseURL: 'https://api.deepseek.com',
|
30
|
-
url: '/
|
38
|
+
baseURL: '={{$credentials.baseUrl || "https://api.deepseek.com"}}',
|
39
|
+
url: '/models',
|
31
40
|
method: 'GET',
|
32
41
|
},
|
33
42
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DeepSeekApi.credentials.js","sourceRoot":"","sources":["../../credentials/DeepSeekApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACI,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,oCAAoC,CAAC;QACxD,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;
|
1
|
+
{"version":3,"file":"DeepSeekApi.credentials.js","sourceRoot":"","sources":["../../credentials/DeepSeekApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACI,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,oCAAoC,CAAC;QACxD,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,uBAAuB;aACvC;YACD;gBACI,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,0BAA0B;gBACnC,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,kCAAkC;aAClD;SACJ,CAAC;QAEF,iBAAY,GAAyB;YACjC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACR,OAAO,EAAE;oBACL,aAAa,EAAE,iCAAiC;iBACnD;aACJ;SACJ,CAAC;QAEF,SAAI,GAA2B;YAC3B,OAAO,EAAE;gBACL,OAAO,EAAE,yDAAyD;gBAClE,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aAChB;SACJ,CAAC;IACN,CAAC;CAAA;AAxCD,kCAwCC"}
|
@@ -13,7 +13,16 @@ class GoogleGenerativeAIApi {
|
|
13
13
|
type: 'string',
|
14
14
|
typeOptions: { password: true },
|
15
15
|
default: '',
|
16
|
-
required:
|
16
|
+
required: false,
|
17
|
+
description: 'Your Google Generative AI API key',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
displayName: 'Base URL',
|
21
|
+
name: 'baseUrl',
|
22
|
+
type: 'string',
|
23
|
+
default: 'https://generativelanguage.googleapis.com/v1beta',
|
24
|
+
required: false,
|
25
|
+
description: 'Custom base URL for Google Generative AI API',
|
17
26
|
},
|
18
27
|
];
|
19
28
|
this.authenticate = {
|
@@ -26,8 +35,8 @@ class GoogleGenerativeAIApi {
|
|
26
35
|
};
|
27
36
|
this.test = {
|
28
37
|
request: {
|
29
|
-
baseURL: 'https://generativelanguage.googleapis.com',
|
30
|
-
url: '/
|
38
|
+
baseURL: '={{$credentials.baseUrl || "https://generativelanguage.googleapis.com/v1beta"}}',
|
39
|
+
url: '/models',
|
31
40
|
method: 'GET',
|
32
41
|
},
|
33
42
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GoogleGenerativeAIApi.credentials.js","sourceRoot":"","sources":["../../credentials/GoogleGenerativeAIApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,qBAAqB;IAAlC;QACC,SAAI,GAAG,uBAAuB,CAAC;QAC/B,gBAAW,GAAG,0BAA0B,CAAC;QACzC,qBAAgB,GAAG,4BAA4B,CAAC;QAChD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;
|
1
|
+
{"version":3,"file":"GoogleGenerativeAIApi.credentials.js","sourceRoot":"","sources":["../../credentials/GoogleGenerativeAIApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,qBAAqB;IAAlC;QACC,SAAI,GAAG,uBAAuB,CAAC;QAC/B,gBAAW,GAAG,0BAA0B,CAAC;QACzC,qBAAgB,GAAG,4BAA4B,CAAC;QAChD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,mCAAmC;aAChD;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,kDAAkD;gBAC3D,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,8CAA8C;aAC3D;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,gBAAgB,EAAE,0BAA0B;iBAC5C;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,iFAAiF;gBAC1F,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAxCD,sDAwCC"}
|
@@ -13,7 +13,16 @@ class GroqApi {
|
|
13
13
|
type: 'string',
|
14
14
|
typeOptions: { password: true },
|
15
15
|
default: '',
|
16
|
-
required:
|
16
|
+
required: false,
|
17
|
+
description: 'Your Groq API key',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
displayName: 'Base URL',
|
21
|
+
name: 'baseUrl',
|
22
|
+
type: 'string',
|
23
|
+
default: 'https://api.groq.com/openai/v1',
|
24
|
+
required: false,
|
25
|
+
description: 'Custom base URL for Groq API',
|
17
26
|
},
|
18
27
|
];
|
19
28
|
this.authenticate = {
|
@@ -26,8 +35,8 @@ class GroqApi {
|
|
26
35
|
};
|
27
36
|
this.test = {
|
28
37
|
request: {
|
29
|
-
baseURL: 'https://api.groq.com',
|
30
|
-
url: '/
|
38
|
+
baseURL: '={{$credentials.baseUrl || "https://api.groq.com/openai/v1"}}',
|
39
|
+
url: '/models',
|
31
40
|
method: 'GET',
|
32
41
|
},
|
33
42
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GroqApi.credentials.js","sourceRoot":"","sources":["../../credentials/GroqApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACI,SAAI,GAAG,SAAS,CAAC;QACjB,gBAAW,GAAG,UAAU,CAAC;QACzB,qBAAgB,GAAG,sCAAsC,CAAC;QAC1D,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;
|
1
|
+
{"version":3,"file":"GroqApi.credentials.js","sourceRoot":"","sources":["../../credentials/GroqApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACI,SAAI,GAAG,SAAS,CAAC;QACjB,gBAAW,GAAG,UAAU,CAAC;QACzB,qBAAgB,GAAG,sCAAsC,CAAC;QAC1D,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,mBAAmB;aACnC;YACD;gBACI,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,gCAAgC;gBACzC,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,8BAA8B;aAC9C;SACJ,CAAC;QAEF,iBAAY,GAAyB;YACjC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACR,OAAO,EAAE;oBACL,aAAa,EAAE,iCAAiC;iBACnD;aACJ;SACJ,CAAC;QAEF,SAAI,GAA2B;YAC3B,OAAO,EAAE;gBACL,OAAO,EAAE,+DAA+D;gBACxE,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aAChB;SACJ,CAAC;IACN,CAAC;CAAA;AAxCD,0BAwCC"}
|
@@ -13,7 +13,16 @@ class OpenAiApi {
|
|
13
13
|
type: 'string',
|
14
14
|
typeOptions: { password: true },
|
15
15
|
default: '',
|
16
|
-
required:
|
16
|
+
required: false,
|
17
|
+
description: 'Your OpenAI API key',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
displayName: 'Base URL',
|
21
|
+
name: 'baseUrl',
|
22
|
+
type: 'string',
|
23
|
+
default: 'https://api.openai.com/v1',
|
24
|
+
required: false,
|
25
|
+
description: 'Custom base URL for OpenAI API',
|
17
26
|
},
|
18
27
|
];
|
19
28
|
this.authenticate = {
|
@@ -26,7 +35,7 @@ class OpenAiApi {
|
|
26
35
|
};
|
27
36
|
this.test = {
|
28
37
|
request: {
|
29
|
-
baseURL: 'https://api.openai.com/v1',
|
38
|
+
baseURL: '={{$credentials.baseUrl || "https://api.openai.com/v1"}}',
|
30
39
|
url: '/models',
|
31
40
|
method: 'GET',
|
32
41
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OpenAiApi.credentials.js","sourceRoot":"","sources":["../../credentials/OpenAiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,SAAS;IAAtB;QACC,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GAAG,gDAAgD,CAAC;QACpE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;
|
1
|
+
{"version":3,"file":"OpenAiApi.credentials.js","sourceRoot":"","sources":["../../credentials/OpenAiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,SAAS;IAAtB;QACC,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GAAG,gDAAgD,CAAC;QACpE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,qBAAqB;aAClC;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,gCAAgC;aAC7C;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,0DAA0D;gBACnE,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAxCD,8BAwCC"}
|
@@ -13,7 +13,16 @@ class OpenRouterApi {
|
|
13
13
|
type: 'string',
|
14
14
|
typeOptions: { password: true },
|
15
15
|
default: '',
|
16
|
-
required:
|
16
|
+
required: false,
|
17
|
+
description: 'Your OpenRouter API key',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
displayName: 'Base URL',
|
21
|
+
name: 'baseUrl',
|
22
|
+
type: 'string',
|
23
|
+
default: 'https://openrouter.ai/api/v1',
|
24
|
+
required: false,
|
25
|
+
description: 'Custom base URL for OpenRouter API',
|
17
26
|
},
|
18
27
|
];
|
19
28
|
this.authenticate = {
|
@@ -26,7 +35,7 @@ class OpenRouterApi {
|
|
26
35
|
};
|
27
36
|
this.test = {
|
28
37
|
request: {
|
29
|
-
baseURL: 'https://openrouter.ai/api/v1',
|
38
|
+
baseURL: '={{$credentials.baseUrl || "https://openrouter.ai/api/v1"}}',
|
30
39
|
url: '/models',
|
31
40
|
method: 'GET',
|
32
41
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OpenRouterApi.credentials.js","sourceRoot":"","sources":["../../credentials/OpenRouterApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,qBAAgB,GAAG,4BAA4B,CAAC;QAChD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;
|
1
|
+
{"version":3,"file":"OpenRouterApi.credentials.js","sourceRoot":"","sources":["../../credentials/OpenRouterApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,qBAAgB,GAAG,4BAA4B,CAAC;QAChD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,yBAAyB;aACtC;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,oCAAoC;aACjD;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,6DAA6D;gBACtE,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAxCD,sCAwCC"}
|
@@ -12,6 +12,7 @@ const { createOpenRouter } = require('@openrouter/ai-sdk-provider');
|
|
12
12
|
const ai_1 = require("ai");
|
13
13
|
const zod_1 = require("zod");
|
14
14
|
const ajv_1 = __importDefault(require("ajv"));
|
15
|
+
const model_lists_1 = require("./model-lists");
|
15
16
|
async function buildInput(exec, itemIndex) {
|
16
17
|
const inputType = exec.getNodeParameter('inputType', itemIndex);
|
17
18
|
if (inputType === 'prompt') {
|
@@ -114,7 +115,7 @@ async function buildInput(exec, itemIndex) {
|
|
114
115
|
}
|
115
116
|
}
|
116
117
|
function formatTextResult(result, includeRequestBody, provider) {
|
117
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
118
119
|
let text = result.text;
|
119
120
|
let reasoning = result.reasoning;
|
120
121
|
if (provider === 'groq' && text.includes('<think>')) {
|
@@ -127,9 +128,12 @@ function formatTextResult(result, includeRequestBody, provider) {
|
|
127
128
|
const out = {
|
128
129
|
text,
|
129
130
|
reasoning,
|
131
|
+
reasoningText: result.reasoningText,
|
130
132
|
toolCalls: result.toolCalls || [],
|
131
133
|
toolResults: result.toolResults || [],
|
132
134
|
finishReason: result.finishReason,
|
135
|
+
sources: result.sources || [],
|
136
|
+
files: result.files || [],
|
133
137
|
usage: {
|
134
138
|
promptTokens: (_a = result.usage) === null || _a === void 0 ? void 0 : _a.promptTokens,
|
135
139
|
completionTokens: (_b = result.usage) === null || _b === void 0 ? void 0 : _b.completionTokens,
|
@@ -146,19 +150,29 @@ function formatTextResult(result, includeRequestBody, provider) {
|
|
146
150
|
promptCacheMissTokens: (_l = (_k = result.experimental_providerMetadata) === null || _k === void 0 ? void 0 : _k.groq) === null || _l === void 0 ? void 0 : _l.promptCacheMissTokens,
|
147
151
|
},
|
148
152
|
}),
|
153
|
+
...(provider === 'google' && {
|
154
|
+
cacheMetrics: {
|
155
|
+
cachedContentTokenCount: (_p = (_o = (_m = result.experimental_providerMetadata) === null || _m === void 0 ? void 0 : _m.google) === null || _o === void 0 ? void 0 : _o.usageMetadata) === null || _p === void 0 ? void 0 : _p.cachedContentTokenCount,
|
156
|
+
thoughtsTokenCount: (_s = (_r = (_q = result.experimental_providerMetadata) === null || _q === void 0 ? void 0 : _q.google) === null || _r === void 0 ? void 0 : _r.usageMetadata) === null || _s === void 0 ? void 0 : _s.thoughtsTokenCount,
|
157
|
+
},
|
158
|
+
}),
|
149
159
|
},
|
150
160
|
response: {
|
151
|
-
id: (
|
152
|
-
modelId: (
|
153
|
-
timestamp: (
|
154
|
-
headers: (
|
161
|
+
id: (_t = result.response) === null || _t === void 0 ? void 0 : _t.id,
|
162
|
+
modelId: (_u = result.response) === null || _u === void 0 ? void 0 : _u.modelId,
|
163
|
+
timestamp: (_v = result.response) === null || _v === void 0 ? void 0 : _v.timestamp,
|
164
|
+
headers: (_w = result.response) === null || _w === void 0 ? void 0 : _w.headers,
|
155
165
|
},
|
156
166
|
steps: result.steps || [],
|
157
167
|
warnings: result.warnings || [],
|
158
168
|
experimental_providerMetadata: result.experimental_providerMetadata,
|
169
|
+
...(provider === 'google' && {
|
170
|
+
groundingMetadata: (_y = (_x = result.experimental_providerMetadata) === null || _x === void 0 ? void 0 : _x.google) === null || _y === void 0 ? void 0 : _y.groundingMetadata,
|
171
|
+
safetyRatings: (_0 = (_z = result.experimental_providerMetadata) === null || _z === void 0 ? void 0 : _z.google) === null || _0 === void 0 ? void 0 : _0.safetyRatings,
|
172
|
+
}),
|
159
173
|
};
|
160
174
|
if (includeRequestBody) {
|
161
|
-
out.request = { body: (
|
175
|
+
out.request = { body: (_1 = result.request) === null || _1 === void 0 ? void 0 : _1.body };
|
162
176
|
}
|
163
177
|
return out;
|
164
178
|
}
|
@@ -201,7 +215,12 @@ class UniversalAI {
|
|
201
215
|
},
|
202
216
|
inputs: [{ type: "main" }],
|
203
217
|
outputs: [{ type: "main" }],
|
204
|
-
credentials: [
|
218
|
+
credentials: [
|
219
|
+
{ name: "googleGenerativeAIApi", required: false, displayOptions: { show: { provider: ["google"] } } },
|
220
|
+
{ name: "deepSeekApi", required: false, displayOptions: { show: { provider: ["deepseek"] } } },
|
221
|
+
{ name: "groqApi", required: false, displayOptions: { show: { provider: ["groq"] } } },
|
222
|
+
{ name: "openRouterApi", required: false, displayOptions: { show: { provider: ["openrouter"] } } },
|
223
|
+
],
|
205
224
|
properties: [
|
206
225
|
{
|
207
226
|
displayName: 'Provider',
|
@@ -230,28 +249,6 @@ class UniversalAI {
|
|
230
249
|
default: 'google',
|
231
250
|
description: 'Choose which AI provider to use',
|
232
251
|
},
|
233
|
-
{
|
234
|
-
displayName: 'API Key',
|
235
|
-
name: 'apiKey',
|
236
|
-
type: 'string',
|
237
|
-
typeOptions: { password: true },
|
238
|
-
default: '',
|
239
|
-
required: false,
|
240
|
-
description: 'API key for the selected provider. Leave empty to use credentials.',
|
241
|
-
displayOptions: {
|
242
|
-
show: {
|
243
|
-
provider: ['google', 'deepseek', 'groq', 'openrouter'],
|
244
|
-
},
|
245
|
-
},
|
246
|
-
},
|
247
|
-
{
|
248
|
-
displayName: 'Base URL',
|
249
|
-
name: 'baseURL',
|
250
|
-
type: 'string',
|
251
|
-
default: `={{ $parameter.provider === 'google' ? 'https://generativelanguage.googleapis.com/v1beta' : $parameter.provider === 'deepseek' ? 'https://api.deepseek.com' : $parameter.provider === 'groq' ? 'https://api.groq.com' : $parameter.provider === 'openrouter' ? 'https://openrouter.ai/api/v1' : '' }}`,
|
252
|
-
required: false,
|
253
|
-
description: 'Base URL for the provider API. Defaults are set automatically based on the selected provider.',
|
254
|
-
},
|
255
252
|
{
|
256
253
|
displayName: 'Operation',
|
257
254
|
name: 'operation',
|
@@ -881,124 +878,16 @@ class UniversalAI {
|
|
881
878
|
try {
|
882
879
|
switch (provider) {
|
883
880
|
case 'google': {
|
884
|
-
|
885
|
-
const response = await this.helpers.request({
|
886
|
-
method: 'GET',
|
887
|
-
url: 'https://generativelanguage.googleapis.com/v1beta/models',
|
888
|
-
headers: {
|
889
|
-
'x-goog-api-key': credentials.apiKey,
|
890
|
-
},
|
891
|
-
json: true,
|
892
|
-
});
|
893
|
-
const returnData = [];
|
894
|
-
if (response.models) {
|
895
|
-
for (const model of response.models) {
|
896
|
-
if (model.name.includes('gemini')) {
|
897
|
-
const modelId = model.name.split('/').pop();
|
898
|
-
const displayName = model.displayName || modelId;
|
899
|
-
const version = modelId.includes('latest')
|
900
|
-
? '(Latest)'
|
901
|
-
: `(${model.version || 'v1'})`;
|
902
|
-
returnData.push({
|
903
|
-
name: `${displayName} ${version}`,
|
904
|
-
value: modelId,
|
905
|
-
description: model.description || '',
|
906
|
-
});
|
907
|
-
}
|
908
|
-
}
|
909
|
-
}
|
910
|
-
return returnData.sort((a, b) => a.name.localeCompare(b.name));
|
881
|
+
return model_lists_1.GOOGLE_GEMINI_MODELS;
|
911
882
|
}
|
912
883
|
case 'deepseek': {
|
913
|
-
return
|
914
|
-
{
|
915
|
-
name: 'DeepSeek Chat',
|
916
|
-
value: 'deepseek-chat',
|
917
|
-
description: 'DeepSeek chat model',
|
918
|
-
},
|
919
|
-
{
|
920
|
-
name: 'DeepSeek Coder',
|
921
|
-
value: 'deepseek-coder',
|
922
|
-
description: 'DeepSeek coding model',
|
923
|
-
},
|
924
|
-
];
|
884
|
+
return model_lists_1.DEEPSEEK_MODELS;
|
925
885
|
}
|
926
886
|
case 'groq': {
|
927
|
-
return
|
928
|
-
{
|
929
|
-
name: 'Llama 3.1 8B',
|
930
|
-
value: 'llama-3.1-8b-instant',
|
931
|
-
description: 'Fast and efficient 8B model',
|
932
|
-
},
|
933
|
-
{
|
934
|
-
name: 'Llama 3.1 70B',
|
935
|
-
value: 'llama-3.1-70b-versatile',
|
936
|
-
description: 'High-performance 70B model',
|
937
|
-
},
|
938
|
-
{
|
939
|
-
name: 'Llama 3.1 405B',
|
940
|
-
value: 'llama-3.1-405b-instruct',
|
941
|
-
description: 'Most capable Llama model',
|
942
|
-
},
|
943
|
-
{
|
944
|
-
name: 'Mixtral 8x7B',
|
945
|
-
value: 'mixtral-8x7b-32768',
|
946
|
-
description: 'Mixture of experts model',
|
947
|
-
},
|
948
|
-
{
|
949
|
-
name: 'Gemma 7B',
|
950
|
-
value: 'gemma-7b-it',
|
951
|
-
description: 'Google Gemma model',
|
952
|
-
},
|
953
|
-
];
|
887
|
+
return model_lists_1.GROQ_MODELS;
|
954
888
|
}
|
955
889
|
case 'openrouter': {
|
956
|
-
|
957
|
-
const credentials = await this.getCredentials('openRouterApi');
|
958
|
-
const response = await this.helpers.request({
|
959
|
-
method: 'GET',
|
960
|
-
url: 'https://openrouter.ai/api/v1/models',
|
961
|
-
headers: {
|
962
|
-
Authorization: `Bearer ${credentials.apiKey}`,
|
963
|
-
},
|
964
|
-
json: true,
|
965
|
-
});
|
966
|
-
const returnData = [];
|
967
|
-
if (response.data) {
|
968
|
-
for (const model of response.data) {
|
969
|
-
returnData.push({
|
970
|
-
name: model.name || model.id,
|
971
|
-
value: model.id,
|
972
|
-
description: model.description || '',
|
973
|
-
});
|
974
|
-
}
|
975
|
-
}
|
976
|
-
return returnData.sort((a, b) => a.name.localeCompare(b.name));
|
977
|
-
}
|
978
|
-
catch (error) {
|
979
|
-
return [
|
980
|
-
{
|
981
|
-
name: 'GPT-4o',
|
982
|
-
value: 'openai/gpt-4o',
|
983
|
-
description: 'OpenAI GPT-4o via OpenRouter',
|
984
|
-
},
|
985
|
-
{
|
986
|
-
name: 'GPT-4o Mini',
|
987
|
-
value: 'openai/gpt-4o-mini',
|
988
|
-
description: 'OpenAI GPT-4o Mini via OpenRouter',
|
989
|
-
},
|
990
|
-
{
|
991
|
-
name: 'Claude 3.5 Sonnet',
|
992
|
-
value: 'anthropic/claude-3.5-sonnet',
|
993
|
-
description: 'Anthropic Claude 3.5 Sonnet via OpenRouter',
|
994
|
-
},
|
995
|
-
{
|
996
|
-
name: 'Gemini 1.5 Pro',
|
997
|
-
value: 'google/gemini-pro-1.5',
|
998
|
-
description: 'Google Gemini 1.5 Pro via OpenRouter',
|
999
|
-
},
|
1000
|
-
];
|
1001
|
-
}
|
890
|
+
return model_lists_1.OPENROUTER_MODELS;
|
1002
891
|
}
|
1003
892
|
default:
|
1004
893
|
return [];
|
@@ -1007,47 +896,13 @@ class UniversalAI {
|
|
1007
896
|
catch (error) {
|
1008
897
|
switch (provider) {
|
1009
898
|
case 'google':
|
1010
|
-
return
|
1011
|
-
{
|
1012
|
-
name: 'Gemini 1.5 Pro (Latest)',
|
1013
|
-
value: 'gemini-1.5-pro-latest',
|
1014
|
-
description: 'Most capable Gemini model for text generation',
|
1015
|
-
},
|
1016
|
-
{
|
1017
|
-
name: 'Gemini 1.5 Flash (Latest)',
|
1018
|
-
value: 'gemini-1.5-flash-latest',
|
1019
|
-
description: 'Optimized for speed while maintaining high quality',
|
1020
|
-
},
|
1021
|
-
];
|
899
|
+
return model_lists_1.GOOGLE_GEMINI_MODELS;
|
1022
900
|
case 'deepseek':
|
1023
|
-
return
|
1024
|
-
{
|
1025
|
-
name: 'DeepSeek Chat',
|
1026
|
-
value: 'deepseek-chat',
|
1027
|
-
description: 'DeepSeek chat model',
|
1028
|
-
},
|
1029
|
-
];
|
901
|
+
return model_lists_1.DEEPSEEK_MODELS;
|
1030
902
|
case 'groq':
|
1031
|
-
return
|
1032
|
-
{
|
1033
|
-
name: 'Llama 3.1 8B',
|
1034
|
-
value: 'llama-3.1-8b-instant',
|
1035
|
-
description: 'Fast and efficient 8B model',
|
1036
|
-
},
|
1037
|
-
];
|
903
|
+
return model_lists_1.GROQ_MODELS;
|
1038
904
|
case 'openrouter':
|
1039
|
-
return
|
1040
|
-
{
|
1041
|
-
name: 'GPT-4o',
|
1042
|
-
value: 'openai/gpt-4o',
|
1043
|
-
description: 'OpenAI GPT-4o via OpenRouter',
|
1044
|
-
},
|
1045
|
-
{
|
1046
|
-
name: 'Claude 3.5 Sonnet',
|
1047
|
-
value: 'anthropic/claude-3.5-sonnet',
|
1048
|
-
description: 'Anthropic Claude 3.5 Sonnet via OpenRouter',
|
1049
|
-
},
|
1050
|
-
];
|
905
|
+
return model_lists_1.OPENROUTER_MODELS;
|
1051
906
|
default:
|
1052
907
|
return [];
|
1053
908
|
}
|
@@ -1060,56 +915,50 @@ class UniversalAI {
|
|
1060
915
|
const items = this.getInputData();
|
1061
916
|
const returnData = [];
|
1062
917
|
const provider = this.getNodeParameter('provider', 0);
|
1063
|
-
const apiKey = this.getNodeParameter('apiKey', 0, '');
|
1064
|
-
const baseURL = this.getNodeParameter('baseURL', 0, '');
|
1065
918
|
let credentials = null;
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No API key provided in credentials');
|
1083
|
-
}
|
919
|
+
switch (provider) {
|
920
|
+
case 'google':
|
921
|
+
credentials = await this.getCredentials('googleGenerativeAIApi');
|
922
|
+
break;
|
923
|
+
case 'deepseek':
|
924
|
+
credentials = await this.getCredentials('deepSeekApi');
|
925
|
+
break;
|
926
|
+
case 'groq':
|
927
|
+
credentials = await this.getCredentials('groqApi');
|
928
|
+
break;
|
929
|
+
case 'openrouter':
|
930
|
+
credentials = await this.getCredentials('openRouterApi');
|
931
|
+
break;
|
932
|
+
}
|
933
|
+
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.apiKey)) {
|
934
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No API key provided in credentials');
|
1084
935
|
}
|
1085
|
-
const actualApiKey =
|
936
|
+
const actualApiKey = credentials.apiKey;
|
937
|
+
const actualBaseURL = credentials.baseUrl;
|
1086
938
|
let aiProvider;
|
1087
939
|
switch (provider) {
|
1088
940
|
case 'google':
|
1089
941
|
aiProvider = createGoogleGenerativeAI({
|
1090
942
|
apiKey: actualApiKey,
|
1091
|
-
baseURL:
|
1092
|
-
headers: {
|
1093
|
-
'x-goog-api-key': actualApiKey,
|
1094
|
-
},
|
943
|
+
...(actualBaseURL && { baseURL: actualBaseURL }),
|
1095
944
|
});
|
1096
945
|
break;
|
1097
946
|
case 'deepseek':
|
1098
947
|
aiProvider = createDeepSeek({
|
1099
948
|
apiKey: actualApiKey,
|
1100
|
-
baseURL:
|
949
|
+
...(actualBaseURL && { baseURL: actualBaseURL }),
|
1101
950
|
});
|
1102
951
|
break;
|
1103
952
|
case 'groq':
|
1104
953
|
aiProvider = createGroq({
|
1105
954
|
apiKey: actualApiKey,
|
1106
|
-
baseURL:
|
955
|
+
...(actualBaseURL && { baseURL: actualBaseURL }),
|
1107
956
|
});
|
1108
957
|
break;
|
1109
958
|
case 'openrouter':
|
1110
959
|
aiProvider = createOpenRouter({
|
1111
960
|
apiKey: actualApiKey,
|
1112
|
-
baseURL:
|
961
|
+
...(actualBaseURL && { baseURL: actualBaseURL }),
|
1113
962
|
});
|
1114
963
|
break;
|
1115
964
|
}
|