feat(Perplexity Node): New node (#13604)

This commit is contained in:
Stanimira Rikova
2025-05-29 22:01:19 +03:00
committed by GitHub
parent 041ada1fd6
commit 6d3e6eef00
14 changed files with 988 additions and 0 deletions

View 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,
},
};
}