> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/advanced-ai/recipes/ollama-local-models.md).

# Run local models with Ollama in Duaer

A self-hosted Duaer can reach Ollama on the same machine or network and plug open models such as Llama and Qwen into AI Agents and RAG, keeping data on your servers.
## Connect Ollama in Duaer

1. Install Ollama on the server and pull a model, such as ollama pull qwen2.5 or ollama pull llama3.2.
2. Create an Ollama credential in Duaer and set Base URL by deployment: http://localhost:11434 when Duaer runs directly on the same machine; http://host.docker.internal:11434 when Duaer runs in Docker; http://ollama:11434 in the same docker compose. Refer to [Ollama credentials in Duaer](/integrations/builtin/credentials/ollama.md).
3. On Chat Model of an [AI Agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent.md) or [Basic LLM Chain](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm.md), attach [Ollama Chat Model](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatollama.md) and pick the pulled model from Model.
4. Select Execute step to confirm it answers.

## Fully local RAG

To keep vectors local too, use [Embeddings Ollama](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsollama.md) instead of Embeddings OpenAI after ollama pull nomic-embed-text. The rest matches [the Google Drive chatbot](/advanced-ai/recipes/rag-google-drive.md).

## When it cannot connect

- Ollama listens on 127.0.0.1 by default. When Duaer runs on another host or container, set OLLAMA_HOST=0.0.0.0 before starting Ollama.
- When an AI Agent calls tools, pick a model with tool calling, such as qwen2.5 or llama3.1 and later.
- Duaer cloud cannot reach localhost on your computer. To use it from the cloud, put Ollama behind an HTTPS reverse proxy and set API Key in the credential.
## Questions

### Can Duaer cloud use Ollama on my computer?

No. Duaer cloud cannot reach your localhost. Self-host Duaer, or expose Ollama over HTTPS with an API key.

### Does Ollama in Duaer use AI credits?

No Duaer AI credits. Ollama runs on your machine; Duaer only calls it.

## Related

- [Set up Ollama credentials in Duaer](https://doc.duaer.com/integrations/builtin/credentials/ollama.md)
- [Build a Duaer chatbot that answers from Google Drive docs](https://doc.duaer.com/advanced-ai/recipes/rag-google-drive.md)
- [Use DeepSeek models in a Duaer digital organization](https://doc.duaer.com/advanced-ai/recipes/deepseek.md)

