ClawSkills logoClawSkills

Perplexity Search Skill

使用 Perplexity 的 Search API 在网上搜索具有高级过滤功能的排名实时结果。当您需要搜索当前信息、市场数据或

介绍

# Perplexity Search

使用 Perplexity 的搜索 API 在网络上进行搜索,获取排名靠前、实时的结果。

## 快速开始

基础搜索:

```bash python3 {baseDir}/scripts/search.py "your search query" ```

使用选项:

```bash # Get 10 results python3 {baseDir}/scripts/search.py "AI trends 2024" --count 10

# Filter by recency python3 {baseDir}/scripts/search.py "recent AI news" --recency week

# Get raw JSON output python3 {baseDir}/scripts/search.py "market research" --json ```

## API 密钥设置

该脚本需要一个 `PERPLEXITY_API_KEY` 环境变量。

**选项 1:在 OpenClaw 配置中设置**(推荐)

添加到 `~/.openclaw/openclaw.json`:

```json { "skills": { "perplexity-search": { "env": { "PERPLEXITY_API_KEY": "your-api-key-here" } } } } ```

**选项 2:环境变量**

```bash export PERPLEXITY_API_KEY="your-api-key-here" ```

从以下地址获取你的 API 密钥: https://perplexity.ai/account/api

## 参数

- `query` - 搜索查询字符串(必需) - `--count N` - 结果数量(1-10,默认:5) - `--recency FILTER` - 时效性筛选器:`day`(天)、`week`(周)、`month`(月)或 `year`(年) - `--json` - 输出原始 JSON 而非格式化的结果

## 响应格式

API 返回:

```json { "results": [ { "title": "Article title", "url": "https://example.com/article", "snippet": "Brief excerpt from the page...", "date": "2024-01-15", "last_updated": "2024-02-01" } ], "id": "search-request-id" } ```

## 使用场景

**市场调研:** ```bash python3 {baseDir}/scripts/search.py "golf coaching Instagram trends" --count 10 ```

**最新新闻:** ```bash python3 {baseDir}/scripts/search.py "AI regulation updates" --recency week ```

**竞品分析:** ```bash python3 {baseDir}/scripts/search.py "AI golf training apps" --count 10 ```

## 定价

Perplexity 搜索 API:**每 1,000 次请求 $5**

在以下地址跟踪你的使用情况: https://perplexity.ai/account/api

## 安全

- API 密钥仅从环境变量加载 - 绝不硬编码 - 输出净化可防止终端注入 - 错误信息不会暴露敏感信息 - 30 秒超时防止请求挂起 - 对所有参数进行输入验证

## 注意事项

- 结果按相关性排序 - 包含实时网络数据 - 支持按时效性筛选 - 返回结构化的 JSON 或格式化文本 - 根据你的 Perplexity 计划应用速率限制

更多产品