> 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/api-targets/cn/llms-and-ai.md).

# LLM 和 AI

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

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

* [ChatGPT](/api-targets/cn/llms-and-ai/chatgpt.md) – 来源： `chatgpt`
* [Gemini](/api-targets/cn/llms-and-ai/gemini.md) – 来源： `gemini`
* [Perplexity](/api-targets/cn/llms-and-ai/perplexity.md) – 来源： `perplexity`

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

### 集成方式

LLM & AI 来源使用 [**Push-Pull**](/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成方式。不是保持连接打开直到响应就绪，而是提交一个任务，并在完成后收集结果：

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

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

## 请求示例

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

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

```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="/products/cn/web-scraper-api/integration-methods/push-pull.md"><strong>更多信息</strong></a>.</td><td>字符串</td></tr><tr><td><code>解析</code></td><td>设置为 <code>true</code> 以接收结构化 JSON 响应。</td><td>布尔值</td></tr><tr><td><code>geo_location</code></td><td>用于路由请求的地理位置（例如， <code>"United States"</code>).</td><td>字符串</td></tr><tr><td><code>browser_instructions</code></td><td>在渲染 JavaScript 时执行可选的自定义浏览器指令。 <a href="/products/cn/web-scraper-api/features/js-rendering-and-browser-control.md#browser-instructions"><strong>更多信息</strong></a>.</td><td>对象</td></tr></tbody></table>

\- 必填参数

{% hint style="success" %}
**注意：** 所有 LLM 目标默认启用 JavaScript 渲染。不要在 `render` 请求负载中包含它。
{% endhint %}

## 响应

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

### 提交任务

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

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

### 获取结果

一旦任务状态为 `done`，使用 `job.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**](/api-targets/cn/llms-and-ai/chatgpt.md) | [**Gemini**](/api-targets/cn/llms-and-ai/gemini.md) | [**Perplexity**](/api-targets/cn/llms-and-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 模型                                               |                           ✓                           |                          ✓                          |                              ✓                              |

– 条件返回，仅在内容出现在 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/api-targets/cn/llms-and-ai.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
