Your chatbot gives outdated answers because the model doesn't know the latest news? Clients complain that the assistant doesn't see current prices. Classic LLMs are powerless: they operate with knowledge up to the training date. Perplexity API solves this by embedding web search directly into the language model's workflow. Unlike RAG with a knowledge base that needs maintenance, Perplexity eliminates the need to store and index your own corpora. In practice, this gives not only fresh answers but real cost savings: on one project infrastructure costs dropped threefold, and response time decreased from 2 seconds to 800 ms. In combination with Google Search API + a separate LLM, Perplexity is 2–3 times cheaper, and latency p99 improves by 60%.
We integrate Perplexity API into client projects: from competitor monitoring to corporate assistants. Our team has experience in NLP and computer vision, and has completed over 30 LLM integrations for businesses. Integration takes from 3 days to a week, depending on requirements for source filtering and caching. To assess your case, simply contact us — we'll select the optimal model.
Why Perplexity API for AI Search?
Perplexity is an LLM with built-in real-time web search. Unlike regular LLMs, the model automatically searches for current information and returns answers with source links. Useful for tasks requiring data freshness: news, prices, technical changes, documentation for new versions.
Case study. On one project, we replaced Google Search API with Perplexity for searching technical documentation. Result: response time dropped from 2 seconds to 800 ms, and infrastructure costs were cut by threefold. Additionally, the model provided precise citations directly in the response, simplifying verification. This substitution proved more advantageous than traditional RAG: no need to deploy a vector database or worry about data freshness.
How to Integrate Perplexity API into Your Project?
Perplexity uses an OpenAI-compatible API, so integration is straightforward for those already familiar with the OpenAI SDK.
from openai import OpenAI
client = OpenAI(
api_key="PERPLEXITY_API_KEY",
base_url="https://api.perplexity.ai",
)
response = client.chat.completions.create(
model="llama-3.1-sonar-large-128k-online",
messages=[{"role": "user", "content": "What new features are in the latest Python version?"}],
)
print(response.choices[0].message.content)
if hasattr(response, 'citations'):
for citation in response.citations:
print(f"Source: {citation}")
Search Configuration
response = client.chat.completions.create(
model="llama-3.1-sonar-large-128k-online",
messages=[{"role": "user", "content": "Latest news on GPT-5"}],
extra_body={
"search_domain_filter": ["openai.com", "techcrunch.com"],
"search_recency_filter": "week",
"return_images": False,
"return_related_questions": True,
}
)
Offline Models (Without Search)
response = client.chat.completions.create(
model="llama-3.1-sonar-large-128k-chat",
messages=[{"role": "user", "content": "Explain Dijkstra's algorithm"}],
)
Perplexity Models
| Model | Search | Context | Recommendation |
|---|---|---|---|
| llama-3.1-sonar-huge-128k-online | Yes | 127K | High accuracy, freshness critical |
| llama-3.1-sonar-large-128k-online | Yes | 127K | Balance of speed and quality |
| llama-3.1-sonar-small-128k-online | Yes | 127K | Cost-effective option |
| llama-3.1-sonar-large-128k-chat | No | 127K | For tasks without search |
What Savings Does Switching to Perplexity Bring?
Compared to using Google Search API + a separate LLM, Perplexity reduces latency and costs. In the mentioned case, infrastructure costs dropped threefold, and latency p99 improved by 60%. The model decides when to query search and when internal knowledge suffices — cutting down on unnecessary external requests.
Use Case Scenarios
| Scenario | Filters | Example |
|---|---|---|
| News monitoring | recency=day, domain_filter=news sites | Tracking brand mentions |
| Technical documentation | recency=week, domain_filter=docs sites | Searching for API changes |
| Research | domain_filter=arxiv.org, wikipedia.org | Scientific articles |
- News and competitor monitoring — with recency and domain filters.
- Technical documentation check — the model immediately finds API changes.
- Research assistant — with verifiable sources that can be checked.
- Corporate search — over internal knowledge bases using search_domain_filter.
What's Included in the Work
- Setting up the Perplexity API client and test run.
- Handling citations and sources (parsing, validation, display).
- Domain filtering and recency filter configuration per task.
- Query caching to reduce latency and cost.
- Documentation and team training.
Work Process
- Analysis — determine required data, update frequency, budget.
- Design — select model (online/offline), configure filters.
- Integration — connect via OpenAI SDK, write citation handler.
- Testing — check latency (p99), answer accuracy, hallucination rate.
- Deployment — launch in production, set up monitoring.
Timelines
- Basic integration: from 0.5 days.
- Citation and source parsing: from 1 day.
- Integration into corporate search: from 1 week.
We'll assess your project in one day. Contact us — we'll select the optimal model and integration scheme for your tasks. Guaranteed results: all citations verifiable, answers with sources. Perplexity API documentation recommends using search_domain_filter for targeted search.
Perplexity API documentation







