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
| 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 |
| Pick an open model via an MCP server | Model Picker | Agent API | Python |
By API
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.
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
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
Document Q&A
Self-contained RAG system with contextualized embeddings and Agent API answer generation.
API Key Setup
All examples require a Perplexity API key. Set it as an environment variable:Common Requirements
- Python 3.9+ or Node.js 18+ (depending on the example)
- Perplexity API Key
- Internet connection for API calls