mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(Perplexity Node): New node (#13604)
This commit is contained in:
52
packages/nodes-base/credentials/PerplexityApi.credentials.ts
Normal file
52
packages/nodes-base/credentials/PerplexityApi.credentials.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import type {
|
||||
IAuthenticateGeneric,
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class PerplexityApi implements ICredentialType {
|
||||
name = 'perplexityApi';
|
||||
|
||||
displayName = 'Perplexity API';
|
||||
|
||||
documentationUrl = 'https://docs.perplexity.ai';
|
||||
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'API Key',
|
||||
name: 'apiKey',
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'Your Perplexity API key. Get it from your Perplexity account.',
|
||||
},
|
||||
];
|
||||
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
headers: {
|
||||
Authorization: '=Bearer {{$credentials.apiKey}}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: 'https://api.perplexity.ai',
|
||||
url: '/chat/completions',
|
||||
method: 'POST',
|
||||
body: {
|
||||
model: 'r1-1776',
|
||||
messages: [{ role: 'user', content: 'test' }],
|
||||
},
|
||||
headers: {
|
||||
Authorization: '=Bearer {{$credentials.apiKey}}',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
json: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user