Skip to main content

Overview

PerplexityAgentHttpLLMService provides access to Perplexity’s Agent API, which answers with web search using models from Perplexity and other providers. It inherits from OpenAIResponsesHttpLLMService, so streaming, function calling, and context management work as they do on the OpenAI Responses page.

Perplexity LLM API Reference

Pipecat’s API methods for Perplexity integration

Example Implementation

Complete example with search capabilities

Perplexity Documentation

Official Perplexity API documentation and features

Perplexity Platform

Access search-enhanced models and API keys

Installation

To use Perplexity services, install the required dependencies:

Prerequisites

Perplexity Account Setup

Before using Perplexity LLM services, you need:
  1. Perplexity Account: Sign up at Perplexity
  2. API Key: Generate an API key from your account dashboard
  3. Model or Preset Selection: Choose a model, a preset, or both

Required Environment Variables

  • PERPLEXITY_API_KEY: Your Perplexity API key for authentication

Configuration

str
default:"None"
Perplexity API key for authentication.
str
default:"https://api.perplexity.ai/v1"
Base URL for Perplexity API endpoint.
PerplexityAgentHttpLLMService.Settings
default:"None"
Runtime-configurable settings. See Settings below.
Other constructor arguments, such as retry_on_timeout, are those of OpenAIResponsesHttpLLMService.

Settings

Runtime-configurable settings passed via the settings constructor argument using PerplexityAgentHttpLLMService.Settings(...). These can be updated mid-conversation with LLMUpdateSettingsFrame. See Service Settings for details. This service adds the following to the settings of OpenAIResponsesHttpLLMService (see OpenAI Responses Settings). The default model is "openai/gpt-5.6-luna". Raises ValueError when the constructor settings leave neither model nor preset. A runtime update that leaves neither pushes an ErrorFrame. With neither preset nor reasoning set, each request sends the "fast" preset, Perplexity’s lowest-latency setup, and the first request for each model logs it. With use_provider_thinking_default set to True, no preset is sent.

Usage

Basic Setup

With a Preset

Notes

  • Citations: Answers can include citation markers such as [1].
  • Anthropic models: Models from Anthropic need max_completion_tokens set in the settings.

Deprecated: PerplexityLLMService

Deprecated since 1.13.0, removed in 2.0.0. Use PerplexityAgentHttpLLMService instead. Perplexity has ended support for the Sonar chat completions API that PerplexityLLMService uses.