> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 插件

> 通过 ARouter 插件扩展任何模型的能力。通过 plugins 数组启用网页搜索、上下文压缩、自动路由等功能。

Plugins 可以扩展任何模型的能力。在请求体中传递 `plugins` 数组以激活一个或多个插件。

## 可用插件

### `web` — 网页搜索

用实时网络数据支撑响应。适用于任何模型。

| 选项                | 类型         | 描述                                   |
| ----------------- | ---------- | ------------------------------------ |
| `max_results`     | `number`   | 要检索的结果数量（默认：5）                       |
| `engine`          | `string`   | 搜索引擎：`"native"`、`"exa"`、`"parallel"` |
| `include_domains` | `string[]` | 将结果限制在这些域名                           |
| `exclude_domains` | `string[]` | 排除这些域名的结果                            |

### `context-compression` — 上下文窗口管理

自动压缩超出模型上下文窗口的提示词。

| 选项        | 类型        | 描述             |
| --------- | --------- | -------------- |
| `enabled` | `boolean` | 设为 `false` 以禁用 |

### `auto-router` — 可配置的自动路由

自定义 `auto` 路由器可以从哪些模型中进行选择。

| 选项               | 类型         | 描述                      |
| ---------------- | ---------- | ----------------------- |
| `allowed_models` | `string[]` | 限制 `auto` 可以选择的模型的通配符模式 |

## 插件执行顺序

1. **context-compression** — 如有需要，输入会被压缩
2. **web** — 搜索结果被检索并注入
3. **auto-router** — 模型选择发生（如果 `model: "auto"`）
4. 请求被转发到所选模型

## 定价

| 插件                    | 附加费用            |
| --------------------- | --------------- |
| `context-compression` | 免费              |
| `web`（Exa 引擎）         | 每 1,000 条结果 \$4 |
| `web`（Parallel 引擎）    | 每 1,000 条结果 \$4 |
| `web`（Native 引擎）      | 提供商直通（按实际费率）    |
| `auto-router`         | 免费              |
