Dify is a platform for building applications on top of large language models, and it talks to models through model providers. The official Ollama plugin for Dify integrates Ollama chat and completion models, vision-capable models, text embeddings, tool calling, streamed responses, and thinking output. Once Ollama is added as a provider, every app you build in Dify can use your local model, so the prompts stay on your own computer.
Add Ollama as a model provider
The plugin page gives the setup as numbered steps. First install Ollama and pull or run a model:
ollama run gemma3
ollama pull qwen3
ollama pull embeddinggemma
After startup, the local API is available at http://localhost:11434. Then, in Dify, go to the Marketplace and install the Ollama plugin, and go to Settings > Model Providers > Ollama and add a model with these fields:
| Field | What to enter |
|---|---|
| Model Name | For example gemma3, qwen3, deepseek-r1, or gpt-oss |
| Base URL | http://localhost:11434 for a local server, or https://ollama.com for Ollama cloud |
| API Key | Optional for local deployments; required for Ollama cloud |
| Model Type | Chat for tool calling, vision, and multi-turn chat |
| Model Context Length | Match the model context window |
| Upper bound for max tokens | The maximum num_predict value Dify should allow |
Two details from the plugin page catch beginners out. Do not include /api in the Base URL, because the plugin appends /api/chat, /api/generate, and /api/embed itself. And if Dify runs in Docker, localhost inside the container is the container itself, so use a host address reachable from the Dify container, such as http://host.docker.internal:11434 or a LAN IP address.
Build a chatbot app on the local model
With the provider added, go to the Studio or Applications section and click Create Application or New App, then choose the Chatbot application type. The other types are Text Generator, Agent, and Workflow. In the model configuration section, select Ollama as the provider and pick your model from the dropdown — the dropdown only shows models you have configured as providers. Configure your prompt and parameters, click Save, and test the app in the Debug and Preview panel on the right side of the screen before you publish it.
Try it: four checks from provider to reply
| Check | What you should see | What it means |
|---|---|---|
| Provider added | Ollama lists gemma3 at Base URL http://localhost:11434 |
Dify can reach your local Ollama server |
| App created | A Chatbot app in Studio with the Ollama model selected | The app is built on the local model |
| Practice question | Ask “Why is the sky blue?” in Debug and Preview | The app sends the question to your local model |
| Reply | An answer about the sky, with no API key asked for | The chatbot works end to end on local inference |
Expected result. We checked the Dify Ollama plugin page, which gives the install, model, and provider steps, and the Dify getting-started guide, which gives the Studio app types and the Debug and Preview panel. We did not install Dify, add the Ollama provider, or build an app on this machine.
Limits
This guide covers the provider connection and one plain chatbot app only. The plugin page assumes Dify is already running; installing Dify itself, usually as a Docker Compose stack, is a separate job. Vision support is only for vision-capable models such as gemma3, and function call support is only for tool-capable models, so set each to Yes only when the model supports it. Web search is not included: the plugin is a model provider, so it does not bundle Ollama web search as Dify tools, and you need a separate search tool plugin for an agent that searches the web. Ollama has no native rerank endpoint, so a rerank step needs a separate compatible service. We did not test any of this ourselves.
Sources
- Dify Marketplace — Ollama plugin — install the plugin, add a model in Settings > Model Providers > Ollama, Base URL rules, model types, Docker host address
- Get Started with Dify — Studio, Create Application, Chatbot, Text Generator, Agent, and Workflow types, Debug and Preview panel
- Ollama FAQ — the server binds 127.0.0.1 port 11434 by default
