Examples Overview
Ready-to-run projects that demonstrate real-world use cases across every Perplexity API. Each example includes complete setup instructions and working code.
Choosing the Right Example
Section titled “Choosing the Right Example”| If you want to... | Use this example | API | Language |
|---|---|---|---|
| Conduct deep web research | Agent Research Assistant | Agent API | Python, TypeScript |
| Compare models across providers | Model Comparison | Agent API | Python |
| Monitor news topics in real time | Search News Monitor | Search API | Python, TypeScript |
| Build a document Q&A system | Document Q&A | Embeddings + Agent API | Python |
| Build a TypeScript CLI agent | TypeScript Agent CLI | Agent API | TypeScript |
| Analyze images with web context | Image Analysis | Agent API | Python, TypeScript |
| Ask questions about uploaded files | File Attachment Q&A | Agent API | Python |
| Search SEC filings for financial data | SEC Filing Search | Agent API | Python |
| Run code and build a PDF in a sandbox | Competitor Buzz Tracker | Agent API | Python |
| Source candidates for a hiring brief | Talent Sourcer | Agent API | Python |
| Enrich a customer row with validated professional evidence | Enrich Customer Data with Agent API | Agent API | Python |
| Pick an open model via an MCP server | Model Picker | Agent API | Python |
By API
Section titled “By API”Agent API
Section titled “Agent API”Agent Research Assistant
Deep web research using the medium preset with structured report output.
Model Comparison
Compare responses from 5 providers side-by-side — quality, latency, and cost.
TypeScript Agent CLI
Interactive TypeScript CLI with streaming, model selection, and web search.
Image Analysis
Vision + web search for context-enriched image analysis.
File Attachment Q&A
Upload documents and ask questions about them with optional web search enrichment.
Competitor Buzz Tracker
Two chained agent requests: the sandbox searches and counts each brand's share of voice, then renders a downloadable bar-chart PDF.
Talent Sourcer
Wide search in a sandbox: source engineers by skill, location, and tenure, verify each, and rank them with their GitHub and profile links into an HTML shortlist.
Customer Enrichment
Read one ClickHouse customer row, validate the selected People Search result ID, and append a source-backed enrichment run.
Model Picker
Connect the Hugging Face MCP server and web search in one request: find open models on the live Hub, verify their downloads and license, and check benchmarks before recommending one.
Search API
Section titled “Search API”Search News Monitor
Multi-topic news monitoring with domain filtering and recency control.
SEC Filing Search
Search SEC.gov and EDGAR for financial filings with structured data extraction.
Embeddings API
Section titled “Embeddings API”API Key Setup
Section titled “API Key Setup”All examples require a Perplexity API key. Set it as an environment variable:
export PERPLEXITY_API_KEY="your-api-key-here"Common Requirements
Section titled “Common Requirements”- Python 3.9+ or Node.js 18+ (depending on the example)
- Perplexity API Key
- Internet connection for API calls
Additional requirements vary by example and are listed in each project's documentation.
Contributing
Section titled “Contributing”Found a bug or want to add an example? See our Contributing Guidelines.