Loading...
Loading...
AI-powered search engine with real-time web grounding and citations
npx skill4agent add vm0-ai/vm0-skills perplexityOfficial docs: https://docs.perplexity.ai/
export PERPLEXITY_API_KEY="pplx-your-api-key"Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq .
/tmp/perplexity_request.json{
"model": "sonar",
"messages": [
{"role": "user", "content": "What is the current price of Bitcoin?"}
]
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/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?"}
]
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/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"
}
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/tmp/perplexity_request.json{
"model": "sonar",
"messages": [
{"role": "user", "content": "Latest research on transformer architectures"}
],
"search_domain_filter": ["arxiv.org", "openai.com", "anthropic.com"]
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'-/tmp/perplexity_request.json{
"model": "sonar",
"messages": [
{"role": "user", "content": "Best programming practices"}
],
"search_domain_filter": ["-reddit.com", "-quora.com"]
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/tmp/perplexity_request.json{
"model": "sonar",
"messages": [
{"role": "user", "content": "Major tech news"}
],
"search_recency_filter": "week"
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/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"
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/tmp/perplexity_request.json{
"model": "sonar",
"messages": [
{"role": "user", "content": "Recent papers on large language model alignment"}
],
"search_mode": "academic"
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/tmp/perplexity_request.json{
"query": "Claude AI Anthropic",
"max_results": 5
}bash -c 'curl -s -X POST "https://api.perplexity.ai/search" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/tmp/perplexity_request.json{
"query": "machine learning tutorials",
"max_results": 10,
"search_domain_filter": ["github.com", "medium.com"],
"search_recency_filter": "month",
"country": "US"
}bash -c 'curl -s -X POST "https://api.perplexity.ai/search" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/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"
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'/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"}
]
}bash -c 'curl -s -X POST "https://api.perplexity.ai/chat/completions" --header "Authorization: Bearer ${PERPLEXITY_API_KEY}" --header "Content-Type: application/json" -d @/tmp/perplexity_request.json'| Model | Description | Best For |
|---|---|---|
| Lightweight, cost-effective | Quick facts, news, simple Q&A |
| Advanced search, deeper understanding | Complex queries, detailed research |
| Multi-step reasoning with search | Problem-solving, analysis |
| Exhaustive research, reports | Academic research, market analysis |
{
"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
}
}sonarsonar-prosearch_context_size-dayweekmonthyear[1]citations