Skip to main content

Ollama

Overview​

Open WebUI makes it easy to connect and manage your Ollama instance. This guide will walk you through setting up the connection, managing models, and getting started.


Protocol-Oriented Design​

Open WebUI is designed to be Protocol-Oriented. This means that when we refer to "Ollama", we are specifically referring to the Ollama API Protocol (typically running on port 11434).

While some tools may offer basic compatibility, this connection type is optimized for the unique features of the Ollama service, such as native model management and pulling directly through the Admin UI.

If your backend is primarily based on the OpenAI standard (like LocalAI or Docker Model Runner), we recommend using the OpenAI-Compatible Server Guide for the best experience.


Step 1: Setting Up the Ollama Connection​

Once Open WebUI is installed and running, it will automatically attempt to connect to your Ollama instance. If everything goes smoothly, you’ll be ready to manage and use models right away.

However, if you encounter connection issues, the most common cause is a network misconfiguration. You can refer to our connection troubleshooting guide for help resolving these problems.


Step 2: Managing Your Ollama Instance​

To manage your Ollama instance in Open WebUI, follow these steps:

  1. Go to Settings > Admin > Connections in Open WebUI.
  2. Find your instance under Manage Ollama API Connections and click Manage (the download icon). From here, you can download models, configure settings, and manage your connection to Ollama.

Connection Tips​

  • Docker Users: If Ollama is running on your host machine, use http://host.docker.internal:11434 as the URL.
  • Load Balancing: You can add multiple Ollama instances. Open WebUI will distribute requests between them using a random selection strategy, providing basic load balancing for concurrent users.
    • Note: To enable this, ensure the Model IDs match exactly across instances. If you use Prefix IDs, they must be identical (or empty) for the models to merge into a single entry.

Advanced Configuration​

  • Prefix ID: If you have multiple Ollama instances serving the same model names, use a prefix (e.g., remote/) to distinguish them.
  • Model IDs (Filter): Make specific models visible by listing them here (whitelist). Leave empty to show all. Each ID goes on the list once: spaces around what you type are stripped off, and an ID that is already listed is refused with Model ID is already added.
Connection Timeout Configuration

When using multiple Ollama instances (especially across networks), connection delays can occur if an endpoint is unreachable. You can adjust the timeout using:

# Lower the timeout (default is 10 seconds) for faster failover
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST=3

If you've saved an unreachable URL and can't access Settings to fix it, see the Model List Loading Issues troubleshooting guide.

Here’s what the management screen looks like:

Ollama Management Screen

Ollama Management Screen

A Quick and Efficient Way to Download Models​

If you’re looking for a faster option to get started, you can download models directly from the Model Selector. Simply type the name of the model you want, and if it’s not already available, Open WebUI will prompt you to download it from Ollama.

Here’s an example of how it works:

Ollama Download Prompt

This method is perfect if you want to skip navigating through the Admin Settings menu and get right to using your models.


Unloading Loaded Models​

Open WebUI shows a green "Loaded" indicator next to any Ollama model that is currently kept warm by the runtime, and admins see an Eject button on the model row to unload it without restarting the server. Behind the scenes, Open WebUI calls POST /api/models/unload (admin-only), which forwards a keep_alive=0 generate call to every Ollama node serving that model.

This is useful for freeing GPU/VRAM when juggling multiple large models, or for forcing a fresh load after pulling a new revision. Trying to unload a model that the connected provider does not support unloading returns an error rather than silently failing.


Using Reasoning / Thinking Models​

Ollama separates a model's thinking from its answer on its own. Since Ollama v0.9.0, models with thinking support (Qwen3, DeepSeek-R1, DeepSeek-V3.1, GPT-OSS) return the trace in a separate thinking field, and Open WebUI shows it in a collapsible section above the answer. No server-side flag is involved, and ollama serve takes none.

Controlling Thinking​

The think (Ollama) control under Chat Controls > Advanced Params (or per model in the model editor) is sent to Ollama as the think parameter:

SettingWhat Ollama receives
DefaultNothing. Ollama's own default applies, which is thinking on for models that support it.
Ontrue
CustomA thinking level: low, medium, high or max. GPT-OSS accepts only a level.
Offfalse

A model that writes its reasoning inline as <think>...</think> text instead of using Ollama's thinking field is handled by the Reasoning Tags setting. See the Reasoning & Thinking Models Guide for both settings and the troubleshooting steps.


Context Length (num_ctx) and OLLAMA_CONTEXT_LENGTH​

How much of your conversation a model actually sees is set by the context length, and for Ollama it can come from two places, one of which quietly overrides the other:

  • OLLAMA_CONTEXT_LENGTH is set on the Ollama server and is the default context length Ollama uses for a model. Since Ollama v0.15.5, Ollama picks this default from available VRAM: 4096 below 24 GiB, 32768 from 24 to 48 GiB, and 262144 at 48 GiB and above (see Ollama's context length documentation).
  • num_ctx is an Open WebUI advanced parameter (Chat Controls > Advanced Parameters, or per model in the model editor). It is unset by default, so out of the box Ollama's OLLAMA_CONTEXT_LENGTH applies.
num_ctx overrides OLLAMA_CONTEXT_LENGTH

If num_ctx is set anywhere in Open WebUI (a model preset's parameters or the chat's Advanced Parameters), Open WebUI sends it to Ollama on every request, and a per-request num_ctx overrides the server's OLLAMA_CONTEXT_LENGTH. Toggling the num_ctx control on pre-fills it with 2048, which is very small, so it is easy to cap a model at 2048 tokens without realizing it, even after raising OLLAMA_CONTEXT_LENGTH on the Ollama side.

A context that is too small silently truncates the prompt. This is most visible with Native function calling, where tool schemas are injected into the prompt: at 2048 tokens the model can run out of room and return a blank response, or emit a raw tool-call JSON blob instead of actually calling the tool. Raising the context resolves it.

What to do:

  • To set a default for all Ollama models, set OLLAMA_CONTEXT_LENGTH on the Ollama server and leave num_ctx unset in Open WebUI so it is not overridden.
  • To set it per model or per chat, set num_ctx to a realistic value for the model (for example 8192, 16384 or the model's maximum), not the 2048 pre-fill. Remember it overrides OLLAMA_CONTEXT_LENGTH.
  • A larger context uses more VRAM and RAM, so size it to what your hardware can hold.

All Set!​

That’s it! Once your connection is configured and your models are downloaded, you’re ready to start using Ollama with Open WebUI. Whether you’re exploring new models or running your existing ones, Open WebUI makes everything simple and efficient.

If you run into any issues or need more guidance, check out our help section for detailed solutions. Enjoy using Ollama! 🎉

This content is for informational purposes only and does not constitute a warranty, guarantee, or contractual commitment. Open WebUI is provided "as is." See your license for applicable terms.