Intended Audience
- Developers
License
- OSI Approved :: Apache Software License
Programming Language
- Python :: 3
- Python :: 3 :: Only
- Python :: 3.10
Topic
- Multimedia :: Sound/Audio
- Multimedia :: Video
- Scientific/Engineering :: Artificial Intelligence
Perplexity plugin for LiveKit Agents
Support for Perplexity LLMs via the OpenAI-compatible
chat completions endpoint at https://api.perplexity.ai.
See https://docs.livekit.io/agents/models/llm/perplexity/ for more information.
Installation
pip install livekit-plugins-perplexity
Pre-requisites
You'll need an API key from Perplexity. It can be passed directly or set as the
PERPLEXITY_API_KEY environment variable.
Usage
from livekit.plugins import perplexity
llm = perplexity.LLM(
model="sonar-pro",
# api_key picked up from PERPLEXITY_API_KEY if omitted
)
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.
Agent API usage
Perplexity's Agent API is compatible with OpenAI's Responses API and is
available through the perplexity.responses submodule.
from livekit.plugins import perplexity
llm = perplexity.responses.LLM(
model="perplexity/sonar",
# api_key picked up from PERPLEXITY_API_KEY if omitted
)
The Responses LLM uses base_url="https://api.perplexity.ai/v1", disables
websocket transport, and sends the same X-Pplx-Integration attribution header
on its OpenAI-compatible client.