Skip to content

Ollama 凭证(Ollama credentials)#

你可以使用以下凭据验证以下节点:

🌐 You can use these credentials to authenticate the following nodes:

先决条件(Prerequisites)#

创建并运行一个只有一个用户的 Ollama 实例。有关更多信息,请参阅 Ollama 快速入门

🌐 Create and run an Ollama instance with one user. Refer to the Ollama Quick Start for more information.

支持的身份验证方法(Supported authentication methods)#

  • 实例 URL

有关该服务的更多信息,请参阅 Ollama 的 API 文档

🌐 Refer to Ollama's API documentation for more information about the service.

View n8n's Advanced AI documentation.

使用实例 URL(Using instance URL)#

要配置此凭据,你需要:

🌐 To configure this credential, you'll need:

  • 你的 Ollama 实例或远程身份验证的 Ollama 实例的 基础 URL
  • (可选)用于 Bearer 令牌认证的 API 密钥,如果连接到远程的、需要身份验证的代理。

默认的 基础 URLhttp://localhost:11434,但如果你已经设置了 OLLAMA_HOST 环境变量,请输入该值。如果你在连接本地 n8n 服务器时遇到问题,尝试使用 127.0.0.1 而不是 localhost

🌐 The default Base URL is http://localhost:11434, but if you've set the OLLAMA_HOST environment variable, enter that value. If you have issues connecting to a local n8n server, try 127.0.0.1 instead of localhost.

如果你通过经过身份验证的代理服务(例如 Open WebUI)连接到 Ollama,则必须包含 API 密钥。如果不需要身份验证,请将此字段留空。提供时,API 密钥会作为 Bearer 令牌通过请求到 Ollama API 的 Authorization 头发送。

🌐 If you're connecting to Ollama through authenticated proxy services (such as Open WebUI) you must include an API key. If you don't need authentication, leave this field empty. When provided, the API key is sent as a Bearer token in the Authorization header of the request to the Ollama API.

有关详细信息,请参阅 我如何配置 Ollama 服务器?

🌐 Refer to How do I configure Ollama server? for more information.

Ollama 和自托管 n8n(Ollama and self-hosted n8n)#

如果你将 n8n 与 Ollama 托管在同一台机器上,并且它们运行在不同的容器中,则可能会遇到问题。

🌐 If you're self-hosting n8n on the same machine as Ollama, you may run into issues if they're running in different containers.

在此设置中,通过设置 OLLAMA_ORIGINS 变量或将 OLLAMA_HOST 调整为另一容器可访问的地址,为 n8n 与 Ollama 通信打开特定端口。

🌐 For this setup, open a specific port for n8n to communicate with Ollama by setting the OLLAMA_ORIGINS variable or adjusting OLLAMA_HOST to an address the other container can access.

有关更多信息,请参阅 Ollama 的我如何允许其他网页来源访问 Ollama?

🌐 Refer to Ollama's How can I allow additional web origins to access Ollama? for more information.