使用 Ollama 本地运行 — 零 API 费用

在本地硬件上用 Ollama 运行 Hermes,无需 API 密钥或订阅。

安装

curl -fsSL https://ollama.com/install.sh | sh
ollama pull gemma4:31b   # 推荐:工具调用支持最好

配置 Hermes

hermes setup  # 选择 Custom Endpoint
# Base URL: http://localhost:11434/v1
# Model: gemma4:31b

或直接编辑 ~/.hermes/config.yaml

model:
  default: "gemma4:31b"
  provider: "custom"
  base_url: "http://localhost:11434/v1"

优化

  • 上下文:创建 Modelfile 设 num_ctx 16384
  • 保持加载:OLLAMA_KEEP_ALIVE=24h
  • 增加超时:HERMES_API_TIMEOUT=1800

详见 workspace zh/guides/local-ollama-setup.md