The Perplexity API enables developers to integrate real-time, cited information retrieval into applications with just a few lines of code. Unlike traditional search APIs that return raw links, Perplexity combines live web indexing with large language models to deliver synthesized answers complete with source citations—effectively giving any application the research capabilities of an AI search engine.
What is the Perplexity API?
The Perplexity API is a suite of developer tools launched by Perplexity AI that provides programmatic access to real-time web search combined with natural language processing. As of February 2026, the API includes four core services: the Sonar API for web-grounded AI responses, the Search API for raw ranked results, the Agent API for third-party models with unified search tools, and the Embeddings API for semantic search applications.
Perplexity launched its API platform to democratize access to AI-powered search infrastructure. The company announced general availability of Pro Search in November 2025 and introduced official Python and TypeScript SDKs in October 2025. The API is built on Perplexity’s continuously refreshed web index, meaning responses always reflect current information rather than static training data.
How Does the Perplexity API Work?
Architecture and Core Components
The Perplexity API operates on a tiered system where developers choose the right tool for their use case. The Sonar API serves as the flagship offering, providing AI-generated responses grounded in live search results with automatic citations.
When you send a query through the Sonar API, the system analyzes your input, fetches current information from Perplexity’s crawlers, synthesizes the content using the selected model, and generates formatted citations. All APIs are hosted on Amazon Web Services in North America with zero-day retention of user prompt data by default.
Available Models
Perplexity offers several Sonar models optimized for different use cases:
| Model | Best For | Input Cost | Output Cost |
|---|---|---|---|
| Sonar | Quick factual queries, current events | $1 per 1M tokens | $1 per 1M tokens |
| Sonar Pro | Complex analysis, multi-step reasoning | $3 per 1M tokens | $15 per 1M tokens |
| Sonar Reasoning Pro | Step-by-step problem solving | $2 per 1M tokens | $8 per 1M tokens |
| Sonar Deep Research | Comprehensive reports | $2 per 1M tokens | $8 per 1M tokens |
Sonar Deep Research incurs additional costs: $2 per 1M citation tokens, $3 per 1M reasoning tokens, and $5 per 1,000 search queries.
Implementation Example
Getting started requires minimal setup. First, install the official SDK:
# Python
pip install perplexityai
# TypeScript
npm install @perplexity-ai/perplexity_ai
Set your API key as an environment variable and make your first call:
from perplexity import Perplexity
client = Perplexity()
response = client.chat.completions.create(
model="sonar-pro",
messages=[{"role": "user", "content": "What are the latest AI developments in 2026?"}]
)
print(response.choices[0].message.content)
The response includes citations automatically:
{
"id": "pplx-1234567890",
"model": "sonar-pro",
"citations": [
"https://example.com/article1",
"https://example.com/article2"
]
}
Key Features and Capabilities
Pro Search and Multi-Step Reasoning
Pro Search, generally available since November 2025, enhances Sonar Pro with automated tool usage. When enabled with "search_type": "pro", the model performs multiple web searches and fetches URL content to answer complex queries, displaying its reasoning process in real-time.
The auto-classification feature ("search_type": "auto") intelligently routes queries based on complexity, optimizing both cost and response time.
Request Pricing by Context Size
All Sonar models offer three context tiers:
| Model | Low Context | Medium Context | High Context |
|---|---|---|---|
| Sonar | $5 per 1K requests | $8 per 1K requests | $12 per 1K requests |
| Sonar Pro (Fast) | $6 per 1K requests | $10 per 1K requests | $14 per 1K requests |
| Sonar Pro (Pro Search) | $14 per 1K requests | $18 per 1K requests | $22 per 1K requests |
Higher context retrieves more comprehensive source material, ideal for research applications.
Advanced Filtering
The Search API supports domain filtering (up to 100 URLs), date filtering, language preferences, and SafeSearch. For medical queries, developers can restrict searches to authoritative sources like PubMed and WHO.
Why Does the Perplexity API Matter?
Democratizing AI Search
Before the Perplexity API, building AI-powered search required stitching together multiple services. Perplexity consolidates retrieval, synthesis, and citation management into a single API call, reducing time-to-deployment from weeks to minutes.
The Trust Factor: Citations
Unlike generic LLM responses that may hallucinate, Perplexity’s automatic citations provide verifiability. Every claim links to its source, making the API suitable for medical information, legal research, financial analysis, and academic work.
Competitive Pricing
At $5 per 1,000 Search API requests and token-based pricing for Sonar models, Perplexity positions itself competitively. A typical Sonar query costs between $0.0057 (low context) and $0.0127 (high context).
Comparison: Perplexity API vs. Alternatives
| Feature | Perplexity API | OpenAI Web Search | Google Custom Search |
|---|---|---|---|
| Real-time data | Yes | Yes | Yes |
| AI synthesis | Yes (built-in) | Yes (via GPT) | No |
| Automatic citations | Yes | Yes | No |
| Standalone search | Yes | Limited | Yes |
| OpenAI compatibility | Full | Native | N/A |
| Starting price | $5 per 1K | Tool fees apply | $5 per 1K |
| Zero data retention | Yes (default) | Varies | N/A |
| Multi-step reasoning | Yes (Pro Search) | Yes (reasoning) | No |
OpenAI’s web search requires their Responses API or specialized models. Google Custom Search returns raw results without AI processing, requiring additional LLM integration.
Rate Limits and Scaling
Perplexity uses tiered usage limits:
| Tier | Credit Purchase | Sonar Pro RPM | Deep Research RPM |
|---|---|---|---|
| Tier 0 | $0 | 50 | 5 |
| Tier 1 | $50+ | 150 | 10 |
| Tier 2 | $250+ | 500 | 20 |
| Tier 3 | $500+ | 1,000 | 40 |
| Tier 4 | $1,000+ | 4,000 | 60 |
| Tier 5 | $5,000+ | 4,000 | 100 |
The Search API maintains 50 requests per second across all tiers.
Use Cases
- Legal Research: Case research tools pulling current precedents with citations
- Healthcare Apps: Querying medical literature filtered to authoritative sources
- Content Creation: Blog briefs grounded in current industry trends
- Customer Support: Chatbots accessing documentation and product updates
- Financial Analysis: Real-time market sentiment and breaking news monitoring
Frequently Asked Questions
What programming languages does the Perplexity API support?
The Perplexity API provides official SDKs for Python 3.8+ and Node.js/TypeScript. The API is also fully compatible with OpenAI’s SDKs—simply change the base URL to https://api.perplexity.ai/v2.
How does Perplexity API pricing compare to building my own pipeline?
Perplexity’s consolidated pricing is typically more cost-effective than maintaining separate search and LLM services. A typical query costs $0.006–$0.013 depending on context size, including both retrieval and synthesis.
Can I use my own models with Perplexity search?
Yes. The Agent API allows you to use models from OpenAI, Anthropic, Google, and xAI with Perplexity’s web search tools. Pricing follows provider token rates with no markup, plus $0.005 per web_search invocation.
Is API data used for training Perplexity’s models?
No. Perplexity’s documentation states the API has zero-day retention of user prompt data by default, and this data is never used for AI training.
What’s the difference between the Search API and Sonar API?
The Search API returns raw, ranked web results without LLM processing. The Sonar API provides AI-generated responses synthesized from search results with automatic citations. Use Search API for custom pipelines and Sonar API for ready-to-display answers.
Last updated: February 15, 2026. Pricing and features subject to change. Consult the official Perplexity documentation for the latest information.