perplexity-sdk-patterns
Installation
SKILL.md
Perplexity SDK Patterns
Overview
Production-ready patterns for Perplexity Sonar API. Since Perplexity uses the OpenAI wire format, you build wrappers around the openai client library with Perplexity-specific response handling (citations, search results, related questions).
Prerequisites
openaipackage installed (npm install openaiorpip install openai)- API key configured in
PERPLEXITY_API_KEY - Understanding of OpenAI chat completions format
Instructions
Step 1: Typed Client Singleton (TypeScript)
// src/perplexity/client.ts
import OpenAI from "openai";