> 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/llm-he-ai.md).

# LLM 和 AI

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

* [ChatGPT](/api-targets/cn/llm-he-ai/chatgpt.md) – 来源： `chatgpt`
* [Gemini](/api-targets/cn/llm-he-ai/gemini.md) – 来源： `gemini`
* [Perplexity](/api-targets/cn/llm-he-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` sources。这些目标的完成时间比同步连接所允许的更长，因此 Push-Pull 是唯一受支持的方法。
{% endhint %}

## 请求示例

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

将 payload 提交到 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="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/f93fe40aed5366f8033cd2ebfae30e61c16a4f51"><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>"United States"</code>).</td><td>字符串</td></tr><tr><td><code>browser_instructions</code></td><td>在渲染 JavaScript 时执行可选的自定义浏览器指令。 <a href="/spaces/ZwEHB9k4MH4pDy80n9mF/pages/9d7133837001de31de5dfd0796cfbc6fdd7c78c8#browser-instructions"><strong>更多信息</strong></a>.</td><td>对象</td></tr></tbody></table>

&#x20;    \- 必填参数

{% hint style="success" %}
**注意：** 所有 LLM 目标默认启用 JavaScript 渲染。请不要在请求 payload 中包含 `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>待处理</code> 运行期间， <code>done</code> 结果准备好时， <code>故障</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>parse</code> 值。</td><td>布尔值</td></tr><tr><td><code>job.prompt</code></td><td>请求中的原始 prompt。</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` 你收到的 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 目标可用的数据字段。&#x20;

|                                                         | [**ChatGPT**](/api-targets/cn/llm-he-ai/chatgpt.md) | [**Gemini**](/api-targets/cn/llm-he-ai/gemini.md) | [**Perplexity**](/api-targets/cn/llm-he-ai/perplexity.md) |
| ------------------------------------------------------- | :-------------------------------------------------: | :-----------------------------------------------: | :-------------------------------------------------------: |
| Prompt 输入                                               |                          ✓                          |                         ✓                         |                             ✓                             |
| 解析后的输出 (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 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/llm-he-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.
