> 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/integrations/cn/ai-studio-integrations/openclaw.md).

# OpenClaw

我们提供一个用于 [OpenClaw](https://docs.openclaw.ai/) 代理，可通过 [Oxylabs AI Studio](https://aistudio.oxylabs.io/)进行网页搜索和页面提取，包括地理定向搜索、JavaScript 渲染和 Markdown 内容提取。

## 要求

* `python 3` 在 `PATH`
* [OpenClaw](https://github.com/openclaw/openclaw) 中已安装并运行
* Oxylabs AI Studio [API 密钥](https://aistudio.oxylabs.io/api-key)

## 安装

```shellscript
openclaw skills install @oxylabs/oxylabs-web-search
```

它会安装到当前工作区的 `skills/` 目录中。&#x20;

添加 `--global` 可安装到 `~/.openclaw/skills`，使该技能对所有本地代理可见：

```shellscript
openclaw skills install @oxylabs/oxylabs-web-search --global
```

启用前验证该技能：

```shellscript
openclaw skills verify @oxylabs/oxylabs-web-search
```

当 ClawHub 将验证标记为失败时，命令会以非零状态退出。

## 配置

该技能读取 `OXYLABS_AI_STUDIO_API_KEY`。请通过以下三种方式之一提供。

#### 选项 1：OpenClaw 配置（推荐）

添加一项到 `~/.openclaw/openclaw.json`:

```json
{
  "skills": {
    "entries": {
      "oxylabs-web-search": {
        "enabled": true,
        "apiKey": "YOUR_OXYLABS_AI_STUDIO_API_KEY"
      }
    }
  }
}
```

#### 选项 2：环境变量

```shellscript
export OXYLABS_AI_STUDIO_API_KEY="YOUR_OXYLABS_AI_STUDIO_API_KEY"
```

#### 选项 3： `.env` 文件

```
OXYLABS_AI_STUDIO_API_KEY=YOUR_OXYLABS_AI_STUDIO_API_KEY
```

`apiKey` 也接受 SecretRef 对象来替代明文字符串。

安装后重新启动一个 OpenClaw 会话，并确认该技能已加载：

```shellscript
openclaw skills check
```

## 用法

### `搜索` – 查找查询的页面

```shellscript
python3 scripts/oxylabs.py search "best pancake recipe" -n 5
```

**响应：**

<img src="/files/d4139c622709c1fa6321aaccc0d6740048c216db" alt="" height="332" width="624">

### `抓取` – 将一个页面作为 Markdown 获取

```shellscript
python3 scripts/oxylabs.py scrape "https://sandbox.oxylabs.io/products/1"
```

**响应：**

<img src="/files/c4e12e560fdce601423f058e2b29967f2900af20" alt="" height="348" width="624">

使用以下命令保持技能更新：

```shellscript
openclaw skills update --all
```

`openclaw skills update` 仅跟踪 ClawHub 安装。请重新安装 Git 和本地源以刷新它们。

### **输入参数**

* `query` (字符串)：要搜索的内容（**必需**，位置参数）
* `url` (字符串)：要抓取的目标 URL（**必需**，位置参数）
* `-n` (整数)：要返回的结果最大数量
* `--content` (标志)：在结果中包含页面内容
* `--geo` (字符串)：以 ISO2 格式指定搜索代理位置
* `--render-js` (标志)：渲染 JavaScript（默认：关闭）

### 用法示例

请参见 [ClawHub 上的技能列表](https://clawhub.ai/oxylabs/skills/oxylabs-web-search) 以获取完整的 `SKILL.md` 和源代码。


---

# 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/integrations/cn/ai-studio-integrations/openclaw.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.
