LiveKit docs › Models › LLM › Additional models › Perplexity

---

# Perplexity LLM plugin guide

> How to use Perplexity LLM with LiveKit Agents.

Available in:
- [x] Node.js
- [x] Python

## Overview

This plugin allows you to use [Perplexity](https://www.perplexity.ai/) as an LLM provider for your voice agents. Python uses a dedicated `livekit-plugins-perplexity` package, and Node.js uses Perplexity through the OpenAI plugin.

## Usage

Install the plugin:

**Python**:

```shell
uv add "livekit-agents[perplexity]~=1.5"

```

---

**Node.js**:

```shell
pnpm add @livekit/agents-plugin-openai@1.x

```

Set the following environment variable in your `.env` file:

```shell
PERPLEXITY_API_KEY=<your-perplexity-api-key>

```

Create a Perplexity LLM:

**Python**:

```python
from livekit.plugins import perplexity

session = AgentSession(
    llm=perplexity.LLM(
        model="sonar-pro",
    ),
    # ... tts, stt, vad, turn_handling, etc.
)

```

---

**Node.js**:

```typescript
import * as openai from '@livekit/agents-plugin-openai';

const session = new voice.AgentSession({
    llm: openai.LLM.withPerplexity({
        model: "sonar-pro",
    }),
    // ... tts, stt, vad, turnHandling, etc.
});

```

> 💡 **OpenAI plugin alternative (Python)**
> 
> If you already have the OpenAI plugin installed, you can use `openai.LLM.with_perplexity()` as an alternative. It remains supported, but the dedicated `perplexity.LLM()` is the recommended path for new code.

## Parameters

This section describes some of the available parameters. For a complete reference of all available parameters, see the plugin reference links in the [Additional resources](#additional-resources) section.

- **`model`** _(str | PerplexityChatModels)_ (optional) - Default: `sonar-pro`: Model to use for inference. To learn more, see [supported models](https://docs.perplexity.ai/guides/model-cards).

- **`temperature`** _(float)_ (optional) - Default: `1.0`: Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.

Valid values are between `0` and `2`.

- **`parallel_tool_calls`** _(bool)_ (optional): Controls whether the model can make multiple tool calls in parallel. When enabled, the model can make multiple tool calls simultaneously, which can improve performance for complex tasks.

- **`tool_choice`** _(ToolChoice | Literal['auto', 'required', 'none'])_ (optional) - Default: `auto`: Controls how the model uses tools. String options are as follows:

- `'auto'`: Let the model decide.
- `'required'`: Force tool usage.
- `'none'`: Disable tool usage.

## Additional resources

The following links provide more information about the Perplexity LLM integration.

- **[Perplexity docs](https://docs.perplexity.ai/docs/)**: Perplexity API documentation.

- **[Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md)**: Get started with LiveKit Agents and Perplexity.

---

This document was rendered at 2026-06-07T11:34:28.117Z.
For the latest version of this document, see [https://docs.livekit.io/agents/models/llm/perplexity.md](https://docs.livekit.io/agents/models/llm/perplexity.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).