Overview
The official Perplexity SDKs provide convenient access to the Perplexity APIs from Python 3.8+ and Node.js applications. Both SDKs include type definitions for all request parameters and response fields, with both synchronous and asynchronous clients. Access three core APIs: Chat Completions for web-grounded AI responses, Agentic Research for third-party models with web search tools and presets, and Search for ranked web search results.Available APIs
Chat Completions
AI responses with web-grounded knowledge, conversation context, and streaming support.
Agentic Research
Third-party models from OpenAI, Anthropic, Google, and more with presets and web search tools.
Search
Ranked web search results with filtering, multi-query support, and domain controls.
Installation
Install the SDK for your preferred language:Authentication
Get your Perplexity API Key
Navigate to the API Keys tab in the API Portal and generate a new key.
- Windows
- MacOS/Linux
Using Environment Variables
You can use the environment variable directly:.env file:
Chat Completions
Get started with AI responses
Agentic Research
Get started with third-party models
Search
Get started with web search