Files
agent-fox/docs/getting-started/generate-api-key.md
2026-04-12 20:15:41 +08:00

50 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 生成 API Key
API Key 是 LLM 客户端连接 AgentFox MCP 服务的认证凭证。你需要先生成一个 API Key 才能使用 MCP 服务。
## 生成步骤
1. 进入任意项目的详情页
2. 点击页面顶部的「设置」(用户头像旁)
3. 在「API Key」区域点击「生成 API Key」
4. 生成的密钥会立即显示
> **重要**API Key 仅在生成时显示一次,之后无法再次查看完整密钥。请立即复制并安全保存。
## API Key 格式
API Key 以 `afk_` 为前缀,例如:
```
afk_dGhpcyBpcyBhIHNhbXBsZQ
```
## 安全说明
- API Key 使用 bcrypt 哈希加密存储AgentFox 不保存明文密钥
- 一个账号只有一个 API Key对该账号下所有项目生效
- 如果你通过第三方登录Google/GitHub需要先在「设置」中设置密码才能查看或复制 API Key
## 查看和复制已有 Key
如果你之前已生成过 API Key
1. 打开「设置」
2. 在 API Key 区域,点击「查看」或「复制」
3. 输入账号密码进行验证
4. 验证通过后可查看或复制完整密钥
## 轮换 API Key
如果密钥泄露或需要更新:
1. 打开「设置」→ API Key 区域
2. 点击「轮换 API Key」
3. 确认操作
> **注意**:轮换后旧密钥立即失效,所有使用旧密钥的 MCP 客户端需要更新配置。
## 下一步
拿到 API Key 后,就可以 [连接你的第一个 LLM 客户端](connect-first-client.md) 了。