AI-powered search engine with real-time web grounding and citations
/plugin marketplace add vm0-ai/api0/plugin install api0@api0This skill inherits all available tools. When active, it can use any tool Claude has access to.
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/
Use this skill when you need to:
Set environment variable:
export PERPLEXITY_API_KEY="pplx-your-api-key"
Important: When using
$VARin a command that pipes to another command, wrap the command containing$VARinbash -c '...'. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq .
AI-powered Q&A with web search and citations. OpenAI SDK compatible.
Basic query with sonar model:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "user", "content": "What is the current price of Bitcoin?"}
]
}'"'"' | jq .'
With system prompt:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "system", "content": "Be precise and concise. Answer in bullet points."},
{"role": "user", "content": "What are the latest developments in AI?"}
]
}'"'"' | jq .'
Advanced query with sonar-pro:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"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"
}
}'"'"' | jq .'
Limit search to specific domains:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "user", "content": "Latest research on transformer architectures"}
],
"search_domain_filter": ["arxiv.org", "openai.com", "anthropic.com"]
}'"'"' | jq .'
Exclude domains (add - prefix):
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "user", "content": "Best programming practices"}
],
"search_domain_filter": ["-reddit.com", "-quora.com"]
}'"'"' | jq .'
Filter by recency:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "user", "content": "Major tech news"}
],
"search_recency_filter": "week"
}'"'"' | jq .'
Filter by date range:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "user", "content": "AI announcements"}
],
"search_after_date_filter": "12/01/2024",
"search_before_date_filter": "12/31/2024"
}'"'"' | jq .'
Search academic sources:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar",
"messages": [
{"role": "user", "content": "Recent papers on large language model alignment"}
],
"search_mode": "academic"
}'"'"' | jq .'
Get raw search results without AI synthesis:
bash -c 'curl -s -X POST "https://api.perplexity.ai/search" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"query": "Claude AI Anthropic",
"max_results": 5
}'"'"' | jq .'
With domain and time filters:
bash -c 'curl -s -X POST "https://api.perplexity.ai/search" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"query": "machine learning tutorials",
"max_results": 10,
"search_domain_filter": ["github.com", "medium.com"],
"search_recency_filter": "month",
"country": "US"
}'"'"' | jq .'
For comprehensive research reports:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar-deep-research",
"messages": [
{"role": "user", "content": "Write a comprehensive analysis of the electric vehicle market in 2024"}
],
"reasoning_effort": "high"
}'"'"' | jq .'
For complex problem-solving:
bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d '"'"'{
"model": "sonar-reasoning-pro",
"messages": [
{"role": "user", "content": "Analyze the pros and cons of microservices vs monolithic architecture for a startup"}
]
}'"'"' | jq .'
| 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 |
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
}
}
sonar for simple queries, sonar-pro for complex onessearch_context_size reduces costs (low/medium/high)- prefix to excludeday, week, month, year[1] that map to citations array