Runs Perplexity-style grounded searches with citation-backed answers using Claude's WebSearch/WebFetch and keyless scholarly APIs (Europe PMC, Crossref, arXiv). Optionally uses Perplexity Sonar models via OpenRouter.
Ships in alterlab-research-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Answer questions about current information, recent literature, and facts beyond the training cutoff with web-grounded, citation-backed answers — the Perplexity workflow: a sharp query, current sources, and an answer in which every claim points to a source the reader can open. It needs no API key: you search with WebSearch, read with WebFetch, and query keyless scholarly APIs for papers. Perplexity's own Sonar models (one OpenRouter key covers all of them) are an optional backend when the user asks for Perplexity.
Use for: current developments, latest publications, citation-grounded answers, verifying a claim against current sources, or anything past the training cutoff.
Skip for: arithmetic/logic, code execution, or facts well within training data (answer directly).
| Scenario | Use Instead |
|---|---|
Unsure which search backend fits; want automatic routing and results saved to sources/ | alterlab-research-lookup |
| General web, market, or technical research via Parallel, or extracting a known URL | alterlab-parallel-web |
| Per-paper structured experimental data (sample sizes, effect sizes, quality scores) | alterlab-bgpt-search |
| Reproducible biomedical database search by MeSH terms or PMIDs | alterlab-pubmed |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-research-lookup) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=TITLE_ABS:(<terms>)&format=json&resultType=core&pageSize=10 (biomedicine, abstracts, sort=CITED%20desc for influential work; DOI:"<doi>" to fetch one record),
https://api.crossref.org/works?query.bibliographic=<terms>&rows=10 (every discipline, is-referenced-by-count; /works/<DOI> for one record),
https://export.arxiv.org/api/query?search_query=all:<word>+AND+all:<word>&max_results=10 (preprints).
Semantic Scholar (https://api.semanticscholar.org/graph/v1/paper/search?query=<terms>&fields=title,year,venue,externalIds,citationCount) also answers keyless, but its keyless pool is shared and rate-limited (HTTP 429 when busy; back off and retry) — use it as an extra, not the only source.[n] on every factual sentence, exact figures as the source states them (effect sizes with CIs, dates, counts), conflicts between sources flagged with which is stronger (evidence hierarchy: meta-analyses > RCTs > cohort > case reports > expert opinion), and a numbered source list: title, publisher/journal, year, DOI or URL, and the retrieval date. Cite the underlying sources, never "Perplexity" or "a search engine".sources/search_YYYYMMDD_HHMMSS_<topic>.md with the queries, retrieval date, the answer and the source list — the keyless equivalent of --output results.json.If the user asked specifically for Perplexity and there is no key, say so in the first line ("Perplexity needs OPENROUTER_API_KEY, which is not set"), then — unless they only wanted Perplexity — give the keyless answer above, labelled as WebSearch-based, never presented as Perplexity output.
Use it when the user asks for Perplexity or a specific Sonar model and OPENROUTER_API_KEY is set. Without the key the script exits 1 before sending anything and prints the keyless alternative.
# 1. Get a key at https://openrouter.ai/keys and add credits ($5+ recommended)
# 2. Configure (either form works; setup_env.py writes .env with owner-only permissions)
export OPENROUTER_API_KEY='sk-or-v1-your-key-here'
python scripts/setup_env.py --api-key sk-or-v1-your-key-here # writes .env
# 3. Verify. LiteLLM needs no install step: uv resolves it per call, without a virtualenv
uv run --python ">=3.11" --with litellm python scripts/perplexity_search.py --check-setup
--check-setup reads the live environment, not .env. After setup_env.py, load the file with set -a; source .env; set +a (plain source does not export) or use python-dotenv, so the variable is actually in scope. Ask the user to set the key themselves rather than pasting it into the conversation. See references/openrouter_setup.md for full setup, security, and troubleshooting.
uv run --python ">=3.11" --with litellm python scripts/perplexity_search.py "What are the latest developments in CRISPR gene editing?"
uv run --python ">=3.11" --with litellm python scripts/perplexity_search.py "Recent CAR-T therapy clinical trials" --output results.json
uv run --python ">=3.11" --with litellm python scripts/perplexity_search.py "Compare mRNA and viral vector vaccines" --model sonar-pro-search
uv run --python ">=3.11" --with litellm python scripts/perplexity_search.py "Quantum computing for drug discovery" --verbose
Where LiteLLM is already installed, plain python scripts/perplexity_search.py … works the same. The CLI takes the bare model name (e.g. sonar-pro); the script prepends openrouter/perplexity/ automatically.
Select with --model (or set DEFAULT_MODEL):
| Model | Use it for |
|---|---|
sonar-pro (default) | General research, balanced cost/quality |
sonar-pro-search | Most advanced agentic, multi-step search; comprehensive comparisons. Highest cost; OpenRouter-exclusive |
sonar | Simple fact lookups, cost-sensitive bulk queries |
sonar-reasoning-pro | Tasks needing explicit step-by-step reasoning |
sonar-reasoning was retired on OpenRouter (not listed as of 2026-09-23) and the CLI no longer accepts it; a stale DEFAULT_MODEL=sonar-reasoning now fails fast with a clear error. See references/model_comparison.md for detailed trade-offs, pricing, context windows, and sonar-deep-research for programmatic use. On the keyless path, the equivalent of sonar-pro-search is simply more searches: plan sub-questions, search each, and open more sources before comparing.
from scripts.perplexity_search import search_with_perplexity
result = search_with_perplexity(
query="What are the latest CRISPR developments?",
model="openrouter/perplexity/sonar-pro", # full path required when calling directly
max_tokens=4000,
temperature=0.2,
)
if result["success"]:
print(result["answer"])
print(f"Tokens: {result['usage']['total_tokens']}")
else:
print(f"Error: {result['error']}")
Saved JSON (--output) carries answer, model, usage, and citations — a deduplicated list of {url, title} gathered from OpenRouter's url_citation annotations and Perplexity's citations/search_results fields, present when the model returns sources. Process with jq '.answer' or jq '.citations[].url'. Cite the underlying sources, not Perplexity, and open any source you quote: answers are generated summaries and can misattribute a claim.
Pricing is per token (plus a per-request fee on sonar-pro-search); rough per-query order: sonar < sonar-pro < sonar-reasoning-pro < sonar-pro-search. Control spend by matching the model to the query, capping --max-tokens, and setting a spending limit in the OpenRouter dashboard. Monitor usage at https://openrouter.ai/activity. Exact rates: references/model_comparison.md and https://openrouter.ai/perplexity.
OPENROUTER_API_KEY — needed by scripts/perplexity_search.py, not by the skillDEFAULT_MODEL (default sonar-pro), DEFAULT_MAX_TOKENS (default 4000), DEFAULT_TEMPERATURE (default 0.2) — honored as CLI defaults; override per call with the matching flag.Be specific (domain + time frame + desired output). Examples that work well on both paths:
Add source preferences ("peer-reviewed", "clinicaltrials.gov", "FDA-approved") for higher-quality grounding. Full query-design patterns, domain templates, and pitfalls live in references/search_strategies.md.
scripts/perplexity_search.py — optional Perplexity search CLI / importable functionscripts/setup_env.py — key setup and validation for the optional backendreferences/openrouter_setup.md — setup, security, troubleshootingreferences/model_comparison.md — model selection and pricingreferences/search_strategies.md — query design (applies to both paths)assets/.env.example — environment templatePart of the AlterLab Academic Skills suite.
What SKILL.md sets; muted values are Claude Code's defaults
2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
14 skills in this plugin
/alterlab-bgpt-searchSearch scientific papers and retrieve structured experimental evidence from their full text — methods, results, sample sizes, effect sizes, risk-of-bias / quality assessment, limitations and conclusions, 25+ fields per paper, each value traced to the section it came from. Keyless by default — finds open-access studies in Europe PMC / PubMed Central, pulls their full text with the bundled script, and Claude extracts the fields; the BGPT MCP server (search_papers, lookup_paper by DOI) is an optional backend for its pre-extracted records (first 50 results free, then BGPT_API_KEY). Use when running a literature review or evidence synthesis, or when needing experimental details (sample sizes, effect sizes, methods, quality scores) that abstracts alone do not provide. Part of the AlterLab Academic Skills suite./alterlab-citation-graphFree ResearchRabbit / Connected Papers analog — builds a citation and co-citation graph around one or more seed papers from open citation data (the OpenCitations index and Semantic Scholar, with titles from Crossref), with no API key, account or subscription. Walks both directions of the citation network (works the seed cites and works that cite the seed), ranks the discovered neighbourhood by co-citation strength and bibliographic coupling to surface the papers most central to a topic's literature, and exports the network as GraphML (Gephi / Cytoscape / yEd) and JSON. Use when mapping a literature landscape, finding seminal or highly co-cited papers from a seed DOI, snowballing a reference network, building a citation map / co-citation analysis, or visualizing how a research area's papers connect. Part of the AlterLab Academic Skills suite./alterlab-research-tools:alterlab-perplexityfrom alterlab-research-tools
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-research-toolsOther plugins' skills for the same job