Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Perform AI-powered web searches with real-time information using Perplexity models via LiteLLM and OpenRouter. This skill should be used when conducting web searches for current information, finding recent scientific literature, getting grounded answers with source citations, or accessing information beyond the model's knowledge cutoff. Provides access to multiple Perplexity models including Sonar Pro, Sonar Pro Search (advanced agentic search), and Sonar Reasoning Pro through a single OpenRoute
.claude/skills/perplexity-search/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | — | — |
| case-23 | ✗→✓ | ▲ Improved | — | — |
| case-04 | ✗→✓ | ▲ Improved | — | — |
| case-21 | ✗→✓ | ▲ Improved | — | — |
| case-17 | ✗→✓ | ▲ Improved | — | — |
Perform AI-powered web searches using Perplexity models through LiteLLM and OpenRouter. Perplexity provides real-time, web-grounded answers with source citations, making it ideal for finding current information, recent scientific literature, and facts beyond the model's training data cutoff.
This skill provides access to all Perplexity models through OpenRouter, requiring only a single API key (no separate Perplexity account needed).
Use this skill when:
Do not use for:
bash # Set API key export OPENROUTER_API_KEY='sk-or-v1-your-key-here'
# Or use setup script python scripts/setup_env.py --api-key sk-or-v1-your-key-here
bash uv pip install litellm
bash python scripts/perplexity_search.py --check-setup
See references/openrouter_setup.md for detailed setup instructions, troubleshooting, and security best practices.
Simple search:
bashpython scripts/perplexity_search.py "What are the latest developments in CRISPR gene editing?"
Save results:
bashpython scripts/perplexity_search.py "Recent CAR-T therapy clinical trials" --output results.json
Use specific model:
bashpython scripts/perplexity_search.py "Compare mRNA and viral vector vaccines" --model sonar-pro-search
Verbose output:
bashpython scripts/perplexity_search.py "Quantum computing for drug discovery" --verbose
Access models via --model parameter:
Model selection guide:
sonar-prosonar-pro-searchsonar-reasoning-prosonarsonarSee references/model_comparison.md for detailed comparison, use cases, pricing, and performance characteristics.
Good examples:
Bad examples:
Perplexity searches real-time web data:
For high-quality results, mention source preferences:
Break complex questions into clear components:
Example: "What improvements does AlphaFold3 offer over AlphaFold2 for protein structure prediction, according to research published between 2023 and 2024? Include specific accuracy metrics and benchmarks."
See references/search_strategies.md for comprehensive guidance on query design, domain-specific patterns, and advanced techniques.
bashpython scripts/perplexity_search.py \ "What does recent research (2023-2024) say about the role of gut microbiome in Parkinson's disease? Focus on peer-reviewed studies and include specific bacterial species identified." \ --model sonar-pro
bashpython scripts/perplexity_search.py \ "How to implement real-time data streaming from Kafka to PostgreSQL using Python? Include considerations for handling backpressure and ensuring exactly-once semantics." \ --model sonar-reasoning-pro
bashpython scripts/perplexity_search.py \ "Compare PyTorch versus TensorFlow for implementing transformer models in terms of ease of use, performance, and ecosystem support. Include benchmarks from recent studies." \ --model sonar-pro-search
bashpython scripts/perplexity_search.py \ "What is the evidence for intermittent fasting in managing type 2 diabetes in adults? Focus on randomized controlled trials and report HbA1c changes and weight loss outcomes." \ --model sonar-pro
bashpython scripts/perplexity_search.py \ "What are the key trends in single-cell RNA sequencing technology over the past 5 years? Highlight improvements in throughput, cost, and resolution, with specific examples." \ --model sonar-pro
Use perplexity_search.py as a module:
pythonfrom scripts.perplexity_search import search_with_perplexity result = search_with_perplexity( query="What are the latest CRISPR developments?", model="openrouter/perplexity/sonar-pro", max_tokens=4000, temperature=0.2, verbose=False ) if result["success"]: print(result["answer"]) print(f"Tokens used: {result['usage']['total_tokens']}") else: print(f"Error: {result['error']}")
bash# Save to JSON python scripts/perplexity_search.py "query" --output results.json # Process with jq cat results.json | jq '.answer' cat results.json | jq '.usage'
Create a script for multiple queries:
bash#!/bin/bash queries=( "CRISPR developments 2024" "mRNA vaccine technology advances" "AlphaFold3 accuracy improvements" ) for query in "${queries[@]}"; do echo "Searching: $query" python scripts/perplexity_search.py "$query" --output "results_$(echo $query | tr ' ' '_').json" sleep 2 # Rate limiting done
Perplexity models have different pricing tiers:
Approximate costs per query:
Cost optimization strategies:
sonar for simple fact lookupssonar-pro for most queriessonar-pro-search for complex analysis--max-tokens to limit response lengthError: "OpenRouter API key not configured"
Solution:
bashexport OPENROUTER_API_KEY='sk-or-v1-your-key-here' # Or run setup script python scripts/setup_env.py --api-key sk-or-v1-your-key-here
Error: "LiteLLM not installed"
Solution:
bashuv pip install litellm
Error: "Rate limit exceeded"
Solutions:
Error: "Insufficient credits"
Solution:
See references/openrouter_setup.md for comprehensive troubleshooting guide.
This skill complements other scientific skills:
Use with literature-review skill:
Use with scientific-writing skill:
Use with hypothesis-generation skill:
Use with scientific-critical-thinking skill:
--max-tokens to control costsScripts:
scripts/perplexity_search.py: Main search script with CLI interfacescripts/setup_env.py: Environment setup and validation helperReferences:
references/search_strategies.md: Comprehensive query design guidereferences/model_comparison.md: Detailed model comparison and selection guidereferences/openrouter_setup.md: Complete setup, troubleshooting, and security guideAssets:
assets/.env.example: Example environment file templateOpenRouter:
LiteLLM:
Perplexity:
bash# LiteLLM for API access uv pip install litellm
bash# For .env file support uv pip install python-dotenv # For JSON processing (usually pre-installed) uv pip install jq
Required:
OPENROUTER_API_KEY: Your OpenRouter API keyOptional:
DEFAULT_MODEL: Default model to use (default: sonar-pro)DEFAULT_MAX_TOKENS: Default max tokens (default: 4000)DEFAULT_TEMPERATURE: Default temperature (default: 0.2)This skill provides:
Conduct AI-powered web searches to find current information, recent research, and grounded answers with source citations.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 21 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +52 percentage points is the difference between those two pass rates over the 21 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.