← 返回
安全合规 Key 中文

Perplexity AI Search - security-hardened version (bash-based)

Use Perplexity API for web-grounded AI search. Use when user needs up-to-date information with source citations, factual queries about current events, or research-style answers. Default when user mentions Perplexity or needs current information with references.
使用Perplexity API进行网络搜索的AI助手。当用户需要最新信息并附有来源引用、时事事实查询,或研究类答案时使用。当用户提及Perplexity或需要带有参考文献的最新信息时,默认使用此技能。
haru3613
安全合规 clawhub v1.0.1 1 版本 99928.3 Key: 需要
★ 0
Stars
📥 1,393
下载
💾 55
安装
1
版本
#latest

概述

Perplexity AI Search (Safe Edition)

Overview

This skill provides access to the Perplexity API for web-grounded AI search. It combines large language models with real-time web search, providing accurate, up-to-date answers with source citations.

This is a security-hardened version that fixes command injection vulnerabilities found in the original perplexity-bash skill.

When to Use Perplexity vs. Built-in Search

Use Perplexity when:

  • You need current information (news, prices, events, recent developments)
  • The user asks for source citations or references
  • The user specifically mentions Perplexity or wants research-style answers

Use built-in web search when:

  • Simple factual queries
  • Quick information lookup
  • Basic URL or content retrieval

Model Selection Guide

ModelUse CaseCost
-----------------------
sonarDefault search, most queriesLow
sonar-proAdvanced search, deeper understandingMedium
sonar-reasoningComplex multi-step reasoningMedium
sonar-reasoning-proAdvanced reasoning with deep contentHigh

Quick Start

Basic Search

# Simple query (uses sonar by default)
scripts/perplexity_search.sh "What is the capital of Germany?"

# With a different model
scripts/perplexity_search.sh -m sonar-pro "Latest AI developments"

# Markdown format with citations
scripts/perplexity_search.sh -f markdown "Tesla stock analysis"

Advanced Usage

# High context for comprehensive results
scripts/perplexity_search.sh -m sonar-reasoning -c high -f markdown \
  "Compare AI models performance benchmarks"

# With custom system prompt
scripts/perplexity_search.sh -s "You are a technology analyst." \
  "Analyze current tech trends"

Options

FlagDescriptionDefault
----------------------------
-m, --modelModel to usesonar
-t, --max-tokensMaximum tokens (1-4096)4096
--temperatureSampling temperature (0.0-1.0)0.0
-c, --contextSearch context: low/medium/highmedium
-s, --systemSystem prompt(none)
-f, --formatOutput: text/markdown/jsontext
--list-modelsList available models

Search Context Size

  • low - Faster, fewer sources. Good for simple queries.
  • medium (default) - Balanced for most use cases.
  • high - Most comprehensive. Best for research.

Setup Requirements

API Key Configuration

Option 1: Config file (recommended)

Create config.json in the skill directory:

{
  "apiKey": "pplx-your-key-here"
}

Option 2: Environment variable

export PERPLEXITY_API_KEY="your-key-here"

Priority: Config file > environment variable.

Dependencies

  • bash (4.0+)
  • curl
  • python3 (for JSON construction only - no user input is eval'd)

Security Notes

This version addresses the following vulnerabilities found in the original:

  1. No command injection - User input is passed to Python via environment variables, never interpolated into code strings
  2. Input validation - All parameters are validated (numeric ranges, allowed model names, allowed context values)
  3. API key protection - The Authorization header is passed to curl via a temporary config file (curl -K, mode 600) and the request body via stdin (--data @-), so neither the API key nor the body appear in process listings (ps aux)
  4. Query length limit - Queries are capped at 8000 characters to prevent denial-of-wallet attacks
  5. Strict model allowlist - Only known valid models are accepted

Cost Awareness

Perplexity API is not free. Be mindful of usage:

  • Simple queries: ~$0.005-$0.015 per query
  • Deep research: ~$0.015-$0.03+ per query
  • Default to sonar for most queries to keep costs low.

Troubleshooting

  • Error: No API key found - Set up API key as described above
  • Error: curl not found - Install curl for your system
  • Error: Invalid model - Use --list-models to see available models

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-29 03:21 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,215 📥 266,534
security-compliance

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,720
security-compliance

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,171