-
Notifications
You must be signed in to change notification settings - Fork 128
LLM Perplexity
Perplexity AI offers an OpenAI-compatible LLM API with built-in real-time web search. Models such as sonar and sonar-pro can answer questions using up-to-date information from the web without any extra integration work on your part.
- Sign in or create an account at https://www.perplexity.ai/.
- Navigate to Settings → API (or visit https://www.perplexity.ai/settings/api).
- Generate a new API key and copy it.
Full API documentation is available at https://docs.perplexity.ai.
Set LLM_SERVER=perplexity in your .env file:
LLM_SERVER=perplexity
PERPLEXITY_API_KEY=your_perplexity_api_key
# Default model is "sonar". For web-augmented reasoning, try "sonar-pro" or "sonar-reasoning".
# PERPLEXITY_LLM_MODEL=sonar
# Tool/function calling is only supported on select models (e.g. sonar-pro).
# Set to true to enable. Default is false.
# PERPLEXITY_ENABLE_TOOLS=false| Model | Web Search | Tool Calling | Notes |
|---|---|---|---|
sonar |
✅ | ❌ | Default. Fast, lightweight, online search. |
sonar-pro |
✅ | ✅ | Advanced search + function/tool calling. |
sonar-reasoning |
✅ | ❌ | Chain-of-thought reasoning with search. |
sonar-reasoning-pro |
✅ | ✅ | Chain-of-thought reasoning with tool support. |
For the latest model list and capabilities, refer to the official Perplexity models documentation.
Whisplay supports tool/function calling (e.g. image generation, camera capture) when the LLM backend supports it. With Perplexity, tool calling requires a compatible model and PERPLEXITY_ENABLE_TOOLS=true.
Example configuration with sonar-pro and tools enabled:
LLM_SERVER=perplexity
PERPLEXITY_API_KEY=your_perplexity_api_key
PERPLEXITY_LLM_MODEL=sonar-pro
PERPLEXITY_ENABLE_TOOLS=trueNote: If you enable tools on a model that does not support them (e.g.
sonar), the API will return an error. KeepPERPLEXITY_ENABLE_TOOLS=false(the default) when using basicsonarorsonar-reasoningmodels.
Perplexity is used only as the LLM backend. You can pair it with any supported ASR and TTS provider. Example:
ASR_SERVER=openai
LLM_SERVER=perplexity
TTS_SERVER=openai
PERPLEXITY_API_KEY=your_perplexity_api_key
PERPLEXITY_LLM_MODEL=sonar-pro
PERPLEXITY_ENABLE_TOOLS=true| Variable | Required | Default | Description |
|---|---|---|---|
PERPLEXITY_API_KEY |
Yes | (none) | Your Perplexity API key |
PERPLEXITY_LLM_MODEL |
No | sonar |
Model name (see table above) |
PERPLEXITY_ENABLE_TOOLS |
No | false |
Enable tool/function calling (requires a compatible model) |
- Perplexity models always query the web for recent information, which makes them excellent for questions about current events or real-time data.
- Chat history is maintained within a session and automatically reset after the idle timeout (configurable via
CHAT_HISTORY_RESET_TIME). - Chat history is also saved to
data/chathistory/for debugging purposes.