Skip to main content

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.

Decisions API usage

perplexity.DecisionModel implements llm.DecisionModel with Perplexity's Decisions API. This example gates each reply in Agent.on_user_turn_completed with one short attempt, and fails open so a decision outage never blocks the conversation:

from livekit.agents import APIConnectOptions, APIError, llm
from livekit.plugins import perplexity

decider = perplexity.DecisionModel()  # pplx-decider-flash-v1.3

async def on_user_turn_completed(self, turn_ctx, new_message):
    conversation = turn_ctx.copy()
    conversation.items.append(new_message)  # not in turn_ctx yet
    try:
        response = await decider.evaluate(
            input=conversation,
            decisions={"handoff": llm.Probability("The caller asks for a human.")},
            conn_options=APIConnectOptions(timeout=1.5, max_retry=0),
        )
    except APIError:
        return
    handoff = response.results.get("handoff")  # failed questions land in response.errors
    if handoff is not None and handoff.value > 0.8:
        ...

Outside a job, wrap calls in async with utils.http_context.open(): or pass http_session=. For Decider for Mac, pass base_url="http://127.0.0.1:8080/v1"; it needs no API key.

Metadata

Release files for livekit-plugins-perplexity 1.8.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for livekit-plugins-perplexity 1.8.12
File Size Uploaded Provenance Actions
livekit_plugins_perplexity-1.8.12.tar.gz 7.5 kB With provenance Details for livekit_plugins_perplexity-1.8.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for livekit-plugins-perplexity 1.8.12
File Interpreter ABI Platform Actions
livekit_plugins_perplexity-1.8.12-py3-none-any.whl Python 3 none any Details for livekit_plugins_perplexity-1.8.12-py3-none-any.whl

Total release size: 18.0 kB

Release files / livekit_plugins_perplexity-1.8.12.tar.gz

Download URL livekit_plugins_perplexity-1.8.12.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
84bf61ab436582cce31b8d70a1c8dac0c3b9ea1928ca18a6966aca1669cc5e74
BLAKE2b-256 checksum
How to use checksums
94c7b23cb0439ac1b7d0ffee6514b42096aee856672cc0b6adfcac3cd8a737db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / livekit_plugins_perplexity-1.8.12-py3-none-any.whl

Download URL livekit_plugins_perplexity-1.8.12-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d51f8c00e06c4e92fba2dbd677e696135c78d95e4fcd7383bbe14aa7967d190
BLAKE2b-256 checksum
How to use checksums
9af408336d060566c8d2257a51d616f48d3bea23d0c2609d12d1679220e27f9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for livekit-plugins-perplexity 1.8.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for livekit_plugins_perplexity-1.8.12.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.8.12 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page