Skip to main content

Perplexity AI

Perplexity AI is an AI-powered search engine and conversational AI platform that provides accurate, real-time answers by searching the web and synthesizing information. The Perplexity AI connector enables you to generate responses using Perplexity's Chat Completions API, allowing you to leverage Perplexity's advanced search and reasoning capabilities for building AI-powered applications. This connector is particularly useful for applications that need to integrate real-time web search, build question-answering systems, create AI assistants with up-to-date information, or leverage Perplexity's advanced reasoning for complex queries.

Perplexity AI icon

Power end-to-end data operations for your Perplexity AI API with Nexla. Our bi-directional Perplexity AI connector is purpose-built for Perplexity AI, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to Perplexity AI or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your Perplexity AI workflows fast, secure, and fully governed.

Features

Type: API

SourceDestination

  • Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
  • Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
  • API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
  • Request optimization with intelligent batching, retry, and caching to minimize API calls and costs

Prerequisites

Before creating a Perplexity AI credential, you'll need to obtain an API key from your Perplexity AI account. Perplexity provides API keys for programmatic access to their Chat Completions API through the Perplexity API platform.

To obtain a Perplexity AI API key:

  1. Log in to your Perplexity AI account at https://www.perplexity.ai or navigate to the Perplexity API dashboard.

  2. Navigate to your account settings or API dashboard. This is typically accessible from the user menu or dashboard navigation.

  3. In the API settings or API Keys section, locate the option to create or manage API keys.

  4. Click Create API Key or Generate New Key to create a new API key for your application. You may need to provide a name or description for the API key.

  5. Copy the API key immediately after generation, as it may only be displayed once for security purposes. Store it securely, as you'll need it to authenticate API requests.

Perplexity AI API keys are used as Bearer tokens in the Authorization header for all API requests. The API key is sensitive information and should be kept secure. If you've lost your API key, you'll need to generate a new one in your Perplexity AI account settings.

For detailed information about Perplexity AI API authentication and API key management, refer to the Perplexity AI API Documentation.

Authenticate

Credentials required

FieldRequiredSecretDescription
API KeyYesYesPerplexity-provided secret API key
Base URLYesNoThe base URL for the Perplexity API.
API VersionYesNoChat completions payload to test a connection

Create a credential in Nexla

  1. After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

New Credential Overlay – Perplexity AI

PerplexityCred.png
  1. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

  2. Enter the API key that you obtained from your Perplexity AI account in Prerequisites in the API Key field. This is the secret API key used to authenticate requests to the Perplexity AI API.

  3. Enter the base URL for the Perplexity AI API in the Base URL field. The default value is https://api.perplexity.ai, which is the standard base URL for Perplexity AI API services. You can specify a different base URL if your organization uses a custom endpoint.

  4. In the API Version field (labeled as "Chat completions payload to test a connection"), enter a sample JSON payload to test the connection. A default payload is provided:

    {
    "model": "sonar",
    "messages": [
    {
    "role": "system",
    "content": "Be precise and concise."
    },
    {
    "role": "user",
    "content": "How many stars are there in our galaxy?"
    }
    ]
    }

    The API key is sensitive information and should be kept secure. If you've lost your API key, you'll need to generate a new one in your Perplexity AI account settings. API keys are used as Bearer tokens in the Authorization header for all API requests.

  5. Click the Save button at the bottom of the overlay. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation.

Use as a data source

To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the Perplexity AI connector tile, then select the credential that will be used to connect to the Perplexity AI API, and click Next; or, create a new Perplexity AI credential for use in this flow.

Endpoint templates

Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Perplexity AI API endpoints. Each template is designed specifically for the corresponding Perplexity AI API endpoint, making data source setup easy and efficient. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below.

Generate Chat Completion

This endpoint generates a response from Perplexity based on user input. Use this endpoint when you need to get AI-powered answers, perform real-time web searches, or leverage Perplexity's advanced reasoning capabilities for complex queries.

  • Enter the Perplexity model to use in the Model field. The default value is sonar, which is Perplexity's primary model. You can specify other available models if needed.
  • Optionally, enter a system message in the System Message field. This provides instructions to guide the model's behavior. The default value is You are a helpful assistant.
  • Enter the user message or prompt in the User Message field. This is the query or question you want Perplexity to answer. This is a required field.
  • Optionally, specify the temperature for text generation in the Temperature field. Temperature controls the randomness of the output (0-1). Lower values make the output more deterministic, while higher values make it more creative. The default value is 0.7.
  • Optionally, specify the top_p (nucleus sampling) parameter in the Top P field. This controls the diversity of the output (0-1). The default value is 1.
  • Optionally, specify the maximum number of tokens in the response in the Max Tokens field. This limits the length of the generated response. The default value is 256.

The Generate Chat Completion endpoint uses POST requests to send queries to the Perplexity AI API and returns AI-generated responses with real-time web search capabilities. Perplexity's models can search the web and synthesize information to provide accurate, up-to-date answers. For more information about the Generate Chat Completion endpoint, refer to the Perplexity AI API Documentation.

Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving.

Manual configuration

Perplexity AI data sources can also be manually configured to ingest data from any valid Perplexity AI API endpoint, including endpoints not covered by the pre-built templates, chained API calls, or custom request parameters. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.

Perplexity AI API endpoints typically follow the pattern {base_url}/chat/completions, where {base_url} is typically https://api.perplexity.ai, and most endpoints use the POST method. For the Path to Data, common paths include $.choices[*].message for arrays of completion messages or $ for the entire response. The request body must be valid JSON matching the Perplexity AI API's expected format — typically a model field (e.g., "sonar"), a messages array with system and user messages, and optionally temperature, top_p, and max_tokens. The Authorization header with your Bearer token is automatically included from your credential. Refer to the Perplexity AI API Documentation for the complete list of supported parameters.

Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new Perplexity AI data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.