Perplexity with LiveKit Agents
Overview
Section titled “Overview”Perplexity's Agent API is compatible with the OpenAI Responses API, so it works as a drop-in LLM for LiveKit Agents through livekit-plugins-openai's openai.responses.LLM class, pointed at Perplexity's base URL.
Installation
Section titled “Installation”pip install "livekit-agents" "livekit-plugins-openai"API Key Setup
Section titled “API Key Setup”Set your Perplexity API key as an environment variable and pass it to the constructor:
export PERPLEXITY_API_KEY="your_api_key_here"Get API Key
Generate your API key from the Perplexity dashboard.
Quick Start
Section titled “Quick Start”Use openai.responses.LLM anywhere a LiveKit AgentSession expects an LLM:
import os
from livekit.agents import Agent, AgentSession
from livekit.plugins import openai, silero
session = AgentSession(
llm=openai.responses.LLM(
model="openai/gpt-5.6-sol",
base_url="https://api.perplexity.ai/v1", # SDK appends /responses -> POST /v1/responses
api_key=os.environ["PERPLEXITY_API_KEY"], # required: constructor does not read PERPLEXITY_API_KEY
),
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.",
tools=[openai.tools.WebSearch()], # Perplexity's built-in web_search tool
)
# Run the session inside your LiveKit room entrypointBecause the Agent API is OpenAI-Responses-compatible, the OpenAI plugin talks to https://api.perplexity.ai/v1 with no other changes.
Configuration
Section titled “Configuration”openai.responses.LLM needs two settings to target Perplexity - base_url and an explicit api_key (the constructor does not read PERPLEXITY_API_KEY on its own):
import os
from livekit.plugins import openai
llm = openai.responses.LLM(
model="openai/gpt-5.6-sol",
base_url="https://api.perplexity.ai/v1",
api_key=os.environ["PERPLEXITY_API_KEY"],
)Perplexity's built-in tools (like web_search, shown in the Quick Start) attach to the Agent, not to the LLM.
Available Models
Section titled “Available Models”The integration works with any model exposed through the Perplexity Agent API, addressed as provider/model (for example openai/gpt-5.6-sol). See the full list on our models page.
Links & Resources
Section titled “Links & Resources”LiveKit Agents Docs
Build realtime voice and multimodal agents with LiveKit.
OpenAI Plugin Source
The livekit-plugins-openai source, including the Responses LLM.
Agent API Quickstart
Request, response, and tool contract used above.
Agent API Models
Available models and pricing.
Support
Section titled “Support”Need help with the integration?
- Browse the LiveKit Agents documentation
- Review our FAQ