| name | perplexity-install-auth |
| description | Install and configure Perplexity Sonar API authentication.
Use when setting up a new Perplexity integration, configuring API keys,
or initializing the OpenAI-compatible client for Perplexity.
Trigger with phrases like "install perplexity", "setup perplexity",
"perplexity auth", "configure perplexity API key", "perplexity sonar setup".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","perplexity","api","authentication"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Perplexity Install & Auth
Overview
Set up Perplexity Sonar API access using the OpenAI-compatible chat completions endpoint at https://api.perplexity.ai. Perplexity does not have a custom SDK -- you use the standard OpenAI client library pointed at Perplexity's base URL.
Prerequisites
Instructions
Step 1: Install OpenAI Client Library
set -euo pipefail
npm install openai
pip install openai
There is no @perplexity/sdk package. Perplexity uses the OpenAI wire format, so you use the official openai package with a custom baseURL.
Step 2: Configure API Key
export PERPLEXITY_API_KEY="pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
echo 'PERPLEXITY_API_KEY=pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' >> .env
API keys start with pplx- and are generated at perplexity.ai/settings/api. You must add credits to your account before making API calls.
Step 3: Verify Connection (TypeScript)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PERPLEXITY_API_KEY,
baseURL: "https://api.perplexity.ai",
});
async function () {
response = client...({
: ,
: [{ : , : }],
: ,
});
.(, response.[]..);
.(, response.);
.(, response.?.);
}
().(.);