Ollama credentials error

Describe the problem/error/question

Hello I’m new to N8n and was trying to locally run both N8n and Ollama from my Raspberry Pi 5. I was able to install ollama manually but needed to install docker for N8n to run. From there i was able to get the credentials to load using port 5678 (port 11434 wasn’t working) but now it wont load any of my models and

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.){
  "nodes": [
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "messages": {
          "values": [
            {}
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.ollama",
      "typeVersion": 1,
      "position": [
        208,
        0
      ],
      "id": "e4992bce-01c6-4ba0-8b86-c81259cf1dce",
      "name": "Message a model",
      "credentials": {
        "ollamaApi": {
          "id": "Ybo5jA5nffNvZbT3",
          "name": "Ollama account"
        }
      }
    }
  ],
  "connections": {},
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "ef745addbf293584f98bf2e6407d65c250695aff40221083333e1214abd84ea6"
  }
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @bwest14 Welcome to the n8n community!

I recommend watching this video to followup steps and validate your setup, let me know if the issue persists.

It’s most likely the endpoint you set in the ollama credential is wrong.

Since they are all in the Raspberry pi. They might be able to connect with each through internal internet. But you still need to check where they are open to each other.

Ask the AI to give you some CLI command to test in the Raspberry pi might solve this issue.

The video is great but unfortunately i don’t know how to view or set Environment variables on a raspberry pi 5. Do you happen to know how i could do that? Also sorry for the late reply got stuck in a blizzard and had to handle some stuff after.

@bwest14 For quick testing you can just hop into shell and execute something like export OLLAMA_HOST=http://localhost:11434 , and for more permanent write up when test gets successful just edit the .env file and restart your n8n container.

Try if http://host.docker.internal:11434 works as Ollama Base URL. And make sure that ollama is running, of course.

@markup I tried that and it wouldn’t connect i tried to map it to 11434 but received this error:

docker: Error response from daemon: failed to set up container networking: driver failed programming external connectivity on endpoint n8n (0caa9602f3d707a07fa02bc23aae2e2bc456009aaf02531f16a660c02a84b6c4): failed to bind host port 0.0.0.0:11434/tcp: address already in use

This is the code i used :

docker run -it --rm
–name n8n
-p 11434:11434
-e GENERIC_TIMEZONE=MDT
-e TZ=MDT
-e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
-e N8N_RUNNERS_ENABLED=true
-v n8n_data:/home/node/.n8n
docker.n8n.io/n8nio/n8n

You are trying to assign port 11434 to n8n, which is already in use (for ollama). The default port for n8n is 5678. Change “-p 11434:11434” to “-p 5678:5678” in your “docker run” statement and access n8n with http://localhost:5678.

5678:5678 is what i used at the beginning but it still doesn’t allow me to see my models in n8n. I think i may be misunderstanding your last comment how would i change ollama’s base URL to http://host.docker.internal:11434 ?

I meant the base URL in the ollama credentials of your “message a model” node:

No luck

H, then I’m running out of ideas. It seems ollama isn’t running.
First, check the status on your raspberry pi with:
sudo systemctl status ollama

If it is not active, start ollama with:
sudo systemctl start ollama

If it still doesn’t solve your problem, you probably need to provide your pi’s IP address in the ollama base URL.
Follow these steps:
Type hostname -I in your pi’s terminal. You should see a list of IP addresses. Note the one beginning with 192.168. (probably the first one).
In n8n, use this IP in your ollama credentials, for example:

http://192.168.178.12:11434

FYI: I have n8n running on my raspberry pi 5, now installed ollama and successfully connected it to n8n with the base URL “http://host.docker.internal:11434“:

Ahhhh Maybe i messed up somewhere in initial set up. I used a curl command to install ollama and docker to install n8n how did you do your original setup?

Almost same here. I have n8n in a DDEV environment (which is docker bsed) and installed ollama as documented:
curl -fsSL https://ollama.com/install.sh | sh
Then checked the version:
ollama --version
And downloaded and ran llama3.2:1b for testing purposes:
ollama run llama3.2:1b
Then quit the chat with /bye , switched to n8n and tested connection to ollama.

This worked wonderfully, Thank you!