localhost:11434: Talking to the Ollama Server

Ollama runs a local HTTP API on port 11434, and every app that uses your local models talks to it there. The quick health check is curl http://localhost:11434/api/tags, which lists installed models. Connection refused means the Ollama server is not running; start the desktop app or run ollama serve.

Useful Ollama endpoints on 11434
RequestReturnsGood for
GET /Ollama is runningSimplest check
GET /api/tagsInstalled modelsConfirm a pull worked
POST /api/generateA completionSingle prompts
POST /api/chatA chat replyMulti-turn apps

Updated

Ollama binds to 127.0.0.1 by default, so only programs on the same machine can reach it. That default explains the two most common surprises: a Docker container that cannot connect, and a phone or second laptop on the same network that gets refused.

Check and configure the Ollama API

Health checks from a terminal

The first call returns plain text, the second JSON.

curl http://localhost:11434
curl http://localhost:11434/api/tags

Listen on all interfaces with systemd

sudo systemctl edit ollama opens an override file; add the two lines shown, save, then restart.

sudo systemctl edit ollama
# [Service]
# Environment="OLLAMA_HOST=0.0.0.0:11434"
sudo systemctl daemon-reload
sudo systemctl restart ollama

Linux service settings

The Linux installer creates a systemd service. Environment variables for it go in an override file rather than your shell profile, because the service does not read your profile. After editing, reload systemd and restart the service.

Local models are a developer's playground; a business that only wants a website does not need one, because We.Inc builds and hosts the site with no model or server running on your computer.

How it works

  1. Start Ollama from the app, or run ollama serve in a terminal.
  2. Run curl http://localhost:11434 and expect the text Ollama is running.
  3. Pull a model and confirm it appears under /api/tags.
  4. Point your app at http://localhost:11434, or the host address if it runs in a container.

Tips

  • Error 'address already in use' from ollama serve means the desktop app is already serving; you do not need a second copy.
  • Set OLLAMA_HOST=0.0.0.0:11434 to listen on every interface, and only on a network you trust, because the API has no login.
  • Web pages calling the API from another origin need that origin listed in OLLAMA_ORIGINS, or the browser blocks the response.

Frequently asked questions

What does curl http://localhost:11434/api/tags do?

It asks the local Ollama server for the models you have downloaded and returns them as JSON. An empty list means the server works but no model has been pulled yet.

Why is localhost:11434 refusing the connection?

The server is not running, or it listens on a different address set through OLLAMA_HOST. Start Ollama and check the variable in the environment of the process that launched it.

How do I reach Ollama from inside a Docker container?

Inside a container, localhost is the container. On Docker Desktop use http://host.docker.internal:11434; on Linux add --add-host=host.docker.internal:host-gateway and have Ollama listen on 0.0.0.0.

How do I set OLLAMA_HOST on a Mac?

For the desktop app run launchctl setenv OLLAMA_HOST 0.0.0.0:11434 and restart the app. For a terminal session, export the variable before running ollama serve.

Related: localhost:8501 (Streamlit), CORS explained, localhost refused to connect, Self-hosted agents.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

Product

Who It's For

Features

Resources

Company

View Sitemap