Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.perplexity.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The livekit-plugins-perplexity package wraps Perplexity’s OpenAI-compatible chat completions endpoint at https://api.perplexity.ai so it can be used as a drop-in LLM for LiveKit Agents.
LiveKit Agents is an open-source framework for building realtime voice and multimodal AI agents. The Perplexity plugin lets a voice agent answer with web-grounded, citation-backed responses. Learn more at livekit.io.

Installation

pip install "livekit-agents[perplexity]"

API Key Setup

Set your Perplexity API key as an environment variable, or pass it directly to the constructor:
export PERPLEXITY_API_KEY="your_api_key_here"

Get API Key

Generate your API key from the Perplexity dashboard.

Quick Start

Use perplexity.LLM anywhere a LiveKit Agent expects an LLM:
from livekit.agents import Agent, AgentSession
from livekit.plugins import perplexity, openai, silero

session = AgentSession(
    llm=perplexity.LLM(model="sonar-pro"),
    stt=openai.STT(),
    tts=openai.TTS(),
    vad=silero.VAD.load(),
)

agent = Agent(
    instructions="You are a helpful voice assistant. Use web search to answer with up-to-date information.",
)

# Run the session inside your LiveKit room entrypoint
The plugin reuses the OpenAI plugin’s chat completions transport with base_url="https://api.perplexity.ai" and forwards an X-Pplx-Integration attribution header on every outgoing request.

Configuration

perplexity.LLM accepts the same options as the underlying OpenAI-compatible client:
from livekit.plugins import perplexity

llm = perplexity.LLM(
    model="sonar-pro",
    api_key="...",            # falls back to PERPLEXITY_API_KEY
    temperature=0.2,
    top_p=0.9,
    parallel_tool_calls=True,
)

Available Models

The plugin works with any model exposed through the Perplexity Agent API. sonar-pro is the default. See the full list on our models page.

LiveKit Agents Docs

Build realtime voice and multimodal agents with LiveKit.

Perplexity Plugin Source

Plugin source in the livekit/agents monorepo.

PyPI Package

View on PyPI.

Agent API Quickstart

Learn more about the OpenAI-compatible Perplexity Agent API.

Support

Need help with the integration?