> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Perplexity Search

> 为自治智能体提供带引用的网页答案与深度研究报告。通过一个 AIsa API key 使用 Perplexity Sonar 四档能力：快速答案、综合分析、多步推理和完整深度研究。

[在 GitHub 上查看 ->](https://github.com/AIsa-team/agent-skills/tree/main/search-research/perplexity-search)

**为自治智能体提供带引用的网页答案与深度研究。** 使用一个 `AISA_API_KEY` 访问完整 Perplexity Sonar 系列能力，从秒级查询到详尽研究报告都可覆盖。

## 安装

如果还没有安装 AIsa CLI，请先安装：

```bash theme={null}
npm install -g @aisa-one/cli
```

然后安装该技能：

```bash theme={null}
aisa skills install perplexity-search
```

## 智能体可以用它做什么？

> [card] 快速事实回答
>
> “OpenAI 最新版本发布了什么？”——几秒内返回带引用的答案。

> [card] 对比分析
>
> “按价格和功能比较 2026 年排名前三的 AI 编程智能体。”

> [card] 多步推理
>
> “分析采用 x402 与传统 API key 计费的取舍。”

> [card] 深度研究报告
>
> “生成一篇 2,000 字的 智能体浏览器框架 结构化报告。”

> [card] 实时新闻
>
> “总结本周 AI 基础设施公告。”

> [card] 决策支持
>
> “我们是否应该采用这个库？请引用采用情况、issue 和替代方案。”

## 模型档位

| Model | 适合场景 |
| - | - |
| `sonar` | 快速回答简单问题，并附带引用（秒级） |
| `sonar-pro` | 综合、对比、更长答案和更多来源 |
| `sonar-reasoning-pro` | 多步分析推理、取舍分析、技术深挖 |
| `sonar-deep-research` | 详尽长文报告；可接受数分钟处理时间 |

## 快速开始

```bash theme={null}
export AISA_API_KEY="your-key"
```

### Sonar（快速答案）

```bash theme={null}
curl -X POST "https://api.aisa.one/apis/v1/perplexity/sonar" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sonar",
    "messages": [{"role": "user", "content": "What is the Model Context Protocol?"}]
  }'
```

### Sonar Pro（综合分析）

```bash theme={null}
curl -X POST "https://api.aisa.one/apis/v1/perplexity/sonar-pro" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sonar-pro",
    "messages": [{"role": "user", "content": "Compare the performance of top AI coding agents in 2026."}]
  }'
```

### Sonar Reasoning Pro（分析推理）

```bash theme={null}
curl -X POST "https://api.aisa.one/apis/v1/perplexity/sonar-reasoning-pro" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sonar-reasoning-pro",
    "messages": [{"role": "user", "content": "Analyze the tradeoffs of adopting x402 vs. traditional billing."}]
  }'
```

### Sonar Deep Research

```bash theme={null}
curl -X POST "https://api.aisa.one/apis/v1/perplexity/sonar-deep-research" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sonar-deep-research",
    "messages": [{"role": "user", "content": "Create a 2,000-word deep research report on autonomous browser agents."}]
  }'
```

> [!TIP]
>
> 深度研究可以接受更长的处理时间，Python 客户端也实现了自动重试。对时效敏感的请求，建议降级使用 `sonar-pro` 或 `sonar-reasoning-pro`，不要长时间等待。

## Python 客户端

```bash theme={null}
# 快速答案
python3 scripts/perplexity_search_client.py sonar --query "What is MCP?"

# 综合分析
python3 scripts/perplexity_search_client.py sonar-pro --query "Compare AI coding agents 2026"

# 分析推理
python3 scripts/perplexity_search_client.py sonar-reasoning-pro --query "x402 tradeoffs"

# 深度研究（允许较长处理时间）
python3 scripts/perplexity_search_client.py sonar-deep-research --query "Agentic payments landscape"

# 可选 system message，用于控制输出格式
python3 scripts/perplexity_search_client.py sonar-pro \
  --query "Explain RAG" \
  --system "Answer in bullet points with citations inline as [1], [2]..."
```

## 端点参考

| Endpoint | Method | 用途 |
| - | - | - |
| `/perplexity/sonar` | POST | [Sonar — 快速答案](https://aisa.one/docs/api-reference/perplexity/post_perplexity-sonar.md) |
| `/perplexity/sonar-pro` | POST | [Sonar Pro — 综合分析](https://aisa.one/docs/api-reference/perplexity/post_perplexity-sonar-pro.md) |
| `/perplexity/sonar-reasoning-pro` | POST | [Sonar Reasoning Pro](https://aisa.one/docs/api-reference/perplexity/post_perplexity-sonar-reasoning-pro.md) |
| `/perplexity/sonar-deep-research` | POST | [Sonar Deep Research](https://aisa.one/docs/api-reference/perplexity/post_perplexity-sonar-deep-research.md) |

## 开始使用

1. 在 [aisa.one](https://aisa.one) 注册（新账户有 \$1 免费额度）。
2. 从控制台生成 API key。
3. `export AISA_API_KEY="your-key"` 并安装技能：
   ```bash theme={null}
   npm install -g @aisa-one/cli
   aisa skills install perplexity-search
   ```

## 相关

> [card] [Perplexity API 参考](https://aisa.one/docs/api-reference/perplexity/post_perplexity-sonar.md)
>
> 四个 Sonar 端点及交互式 Playground。

> [card] [价格](https://aisa.one/docs/zh/guides/pricing.md#模型)
>
> 各 Sonar 变体的 token 价格。

> [card] [错误码](https://aisa.one/docs/api-reference/errors.md)
>
> 处理超时和上游错误。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.