perplexity-search

118
9
Source

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 OpenRouter API key.

Install

mkdir -p .claude/skills/perplexity-search && curl -L -o skill.zip "https://mcp.directory/api/skills/download/367" && unzip -o skill.zip -d .claude/skills/perplexity-search && rm skill.zip

Installs to .claude/skills/perplexity-search

About this skill

Perplexity Search

Overview

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).

When to Use This Skill

Use this skill when:

  • Searching for current information or recent developments (2024 and beyond)
  • Finding latest scientific publications and research
  • Getting real-time answers grounded in web sources
  • Verifying facts with source citations
  • Conducting literature searches across multiple domains
  • Accessing information beyond the model's knowledge cutoff
  • Performing domain-specific research (biomedical, technical, clinical)
  • Comparing current approaches or technologies

Do not use for:

  • Simple calculations or logic problems (use directly)
  • Tasks requiring code execution (use standard tools)
  • Questions well within the model's training data (unless verification needed)

Quick Start

Setup (One-time)

  1. Get OpenRouter API key:

  2. Configure environment:

    # 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
    
  3. Install dependencies:

    uv pip install litellm
    
  4. Verify setup:

    python scripts/perplexity_search.py --check-setup
    

See references/openrouter_setup.md for detailed setup instructions, troubleshooting, and security best practices.

Basic Usage

Simple search:

python scripts/perplexity_search.py "What are the latest developments in CRISPR gene editing?"

Save results:

python scripts/perplexity_search.py "Recent CAR-T therapy clinical trials" --output results.json

Use specific model:

python scripts/perplexity_search.py "Compare mRNA and viral vector vaccines" --model sonar-pro-search

Verbose output:

python scripts/perplexity_search.py "Quantum computing for drug discovery" --verbose

Available Models

Access models via --model parameter:

  • sonar-pro (default): General-purpose search, best balance of cost and quality
  • sonar-pro-search: Most advanced agentic search with multi-step reasoning
  • sonar: Basic model, most cost-effective for simple queries
  • sonar-reasoning-pro: Advanced reasoning with step-by-step analysis
  • sonar-reasoning: Basic reasoning capabilities

Model selection guide:

  • Default queries → sonar-pro
  • Complex multi-step analysis → sonar-pro-search
  • Explicit reasoning needed → sonar-reasoning-pro
  • Simple fact lookups → sonar
  • Cost-sensitive bulk queries → sonar

See references/model_comparison.md for detailed comparison, use cases, pricing, and performance characteristics.

Crafting Effective Queries

Be Specific and Detailed

Good examples:

  • "What are the latest clinical trial results for CAR-T cell therapy in treating B-cell lymphoma published in 2024?"
  • "Compare the efficacy and safety profiles of mRNA vaccines versus viral vector vaccines for COVID-19"
  • "Explain AlphaFold3 improvements over AlphaFold2 with specific accuracy metrics from 2023-2024 research"

Bad examples:

  • "Tell me about cancer treatment" (too broad)
  • "CRISPR" (too vague)
  • "vaccines" (lacks specificity)

Include Time Constraints

Perplexity searches real-time web data:

  • "What papers were published in Nature Medicine in 2024 about long COVID?"
  • "What are the latest developments (past 6 months) in large language model efficiency?"
  • "What was announced at NeurIPS 2023 regarding AI safety?"

Specify Domain and Sources

For high-quality results, mention source preferences:

  • "According to peer-reviewed publications in high-impact journals..."
  • "Based on FDA-approved treatments..."
  • "From clinical trial registries like clinicaltrials.gov..."

Structure Complex Queries

Break complex questions into clear components:

  1. Topic: Main subject
  2. Scope: Specific aspect of interest
  3. Context: Time frame, domain, constraints
  4. Output: Desired format or type of answer

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.

Common Use Cases

Scientific Literature Search

python 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

Technical Documentation

python 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

Comparative Analysis

python 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

Clinical Research

python 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

Trend Analysis

python 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

Working with Results

Programmatic Access

Use perplexity_search.py as a module:

from 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']}")

Save and Process Results

# 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'

Batch Processing

Create a script for multiple queries:

#!/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

Cost Management

Perplexity models have different pricing tiers:

Approximate costs per query:

  • Sonar: $0.001-0.002 (most cost-effective)
  • Sonar Pro: $0.002-0.005 (recommended default)
  • Sonar Reasoning Pro: $0.005-0.010
  • Sonar Pro Search: $0.020-0.050+ (most comprehensive)

Cost optimization strategies:

  1. Use sonar for simple fact lookups
  2. Default to sonar-pro for most queries
  3. Reserve sonar-pro-search for complex analysis
  4. Set --max-tokens to limit response length
  5. Monitor usage at https://openrouter.ai/activity
  6. Set spending limits in OpenRouter dashboard

Troubleshooting

API Key Not Set

Error: "OpenRouter API key not configured"

Solution:

export 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

LiteLLM Not Installed

Error: "LiteLLM not installed"

Solution:

uv pip install litellm

Rate Limiting

Error: "Rate limit exceeded"

Solutions:

  • Wait a few seconds before retrying
  • Increase rate limit at https://openrouter.ai/keys
  • Add delays between requests in batch processing

Insufficient Credits

Error: "Insufficient credits"

Solution:

See references/openrouter_setup.md for comprehensive troubleshooting guide.

Integration with Other Skills

This skill complements other scientific skills:

Literature Review

Use with literature-review skill:

  1. Use Perplexity to find recent papers and preprints
  2. Supplement PubMed searches with real-time web results
  3. Verify citations and find related work
  4. Discover latest developments post-database indexing

Scientific Writing

Use with scientific-writing skill:

  1. Find recent references for introduction/discussion
  2. Verify current state of the art
  3. Check latest terminology and conventions
  4. Identify recent competing approaches

Hypothesis Generation

Use with hypothesis-generation skill:

  1. Search for latest research findings
  2. Identify current gaps in knowledge
  3. Find recent methodological advances
  4. Discover emerging research directions

Critical Thinking

Use with scientific-critical-thinking skill:

  1. Find evidence for and against hypotheses
  2. Locate methodological critiques
  3. Identify controversies in the field
  4. Verify claims with current evidence

Best Practices

Query Design

  1. Be specific: Include domain, time frame, and constraints
  2. Use terminology: Domain-appropriate k

Content truncated.

software-architecture

davila7

Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.

473165

scroll-experience

davila7

Expert in building immersive scroll-driven experiences - parallax storytelling, scroll animations, interactive narratives, and cinematic web experiences. Like NY Times interactives, Apple product pages, and award-winning web experiences. Makes websites feel like experiences, not just pages. Use when: scroll animation, parallax, scroll storytelling, interactive story, cinematic website.

12580

planning-with-files

davila7

Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls.

7968

humanizer

davila7

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases. Credits: Original skill by @blader - https://github.com/blader/humanizer

10352

game-development

davila7

Game development orchestrator. Routes to platform-specific skills based on project needs.

14749

2d-games

davila7

2D game development principles. Sprites, tilemaps, physics, camera.

12944

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,5751,370

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

1,1171,191

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

1,4181,109

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

1,199751

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

1,158685

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

1,322617

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.