Skip to content

安装

安装 n8n

本地使用 Ollama

  1. 在右上角,点击下拉菜单并选择 Create Credential
Create a n8n Credential
  1. Add new credential 下选择 Ollama
Select Ollama under Credential
3. 确认基础 URL 已设置为 `http://localhost:11434`(如果是在本地运行)或 `http://host.docker.internal:11434`(如果通过 Docker 运行),然后点击 **Save**

注意

在不使用 Docker Desktop 的环境(例如 Linux 服务器安装)中,host.docker.internal 不会自动添加。

使用 --add-host=host.docker.internal:host-gateway 参数在 Docker 中运行 n8n

或将以下内容添加到 docker compose 文件中:

yaml
extra_hosts:
  - "host.docker.internal:host-gateway"

您应该看到 Connection tested successfully 消息。

  1. 创建新工作流时,选择 Add a first step 并选择一个 Ollama node
Add a first step with Ollama node
5. 选择您想要的模型(例如 `qwen3-coder`)
Set up Ollama credentials

连接到 ollama.com

  1. ollama.com 上创建一个 API key
  2. 在 n8n 中,点击 Create Credential 并选择 Ollama
  3. API URL 设置为 https://ollama.com
  4. 输入您的 API Key 并点击 Save