/lej-pp-search:lej-pp-searchfrom lej-pp-search
Performs web searches via Perplexity API to discover current information, recent changes, or data that may contradict training knowledge. Use instead of built-in web search for up-to-date results.
Ships in lej-pp-search. 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.
Perplexity-Powered Search for Claude Code
Use Perplexity for web research instead of built-in WebSearch. Perplexity searches to discover new information, not to confirm existing knowledge.
All Perplexity calls use the same API endpoint. The API key is PERPLEXITY_API_KEY in the environment, or in ~/.claude/settings.json under env (then legacy environmentVariables). Do not print the key.
curl -s -X POST "https://api.perplexity.ai/chat/completions" \
-H "Authorization: Bearer ${PERPLEXITY_API_KEY:-$(jq -r '.env.PERPLEXITY_API_KEY // .environmentVariables.PERPLEXITY_API_KEY // empty' ~/.claude/settings.json)}" \
-H "Content-Type: application/json" \
-d '{"model": "sonar-pro", "messages": [{"role": "user", "content": "YOUR_QUERY"}]}'
curl -s -X POST "https://api.perplexity.ai/chat/completions" \
-H "Authorization: Bearer ${PERPLEXITY_API_KEY:-$(jq -r '.env.PERPLEXITY_API_KEY // .environmentVariables.PERPLEXITY_API_KEY // empty' ~/.claude/settings.json)}" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_NAME",
"messages": [{"role": "user", "content": "YOUR_QUERY"}],
"web_search_options": {"search_context_size": "medium"},
"search_recency_filter": "month"
}'
| Model | Use Case | Cost | Speed |
|---|---|---|---|
sonar | Quick lookups, basic facts | ~$0.005 | Fast |
sonar-pro | Quality Q&A with citations (DEFAULT) | ~$0.008 | Fast |
sonar-reasoning-pro | Complex analysis, comparisons | ~$0.01 | Moderate |
sonar-deep-research | Comprehensive reports | ~$1+ | Slow (30s-5min) |
Default to sonar-pro for most searches. Only use sonar-deep-research when explicitly asked for deep/comprehensive research.
Controls how many search results are included in the context. Higher = more thorough but more expensive.
| Value | Cost Impact | When to Use |
|---|---|---|
"low" | ~$0.006 | Quick facts, simple lookups, cost-conscious queries |
"medium" | ~$0.010 | DEFAULT - balanced depth for most questions |
"high" | ~$0.014 | Complex topics, comparisons, when thoroughness matters |
Usage:
{"web_search_options": {"search_context_size": "high"}}
Guidance:
"low" for simple factual queries ("What version is X?")"medium" (default) for general questions"high" for comparisons, analysis, or when user asks for "thorough" or "comprehensive" infoFilters search results by time. Use when freshness matters.
| Value | When to Use |
|---|---|
"day" | Breaking news, today's events, live data |
"week" | Recent updates, this week's news |
"month" | Recent releases, monthly trends |
"year" | Annual summaries, recent but not urgent |
| (omit) | All time - when recency doesn't matter |
Usage:
{"search_recency_filter": "week"}
Guidance:
"day" or "week" for news, current events, stock prices"month" for recent software releases, API changesInclude images in the response. Use when visual content is relevant.
Usage:
{"return_images": true}
Guidance:
Presenting images to users:
When images are returned, present them as clickable markdown links:
**Images:**
- [Golden Gate Bridge at sunset](https://media.istockphoto.com/...)
- [Aerial view of the bridge](https://media.istockphoto.com/...)
The response includes:
image_url — Direct link to the imageorigin_url — Source pagetitle — Description (use this as the link text)Use the image title as the link label and the returned image_url as its target.
Controls reasoning depth. Only works with sonar-reasoning-pro model.
| Value | When to Use |
|---|---|
"low" | Simple comparisons, quick analysis |
"medium" | DEFAULT - balanced reasoning |
"high" | Complex multi-factor decisions, deep analysis |
Usage:
{"model": "sonar-reasoning-pro", "reasoning_effort": "high"}
curl -s -X POST "https://api.perplexity.ai/chat/completions" \
-H "Authorization: Bearer ${PERPLEXITY_API_KEY:-$(jq -r '.env.PERPLEXITY_API_KEY // .environmentVariables.PERPLEXITY_API_KEY // empty' ~/.claude/settings.json)}" \
-H "Content-Type: application/json" \
-d '{"model": "sonar-pro", "messages": [{"role": "user", "content": "What is the latest version of Node.js?"}], "web_search_options": {"search_context_size": "low"}}'
curl -s -X POST "https://api.perplexity.ai/chat/completions" \
-H "Authorization: Bearer ${PERPLEXITY_API_KEY:-$(jq -r '.env.PERPLEXITY_API_KEY // .environmentVariables.PERPLEXITY_API_KEY // empty' ~/.claude/settings.json)}" \
-H "Content-Type: application/json" \
-d '{"model": "sonar-pro", "messages": [{"role": "user", "content": "Latest AI news"}], "search_recency_filter": "day"}'
curl -s -X POST "https://api.perplexity.ai/chat/completions" \
-H "Authorization: Bearer ${PERPLEXITY_API_KEY:-$(jq -r '.env.PERPLEXITY_API_KEY // .environmentVariables.PERPLEXITY_API_KEY // empty' ~/.claude/settings.json)}" \
-H "Content-Type: application/json" \
-d '{"model": "sonar-reasoning-pro", "messages": [{"role": "user", "content": "Compare PostgreSQL vs MySQL for a new project"}], "web_search_options": {"search_context_size": "high"}, "reasoning_effort": "high"}'
curl -s -X POST "https://api.perplexity.ai/chat/completions" \
-H "Authorization: Bearer ${PERPLEXITY_API_KEY:-$(jq -r '.env.PERPLEXITY_API_KEY // .environmentVariables.PERPLEXITY_API_KEY // empty' ~/.claude/settings.json)}" \
-H "Content-Type: application/json" \
-d '{"model": "sonar-deep-research", "messages": [{"role": "user", "content": "Comprehensive analysis of WebAssembly adoption"}]}' --max-time 300
All responses include:
{
"choices": [{"message": {"content": "The answer with [1] inline citations"}}],
"citations": ["https://source1.com", "https://source2.com"],
"search_results": [{"title": "...", "url": "...", "snippet": "..."}],
"images": ["url1", "url2"], // if return_images: true
"usage": {"search_context_size": "medium", "cost": {"total_cost": 0.02}}
}
Always include citations in your response to the user. Format them as markdown links.
The PostToolUse hook saves recognized Perplexity responses automatically. Let
that hook own persistence rather than creating a second Markdown copy manually.
Its writer creates .perplexity-research/ on the first saved result, gives each
file a unique name, and keeps new files private to your user.
Reference the saved file when reusing research. Check that it exists before
telling the user where it was saved. If the hook did not save the response, the
API answer is still available in the tool output. For manual recovery, format
the query, answer, and sources as Markdown and pass it on stdin to the plugin's
scripts/write-research.py with a filename
prefix as its only argument (1–100 letters, digits, or dashes). Run it from the
project directory. The writer reports the saved path on stderr; report a failure
if it cannot save the file.
For simple questions:
sonar-prolowFor general research:
sonar-promedium (default)For comparisons/analysis:
sonar-reasoning-prohighmedium or highFor comprehensive reports:
sonar-deep-research--max-time 300For breaking news:
sonar-promediumday or weekFrame queries to discover, not confirm:
✅ "What is the current state of X?" ✅ "What has changed in X since [date]?" ✅ "What are the latest best practices for X?"
❌ "Is X still true?" ❌ "Confirm X works this way" ❌ "Verify that X is correct"
By default, WebSearch calls are automatically blocked and redirected to Perplexity.
When the user asks to "stop auto-redirecting", "let WebSearch through", "disable auto-redirect", or similar:
~/.claude/settings.jsonenv.LEJ_AUTO_REDIRECT and environmentVariables.LEJ_AUTO_REDIRECT to "false"When the user asks to "turn auto-redirect back on" or similar:
~/.claude/settings.jsonLEJ_AUTO_REDIRECT from both env and environmentVariables, or set each to "true"Follow the README uninstall procedure. Use Claude Code's plugin manager for the installed scope and verify the resulting plugin list. Do not edit registry JSON or remove cache directories by hand. The README also covers optional marketplace removal and private API-key cleanup. Project research files remain in place; uninstalling does not revoke a remote key.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub justfinethanku/lej-perplexity-powered-search-for-claude --plugin lej-pp-searchOther plugins' skills for the same job