> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai.md).

# LLMs 和 AI

查找 Oxylabs 网页爬虫API 中适用于最受欢迎 LLM 和 AI 平台的抓取指南。

Oxylabs LLM 抓取器可让你向领先的 AI 平台提交提示词，并接收结构化和解析后的响应。支持的目标：

* [**ChatGPT**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai/chatgpt.md) – 来源： `chatgpt`
* [**Gemini**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai/gemini.md)– 来源： `gemini`
* [**Perplexity**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai/perplexity.md) – 来源： `perplexity`

{% hint style="success" %}
所有专用 LLM & AI 抓取器都支持 **自定义浏览器指令**. [**了解更多**](https://developers.oxylabs.io/products/cn/web-scraper-api/features/js-rendering-and-browser-control.md#browser-instructions)**.**
{% endhint %}

### 集成方法

LLM & AI 来源使用 [**Push-Pull**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成方法。你无需一直保持连接直到响应就绪，而是提交任务并在完成后获取结果：

1. **提交任务：** 将提示词发送到 Push-Pull endpoint。你会立即收到一个任务 ID，而不是结果。
2. **等待其完成：** 要么让我们通过以下方式通知你 `callback_url` （推荐），或者 [自行检查任务状态](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md#check-job-status) 。
3. **获取结果：** 一旦状态为 `完成`，获取解析后的响应。

{% hint style="info" %}
**Realtime 和 Proxy Endpoint 不可用** 用于 `chatgpt`, `gemini`，以及 `perplexity` 来源。这些目标完成所需时间超过同步连接所允许的范围，因此 Push-Pull 是唯一支持的方法。
{% endhint %}

## 请求示例

所有 LLM 目标使用的请求参数基本相同，主要区别在于提示词最大长度。

将载荷提交到 Push-Pull endpoint——完整代码示例请参见各目标页面。

```json
{
  "source": "chatgpt",
  "prompt": "best supplements for better sleep",
  "parse": true,
  "geo_location": "United States",
  "callback_url": "https://your-server.com/oxylabs-callback"
}
```

<table><thead><tr><th width="195.5">参数</th><th width="452.5">说明</th><th width="117">类型</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>要抓取的 LLM 目标。允许的值： <code>chatgpt</code>, <code>perplexity</code>, <code>gemini</code>.</td><td>字符串</td></tr><tr><td><mark style="background-color:green;"><strong><code>prompt</code></strong></mark></td><td>要提交的查询或提示词。最大长度：对于 4,000 个字符， <code>chatgpt</code>；对于 8,000 个字符 <code>perplexity</code> 和 <code>gemini</code>.</td><td>字符串</td></tr><tr><td><code>callback_url</code></td><td><strong>推荐。</strong> 任务完成后我们会在此 URL 发送通知，这样你就无需自行检查状态。 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md"><strong>更多信息</strong></a>.</td><td>字符串</td></tr><tr><td><code>parse</code></td><td>设为 <code>true</code> 以接收结构化 JSON 响应。</td><td>布尔值</td></tr><tr><td><code>geo_location</code></td><td>用于路由请求的地理位置（例如， <code>“美国”</code>).</td><td>字符串</td></tr></tbody></table>

\- 必填参数

## 响应

所有 LLM 目标都返回相同的顶层数据结构（完整响应字段参考请参见各目标页面）。

### 提交任务

提交后会返回任务详情，包括你用于获取结果的 ID。它不 **不** 包含抓取的数据。

<table><thead><tr><th width="196">字段</th><th width="452">说明</th><th width="114">类型</th></tr></thead><tbody><tr><td><code>id</code></td><td>抓取任务的唯一标识符。使用它来获取结果。</td><td>字符串</td></tr><tr><td><code>status</code></td><td>任务当前状态： <code>pending</code> 运行中， <code>完成</code> 结果就绪时， <code>faulted</code> 如果失败（仅在状态为 <code>完成</code>).</td><td>字符串</td></tr><tr><td><code>source</code></td><td>已提交 <code>source</code> value。</td><td>字符串</td></tr><tr><td><code>parse</code></td><td>已提交 <code>parse</code> value。</td><td>布尔值</td></tr><tr><td><code>prompt</code></td><td>请求中的原始提示词。</td><td>字符串</td></tr><tr><td><code>geo_location</code></td><td>请求使用的地理位置。选择前请先检查 LLM 可用性。 <code>geo_location</code>.</td><td>字符串</td></tr><tr><td><code>created_at</code></td><td>任务创建时间戳（UTC， <code>YYYY-MM-DD HH:MM:SS</code>).</td><td>字符串</td></tr><tr><td><code>updated_at</code></td><td>任务更新时间戳。</td><td>字符串</td></tr></tbody></table>

{% hint style="warning" %}
**在选择前请检查 LLM 可用性 `geo_location`**

每个 AI 服务仅在特定国家/地区可用，我们也只能从该服务本身可用的国家/地区进行抓取。例如，Gemini 在中国大陆不可用，因此带有 `"geo_location": "China"` 无法成功。

发送请求前，请查看提供方官方支持国家列表：

* **ChatGPT** – [ChatGPT 支持的国家/地区](https://help.openai.com/en/articles/7947663-chatgpt-supported-countries)
* **Gemini** – [可使用 Gemini 网页应用的地区](https://support.google.com/gemini/answer/13575153)
* **Perplexity** – 尚未发布官方列表。
  {% endhint %}

### 获取结果

一旦任务状态为 `完成`，使用 `job.id` 获取到的 ID。每个目标特有的解析内容位于 `results[].content` （完整字段参考请参见各目标页面）。

<table><thead><tr><th width="196">字段</th><th width="452">说明</th><th width="114">类型</th></tr></thead><tbody><tr><td><code>results[].job_id</code></td><td>与结果关联的任务 ID。</td><td>字符串</td></tr><tr><td><code>results[].status_code</code></td><td>页面抓取的 HTTP 状态码。</td><td>整数</td></tr><tr><td><code>results[].url</code></td><td>目标 LLM 页面。</td><td>字符串</td></tr><tr><td><code>results[].content</code></td><td>LLM 响应数据。字段因目标而异。</td><td>对象</td></tr></tbody></table>

### 按目标划分的响应数据

下表显示每个 LLM 目标可用的数据字段。

|                                                         | [**ChatGPT**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai/chatgpt.md) | [**Gemini**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai/gemini.md) | [**Perplexity**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai/perplexity.md) |
| ------------------------------------------------------- | :----------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------: |
| 提示词输入                                                   |                                                    ✓                                                   |                                                   ✓                                                  |                                                       ✓                                                      |
| 解析后的输出（JSON）                                            |                                                    ✓                                                   |                                                   ✓                                                  |                                                       ✓                                                      |
| 纯文本响应                                                   |                                                    ✓                                                   |                                                   ✓                                                  |                                                       –                                                      |
| Markdown 输出                                             |                                                    ✓                                                   |                                                   ✓                                                  |                                                       ✓                                                      |
| Markdown JSON 树                                         |                                                    ✓                                                   |                                                   –                                                  |                                                       ✓                                                      |
| <mark style="background-color:yellow;">搜索 / 相关查询</mark> |                                                    –                                                   |                                                   ✓                                                  |                                                       ✓                                                      |
| <mark style="background-color:yellow;">引文 / 来源</mark>   |                                                    ✓                                                   |                                                   ✓                                                  |                                                       ✓                                                      |
| <mark style="background-color:yellow;">购物结果</mark>      |                                                    ✓                                                   |                                                   –                                                  |                                                       –                                                      |
| <mark style="background-color:yellow;">广告</mark>        |                                                    ✓                                                   |                                                   –                                                  |                                                       –                                                      |
| 地理位置                                                    |                                                    ✓                                                   |                                                   ✓                                                  |                                                       ✓                                                      |
| 使用的 LLM 模型                                              |                                                    –                                                   |                                                   ✓                                                  |                                                       ✓                                                      |

&#x20;    － 条件性返回，仅当内容出现在 LLM 的响应中。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/llms-he-ai.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
