Overview
Perplexity provides AI models with built-in web search capabilities, delivering up-to-date information and citations. Access Perplexity’s Sonar models through Portkey for search-augmented AI responses. Base URL:https://api.perplexity.ai
Supported Features
- ✅ Chat Completions
- ✅ Streaming
- ✅ Web Search Integration
- ✅ Citations
- ✅ Real-time Information
- ❌ Embeddings
- ❌ Function Calling
- ❌ Vision
- ❌ Image Generation
Quick Start
Chat Completions with Search
Streaming
Available Models
Sonar Models (Online)
These models have access to the web and provide citations:| Model | Context | Description | Best For |
|---|---|---|---|
sonar-pro | 127K | Most capable with search | Complex research, analysis |
sonar | 127K | Fast with search | Quick lookups, Q&A |
Chat Models (Offline)
Standard chat models without web access:| Model | Context | Description | Best For |
|---|---|---|---|
llama-3.1-sonar-huge-128k-online | 127K | Largest online model | Complex queries |
llama-3.1-sonar-large-128k-online | 127K | Balanced online | General purpose |
llama-3.1-sonar-small-128k-online | 127K | Fast online | Quick responses |
Perplexity excels at:
- Real-time information - Access current web data
- Fact-checking - Verify information with citations
- Research - Comprehensive web search
- Current events - Up-to-date news and developments
- Citation tracking - Source attribution
Configuration Options
| Header | Description | Required |
|---|---|---|
Authorization | Perplexity API key | Yes |
Advanced Features
System Messages
Temperature Control
Multi-turn Conversations
Use Cases
Research & Analysis
Current Events
Fact Verification
Fallback Configuration
Fallback to GPT-4 for non-search queries:Conditional Routing
Route to Perplexity for search queries, GPT-4 for others:Error Handling
Best Practices
- Use for current information - Leverage web search capabilities
- Lower temperature - For factual accuracy (0.0-0.3)
- Clear queries - Specific questions get better results
- Request citations - Ask model to cite sources
- Use sonar-pro - For important research
- Use sonar - For quick lookups
- Verify information - Always validate critical facts
- Implement caching - Cache responses to reduce costs
Limitations
- No function calling support (yet)
- No vision capabilities
- No embeddings
- Search results depend on web availability
- May have slightly higher latency due to search
When to Use Perplexity
Use Perplexity when:- You need current, real-time information
- Research requires web search
- Citations and sources are important
- Fact-checking is critical
- Questions involve recent events
- Information is static or historical
- You need vision or function calling
- Lower latency is critical
- You’re doing creative writing
Pricing
Perplexity Pricing
View detailed pricing for Perplexity models
Related Resources
Conditional Routing
Route based on search needs
Fallbacks
Fallback configurations
Caching
Cache search results
Google Gemini
Alternative with search