perplexity-search

Perform web-grounded searches with Perplexity models via LiteLLM and OpenRouter.

Updated Oct 7, 2022
One-click install
npx skills add https://github.com/tamagusko/linux-cfg --skill perplexity-search-tamagusko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perplexity-search
Source: https://github.com/tamagusko/linux-cfg/tree/main/dotfiles/claude/skills/perplexity-search
Command: npx skills add https://github.com/tamagusko/linux-cfg --skill perplexity-search-tamagusko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires litellm, and includes scripts (resource) and references (resource) components.

What problem does it solve? Language models cannot access information beyond their training cutoff, making it impossible to answer questions about recent events, new publications, or current facts. This Skill connects to Perplexity models through OpenRouter to return real-time, web-grounded answers with source citations. ## Core Features & Use Cases - Real-time web search: Query five Perplexity models (Sonar, Sonar Pro, Sonar Pro Search, Sonar Reasoning, Sonar Reasoning Pro) through a single OpenRouter API key via LiteLLM. - CLI and programmatic access: Run searches from the command line with model, token, and temperature controls, or import search_with_perplexity as a Python module and save results to JSON. - Use Case: A researcher needs papers published in 2024 on CAR-T cell therapy for B-cell lymphoma. They run the search script with the sonar-pro model and receive a cited, up-to-date synthesis saved to a JSON file for downstream processing. ## Quick Start Set the OPENROUTER_API_KEY environment variable, install litellm with uv, then ask the assistant to search the web for a specific recent topic using the perplexity-search skill.

Frequently Asked Questions about perplexity-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search the web with Perplexity models in Python?

Install litellm, set the OPENROUTER_API_KEY environment variable, then run perplexity_search.py with your query as an argument. You can also import search_with_perplexity as a module and call it with a query, model name, max_tokens, and temperature.

Which Perplexity model should I use for my search query?

Use sonar-pro as the default for general research queries, sonar for simple cost-sensitive lookups, sonar-pro-search for complex multi-step analysis, and sonar-reasoning-pro when explicit step-by-step reasoning is needed. All models support a 200K token context window.

Do I need a separate Perplexity API key to use OpenRouter?

No, a single OpenRouter API key provides access to all Perplexity models. Create an account at openrouter.ai, add credits, generate a key starting with sk-or-v1-, and set it as the OPENROUTER_API_KEY environment variable.

Why am I getting a rate limit or insufficient credits error?

Rate limit errors mean too many requests were sent in a short time; wait a few seconds or raise the limit in your OpenRouter key settings. Insufficient credits errors require adding funds at openrouter.ai/account or enabling auto-recharge.

How much does a Perplexity search query cost through OpenRouter?

Approximate costs per query are $0.001-0.002 for Sonar, $0.002-0.005 for Sonar Pro, $0.005-0.010 for Sonar Reasoning Pro, and $0.020-0.050 or more for Sonar Pro Search. Monitor spending at openrouter.ai/activity and set usage limits on your key.