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

52 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
- 该 Key 对账号下所有项目生效
- Key 以 `afk_` 为前缀
- 使用 bcrypt 哈希加密存储,不保存明文
## 生成 API Key
首次使用时需要生成:
1. 打开「设置」(点击右上角头像旁的齿轮图标)
2. 在「API Key」区域点击「生成 API Key」
3. **立即复制并保存**生成的密钥
> **重要**API Key 仅在生成时完整显示一次。
## 查看/复制已有 Key
如果之前已生成过 API Key
1. 打开「设置」→ API Key 区域
2. 点击「查看」或「复制」
3. 输入账号密码进行身份验证
4. 验证通过后可查看或复制
> **提示**:通过 Google/GitHub 登录的用户,需要先在「设置」中设置密码,才能执行此操作。
## 轮换 API Key
如果密钥泄露或出于安全考虑需要更换:
1. 打开「设置」→ API Key 区域
2. 点击「轮换 API Key」
3. 确认操作
轮换后的影响:
- 旧密钥**立即失效**
- 所有使用旧密钥的 MCP 客户端需要更新配置
- 新密钥同样只显示一次,请立即保存
## 安全建议
- 不要将 API Key 提交到版本控制系统
- 将包含 API Key 的 MCP 配置文件添加到 `.gitignore`
- 定期轮换 API Key
- 如果怀疑密钥泄露,立即轮换