n8n node for Perplexity AI API integration
npm install n8n-nodes-perplexityThis is an n8n community node that integrates with the Perplexity AI API. It allows you to use Perplexity's search-grounded AI models in your n8n workflows.
Perplexity AI provides real-time search-grounded AI responses using various models including Sonar, Sonar Pro, and specialized research models.
Follow the installation guide in the n8n community nodes documentation.
1. Go to Settings > Community Nodes.
2. Select Install.
3. Enter n8n-nodes-perplexity in Enter npm package name.
4. Agree to the risks of using community nodes: select I understand the risks of installing unverified code from a public source.
5. Select Install.
After installing the node, you can use it like any other node in your workflows.
To get started install the package in your n8n root directory:
``bash`
npm install n8n-nodes-perplexity
For Docker-based deployments add the following line before the font installation command in your n8n Dockerfile:
`dockerfile`
RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-perplexity
You need to configure Perplexity API credentials to use this node:
1. Create a new credential of type Perplexity API
2. Enter your Perplexity API key
- Get your API key from Perplexity AI Settings
Generate AI responses using Perplexity's search-grounded models.
#### Available Models
- Sonar Deep Research (sonar-deep-research): Comprehensive, expert-level research with detailed reportssonar-reasoning-pro
- Sonar Reasoning Pro (): Premier reasoning with Chain of Thought powered by DeepSeek R1sonar-pro
- Sonar Pro (): Premier search offering with advanced query supportsonar
- Sonar (): Lightweight and cost-effective search-grounded responsesr1-1776
- R1-1776 (): Uncensored, unbiased version of DeepSeek R1
#### Parameters
Required:
- Model: Choose from available Perplexity models
- Messages: Array of conversation messages with roles (system, user, assistant)
- Text Only: Simple text messages
- Multi-modal: Text with images (base64 or HTTPS URLs)
Optional:
- Max Tokens: Maximum number of tokens to generate (default: 1000)
- Temperature: Controls randomness (0-2, default: 0.7)
- Top P: Controls diversity via nucleus sampling (0-1, default: 1)
- Stream: Enable streaming responses (default: false)
- Presence Penalty: Penalize new tokens based on presence (-2 to 2, default: 0)
- Frequency Penalty: Penalize tokens based on frequency (-2 to 2, default: 0)
- Search Filters: Domain filtering, date ranges, user location, context size
- Image Options: Include images, filter by type and size
#### Response Format
Configure structured output formats:
- Text: Default text response
- JSON Schema: Structured JSON output with schema validation
- Regex: Output matching a specific regex pattern
`json`
{
"model": "sonar-pro",
"messages": [
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What are the latest developments in AI?"
}
]
}
`json`
{
"model": "sonar-deep-research",
"messages": [
{
"role": "user",
"content": "Provide a comprehensive analysis of renewable energy trends in 2024"
}
],
"max_tokens": 2000
}
`json`
{
"model": "sonar",
"messages": [
{
"role": "user",
"content": "Extract key information about Apple Inc."
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"schema": {
"type": "object",
"properties": {
"company_name": {"type": "string"},
"founded": {"type": "string"},
"headquarters": {"type": "string"},
"ceo": {"type": "string"}
}
}
}
}
}
`json`
{
"model": "sonar-pro",
"messages": [
{
"role": "user",
"content": "What are the latest AI research papers on transformer models?"
}
],
"searchFilters": {
"search_domain_filter": ["academic"],
"search_recency_filter": "week",
"search_context_size": "detailed"
},
"imageOptions": {
"include_images": true,
"image_filter": "graphics"
}
}
`json`
{
"model": "sonar-pro",
"messages": [
{
"role": "user",
"contentType": "multimodal",
"textContent": "Can you describe this image and tell me what you see?",
"images": {
"imageValues": [
{
"imageType": "url",
"imageUrl": "https://example.com/path/to/image.jpg"
}
]
}
}
]
}
`json`
{
"model": "sonar-pro",
"messages": [
{
"role": "user",
"contentType": "multimodal",
"textContent": "Analyze this screenshot for any issues",
"images": {
"imageValues": [
{
"imageType": "base64",
"imageFormat": "png",
"base64Data": "iVBORw0KGgoAAAANSUhEUgAA..."
}
]
}
}
]
}
- ✅ Full Perplexity API support
- ✅ All available models (Sonar, Sonar Pro, Deep Research, R1-1776)
- ✅ Conversation history with multiple message roles
- ✅ Advanced parameters (temperature, top_p, penalties)
- ✅ Structured output formats (JSON Schema, Regex)
- ✅ Streaming support
- ✅ Search domain filtering (Academic, YouTube, Reddit, Wolfram Alpha, etc.)
- ✅ Date range and recency filtering
- ✅ User location-based search
- ✅ Search context size control
- ✅ Image search and filtering options
- ✅ Multi-modal support (text + images)
- ✅ Base64 image upload (PNG, JPEG, WEBP, GIF up to 5MB)
- ✅ HTTPS URL image references
- ✅ Built-in credential testing
- ✅ Comprehensive error handling
This node is built according to the Perplexity API documentation. For detailed API information, visit:
- Getting Started
- Model Cards
- Structured Outputs
- Prompt Guide
- n8n version: 1.0.0+
- Node.js version: 20.15+
- n8n community nodes documentation
- Perplexity AI Documentation
- Perplexity AI Website