> 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

了解如何将 Oxylabs OpenClaw skill 与 Oxylabs AI Studio 一起设置。

我们提供一个用于 [OpenClaw](https://docs.openclaw.ai/) 提供网页搜索和页面提取功能的 agent，通过 [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/` 目录。

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

```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="https://1216392379-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU4lV7kLC2Df45W0aLQlX%2Fuploads%2Fgit-blob-1860f9b5ae71e4aa2e8643ea3b26cffeba0a81a4%2Funknown.png?alt=media" alt="" height="332" width="624">

### `scrape` – 将单个页面获取为 Markdown

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

**响应：**

<img src="https://1216392379-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU4lV7kLC2Df45W0aLQlX%2Fuploads%2Fgit-blob-08251b350afee0adb375198f1b33bfdd8b6e2e69%2Funknown.png?alt=media" 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.
