Agent skill
perplexity
Perplexity API for AI search. Use when user mentions "Perplexity", "AI search", or asks to search with citations.
Install this agent skill to your Project
npx add-skill https://github.com/vm0-ai/vm0-skills/tree/main/perplexity
SKILL.md
Perplexity AI
AI search engine that provides real-time web-grounded answers with source citations. Unlike traditional search, Perplexity synthesizes information from multiple sources into coherent responses.
Official docs: https://docs.perplexity.ai/
When to Use
Use this skill when you need to:
- Get real-time information with source citations
- Research topics that require up-to-date web data
- Answer complex questions that need multi-source synthesis
- Perform academic or SEC filings research
- Get AI-generated summaries grounded in current web content
Prerequisites
- Create an account at https://perplexity.ai/
- Navigate to API settings: https://perplexity.ai/account/api
- Generate an API key
Set environment variable:
export PERPLEXITY_API_KEY="pplx-your-api-key"
How to Use
1. Chat Completions (Recommended)
AI-powered Q&A with web search and citations. OpenAI SDK compatible.
Basic query with sonar model:
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "user", "content": "What is the current price of Bitcoin?"}
]
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
With system prompt:
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "system", "content": "Be precise and concise. Answer in bullet points."},
{"role": "user", "content": "What are the latest developments in AI?"}
]
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
Advanced query with sonar-pro:
Write to /tmp/perplexity_request.json:
{
"model": "sonar-pro",
"messages": [
{"role": "user", "content": "Compare the latest iPhone and Samsung Galaxy flagship phones"}
],
"temperature": 0.2,
"web_search_options": {
"search_context_size": "high"
}
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
2. Search with Domain Filter
Limit search to specific domains.
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "user", "content": "Latest research on transformer architectures"}
],
"search_domain_filter": ["arxiv.org", "openai.com", "anthropic.com"]
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
Exclude domains (add - prefix):
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "user", "content": "Best programming practices"}
],
"search_domain_filter": ["-reddit.com", "-quora.com"]
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
3. Search with Time Filter
Filter by recency.
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "user", "content": "Major tech news"}
],
"search_recency_filter": "week"
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
Filter by date range:
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "user", "content": "AI announcements"}
],
"search_after_date_filter": "12/01/2024",
"search_before_date_filter": "12/31/2024"
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
4. Academic Search
Search academic sources.
Write to /tmp/perplexity_request.json:
{
"model": "sonar",
"messages": [
{"role": "user", "content": "Recent papers on large language model alignment"}
],
"search_mode": "academic"
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
5. Raw Search API
Get raw search results without AI synthesis.
Write to /tmp/perplexity_request.json:
{
"query": "Claude AI Anthropic",
"max_results": 5
}
Then run:
curl -s -X POST "https://api.perplexity.ai/search" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
With domain and time filters:
Write to /tmp/perplexity_request.json:
{
"query": "machine learning tutorials",
"max_results": 10,
"search_domain_filter": ["github.com", "medium.com"],
"search_recency_filter": "month",
"country": "US"
}
Then run:
curl -s -X POST "https://api.perplexity.ai/search" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
6. Deep Research (Long-form)
For comprehensive research reports.
Write to /tmp/perplexity_request.json:
{
"model": "sonar-deep-research",
"messages": [
{"role": "user", "content": "Write a comprehensive analysis of the electric vehicle market in 2024"}
],
"reasoning_effort": "high"
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
7. Reasoning Model
For complex problem-solving.
Write to /tmp/perplexity_request.json:
{
"model": "sonar-reasoning-pro",
"messages": [
{"role": "user", "content": "Analyze the pros and cons of microservices vs monolithic architecture for a startup"}
]
}
Then run:
curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer $(printenv PERPLEXITY_API_KEY)" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json
Models
| Model | Description | Best For |
|---|---|---|
sonar |
Lightweight, cost-effective | Quick facts, news, simple Q&A |
sonar-pro |
Advanced search, deeper understanding | Complex queries, detailed research |
sonar-reasoning-pro |
Multi-step reasoning with search | Problem-solving, analysis |
sonar-deep-research |
Exhaustive research, reports | Academic research, market analysis |
Response Format
Chat completions return:
{
"id": "uuid",
"model": "sonar",
"choices": [
{
"message": {
"role": "assistant",
"content": "The answer with [1] citations..."
}
}
],
"citations": ["https://source1.com", "https://source2.com"],
"search_results": [
{
"title": "Source Title",
"url": "https://source.com",
"snippet": "Relevant excerpt..."
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 150,
"total_tokens": 160
}
}
Guidelines
- Model Selection: Use
sonarfor simple queries,sonar-profor complex ones - Cost Optimization: Lower
search_context_sizereduces costs (low/medium/high) - Domain Filters: Limit to 20 domains max; use
-prefix to exclude - Recency Filters: Options are
day,week,month,year - Temperature: Lower (0.1-0.3) for factual queries, higher for creative
- Rate Limits: Vary by tier; check https://docs.perplexity.ai/guides/rate-limits-usage-tiers
- Citations: Response includes numbered citations
[1]that map tocitationsarray
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
brave-search
Brave Search API for web search. Use when user says "search web", "Brave search", or asks to "find on web" without specifying Google.
supadata
Supadata API for YouTube/web data. Use when user mentions "Supadata", "YouTube data", "channel stats", or web scraping data.
roadmap-planning
Build and prioritize product roadmaps using scoring models like RICE, ICE, and value-effort matrices. Activate when creating a product roadmap, prioritizing features, sequencing initiatives, mapping dependencies, balancing team capacity, choosing between Now/Next/Later or quarterly planning, or communicating roadmap tradeoffs to executives and stakeholders.
qdrant
Qdrant API for vector search. Use when user mentions "Qdrant", "vector database", "semantic search", or embeddings storage.
calendly
Calendly scheduling API. Use when user mentions "Calendly", "calendly.com", "schedule a meeting", "booking link", "event types", or asks about interview scheduling.
stripe
Stripe API for payments. Use when user mentions "Stripe", "payment", "subscription", "billing", "invoice", or asks about payment processing.
Didn't find tool you were looking for?