Hugging Face(Inference)
Hugging Face Inference Providers 提供 OpenAI 兼容的 chat completions 路由 API,使用一个 token 即可访问多种模型。
- Provider:
huggingface - 鉴权:
HUGGINGFACE_HUB_TOKEN或HF_TOKEN(细粒度 token,需开启 Make calls to Inference Providers 权限) - API Base:
https://router.huggingface.co/v1
快速开始
- 在 Hugging Face 创建细粒度 token(包含 Make calls to Inference Providers 权限)。
- 运行向导并选择 Hugging Face:
openclaw onboard --auth-choice huggingface-api-key- 设置默认模型:
{
agents: {
defaults: {
model: { primary: "huggingface/deepseek-ai/DeepSeek-R1" },
},
},
}环境变量说明
如果 Gateway 以 daemon(launchd/systemd)方式运行,确保 HUGGINGFACE_HUB_TOKEN 或 HF_TOKEN
对该进程可见(例如写入 ~/.openclaw/.env,或通过 env.shellEnv 注入)。
模型发现(可选)
OpenClaw 可以通过以下接口发现可用模型列表:
GET https://router.huggingface.co/v1/models