# Agent 技能

URL: https://docs.router.ezat.io/zh/agents/skill

> 安装 ezat-router agent 技能，让 Claude Code 和其他 agent 能自行配置和排查 EZAT Router。

## 何时阅读本页

用本页安装 `ezat-router` 技能（skill），它教 AI agent 如何配置和排查调用 EZAT Router 的工具、SDK 和代码。本页还提供了可以直接粘贴到任何 agent 中的提示词，用来代替安装技能。

## 这个技能是什么

这个技能是一个 [Agent Skills](https://agentskills.io) 格式的文件夹：一个带有名称和描述的 `SKILL.md` 文件，加上几份简短的文档，agent 只在需要时才加载它们。Claude Code 从 `~/.claude/skills/` 和项目的 `.claude/skills/` 读取技能，其他支持 `SKILL.md` 的 agent 也可以使用同一个文件夹。

描述告诉 agent 何时使用这个技能：配置或排查任何通过 EZAT Router 调用 AI 模型的东西。任务匹配时，Claude Code 会自动加载这个技能；你也可以用 `/ezat-router` 调用它。

| 文件 | 内容 |
| --- | --- |
| `SKILL.md` | 固定的事实（base URL、key 格式、请求头、控制台）、安全规则，以及什么时候加载哪个文件 |
| `quickstart.md` | 检查 key 并发送第一个请求 |
| `claude-code.md` | 把 Claude Code 指向 EZAT Router |
| `openai.md` | OpenAI SDK 和可以填写 OpenAI base URL 的工具 |
| `sdks.md` | Python 和 TypeScript 的 Anthropic SDK，以及 curl |
| `models.md` | 选择模型、`GET /v1/models` 和别名 |
| `billing.md` | 余额、充值、请求如何计费、中断的流式输出 |
| `errors.md` | 每种错误类型、是否重试、速率限制和 `request-id` |

这个技能不包含价格和模型列表。它让 agent 实时读取这些信息：从 `GET /v1/models` 以及[模型](https://docs.router.ezat.io/zh/models.md)和[价格](https://docs.router.ezat.io/zh/pricing.md)页面读取，所以安装后的副本不会过时。

## 在 Claude Code 中安装

为你机器上的所有项目安装（`~/.claude/skills/`）：

```bash title="Install for your user"
curl -fsSL https://docs.router.ezat.io/skill/ezat-router.zip -o /tmp/ezat-router.zip
mkdir -p ~/.claude/skills
unzip -o /tmp/ezat-router.zip -d ~/.claude/skills
```

只为一个项目安装时，在项目的根目录中运行（`.claude/skills/`）：

```bash title="Install for this project"
curl -fsSL https://docs.router.ezat.io/skill/ezat-router.zip -o /tmp/ezat-router.zip
mkdir -p .claude/skills
unzip -o /tmp/ezat-router.zip -d .claude/skills
```

两种方式都会创建一个 `ezat-router/` 文件夹，里面有 `SKILL.md`。项目中的副本可以提交到仓库，让团队成员也能用上：这个技能不包含 key 或其他机密信息。

这些文件也可以逐个获取，入口是 `https://docs.router.ezat.io/skill/ezat-router/SKILL.md`，供从 URL 读取技能的 agent 使用。

### 检查是否已加载

1. 启动 Claude Code（或者保持当前会话不关：Claude Code 无需重启就能识别新技能）。如果会话启动时 `~/.claude/skills/` 或 `.claude/skills/` 还不存在，运行 `/reload-skills`。
2. 运行 `/skills`。列表中应该有 `ezat-router`。
3. 要显式使用它，输入 `/ezat-router`，后面跟上你想做的事，例如 `/ezat-router set up Claude Code with the key in $EZAT_API_KEY`。

### 更新

安装的技能是一份副本，不会自动更新。再次运行同样的命令，即可替换为最新版本。版本号在 `SKILL.md` 的 `metadata.version` 中，变更记录在[更新日志](https://docs.router.ezat.io/zh/changelog.md)中。

## 不安装也能在任何 agent 中使用

把类似下面的提示词粘贴到你的 agent 中。先在 agent 使用的终端里 export 你的 key（`export EZAT_API_KEY="ezat_sk_…"`），这样 agent 就不会在对话中看到它。

```text title="Set up Claude Code"
Read https://docs.router.ezat.io/llms.txt and set up Claude Code to use EZAT Router with the key in $EZAT_API_KEY. Don't print the key. Check it with GET /v1/models first.
```

```text title="Set up a project"
Read https://docs.router.ezat.io/llms.txt, then change this project to call AI models through EZAT Router. Read the API key from the EZAT_API_KEY environment variable, keep it out of git and out of frontend code, and pick the model from GET /v1/models.
```

```text title="Debug an error"
Read https://docs.router.ezat.io/troubleshooting.md and https://docs.router.ezat.io/reference/errors.md, then find out why my EZAT Router requests fail. The key is in $EZAT_API_KEY; don't print it.
```

## 给 AI agent 的说明

1. 技能位于 `https://docs.router.ezat.io/skill/ezat-router.zip`（一个文件夹，`ezat-router/`）。它的入口是 `https://docs.router.ezat.io/skill/ezat-router/SKILL.md`。
2. 只安装在用户要求的位置：`~/.claude/skills/` 对应用户的所有项目，`.claude/skills/` 对应单个项目。未经询问，不要覆盖文件夹同名的其他技能。
3. 不使用技能时，先读取 `https://docs.router.ezat.io/llms.txt`，然后只读取你需要的页面，并使用它们的 Markdown 版本（`https://docs.router.ezat.io/<page>.md`）。