配置教程
OpenHuman API Key 配置与管理 — 添加/更换/加密模型 Key
2026-05-25约 6 分钟阅读
OpenHuman 支持多种模型接入方式:内置订阅、自带 API Key、Ollama 本地模型。如果你选择自带 Key,这篇教你如何安全地配置和管理。
支持的 API Key 类型
| 提供商 | 获取方式 | 是否需要海外支付 |
|---|---|---|
| OpenAI | platform.openai.com | 需要海外信用卡 |
| DeepSeek | platform.deepseek.com | 支持支付宝 |
| 通义千问 | aliyun.com | 支付宝 |
| 智谱 GLM | open.bigmodel.cn | 支付宝/微信 |
| Anthropic Claude | console.anthropic.com | 需要海外信用卡 |
在 OpenHuman 中添加 Key
方法一:通过设置界面(推荐)
- 打开 OpenHuman 设置 → 模型
- 点击"添加模型"
- 选择提供商(OpenAI/DeepSeek/其他)
- 输入 API Key
- 测试连接
方法二:编辑 config.toml
[models]
fast = {
provider = "openai_compatible",
model = "gpt-4o-mini",
base_url = "https://api.openai.com/v1",
api_key = "sk-你的Key"
}密钥安全建议
- 不要分享 config.toml:这个文件包含你的 API Key
- 设置用量上限:在模型提供商控制台设置月度预算
- 使用加密存储:macOS 钥匙串或 Windows 凭据管理器
- 定期轮换 Key:每月更换一次
- 最小权限:只创建你需要的 API Key 类型
使用系统密钥链
OpenHuman 支持使用系统密钥链存储 API Key,而不是明文写在 config.toml 中:
[models]
fast = {
provider = "openai_compatible",
model = "gpt-4o-mini",
# 从系统密钥链读取,不在文件中暴露
api_key = "$KEYCHAIN:openhuman_openai"
}多个 Key 轮换
OpenHuman 支持配置多个备用 Key:
[models]
fast = {
provider = "openai_compatible",
model = "gpt-4o-mini",
base_url = "https://api.openai.com/v1",
api_key = ["sk-primary", "sk-backup1", "sk-backup2"]
}更换 Key
无论是在设置界面还是编辑 config.toml,更换 Key 后需要重启 OpenHuman 才会生效。