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

# Perplexity API：回答、引用与搜索词

> 向 Perplexity 提问，获取回答、引用来源、相关问题、搜索词和媒体。

`PERPLEXITY` 向 Perplexity 提问，返回回答、它引用的来源以及其模型执行的搜索。

| | |
| - | - |
| taskType | `PERPLEXITY` |
| 读取 | `prompt`（回退到 `query`） |
| 积分 | 1 |
| 国家 | 可选，默认 `US`。`CN` 会以 `422 REGION_UNSUPPORTED` 拒绝。 |

## 请求

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "PERPLEXITY", "payload": { "prompt": "best CRM for a small team", "country": "US", "include": { "searchQueries": true } } }'
```

## 响应

| 字段 | 类型 | 说明 |
| - | - | - |
| `text` | string | 回答。始终存在。 |
| `sources` | array | 引用来源：`position`、`url`、`label`、`description`。始终存在。 |
| `related_queries` | string\[] | Perplexity 建议的追问问题。 |
| `search_model_queries` | array | Perplexity 模型执行的搜索，每项为 `{ query, engine, limit }`。 |
| `searchQueries` | string\[] | 以纯字符串表示的相同搜索。仅在设置 `include.searchQueries` 时返回。 |
| `images`、`videos` | array | 随回答显示的媒体：`title`、`url`、`medium`、`image`、`thumbnail`、`source`、`image_width`、`image_height`，视频另带 `duration`。 |
| `markdown` | string | Markdown 格式的回答，图片位于原处。仅在设置 `include.markdown` 时返回。 |
| `rawResponse` | array | 解析后的流事件。仅在设置 `include.rawResponse` 时返回。 |

在 `images` 和 `videos` 中，`url` 是条目所在页面，`image` 是图片本身。

例如：

```json theme={"theme":"css-variables"}
{
  "text": "HubSpot CRM and Pipedrive are the most common choices for small teams ...",
  "sources": [
    { "position": 1, "url": "https://www.example.com/crm-review", "label": "Best CRM for small teams", "description": "..." }
  ],
  "related_queries": ["Is HubSpot CRM free?"],
  "search_model_queries": [{ "query": "best CRM small team", "engine": "web", "limit": 8 }],
  "searchQueries": ["best CRM small team"]
}
```

`related_queries` 是给用户的建议。`search_model_queries` 和 `searchQueries` 是 Perplexity 实际执行的搜索。

## Include 标志

| 标志 | 效果 |
| - | - |
| `markdown` | 添加 `markdown`。 |
| `searchQueries` | 添加 `searchQueries`。 |
| `rawResponse` | 添加 `rawResponse`。 |
| `html` | 添加 `html`，即 Perplexity 显示的画面，页面保存成功时收取 0.25 积分。见 [HTML 页面](/zh/engines/html-pages.md)。 |
| `analysis` | 添加 `analysis`，1 积分。见[回答分析](/zh/engines/answer-analysis.md)。 |
| `citationAnalysis` | 对回答运行[Citation Analysis](/zh/research/citation-analysis.md)。 |

`ads` 和 `shopping` 不起作用。见 [Markdown 与原始响应](/zh/engines/response-options.md)。

## 相关内容

* [Perplexity 产品页](https://querying.ai/zh/engines/perplexity)
* [引擎概览](/zh/engines/overview.md)


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