> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/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/zh/advanced-ai/recipes/ollama-local-models.md).

# 在 Duaer 里用 Ollama 跑本地大模型

自托管的 Duaer 可以连本机或内网的 Ollama，把 Llama、Qwen 这类开源模型接到 AI Agent 和 RAG 上，数据不出你的服务器。
## 在 Duaer 里接 Ollama

1. 在服务器上装好 Ollama，拉一个模型，例如 ollama pull qwen2.5 或 ollama pull llama3.2。
2. 在 Duaer 凭证里新建 Ollama，Base URL 按部署方式填：同一台机器直接运行 Duaer 填 http://localhost:11434；Duaer 在 Docker 里填 http://host.docker.internal:11434；同一个 docker compose 里填 http://ollama:11434。见 [Duaer 里的 Ollama 凭证](/zh/integrations/builtin/credentials/ollama.md)。
3. 在 [AI Agent](/zh/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent.md) 或 [Basic LLM Chain](/zh/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm.md) 的 Chat Model 上挂 [Ollama Chat Model](/zh/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatollama.md)，从 Model 列表里选拉好的模型。
4. 点执行此步骤确认能回答。

## 全本地的 RAG

向量也想留在本地时，用 [Embeddings Ollama](/zh/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsollama.md) 代替 Embeddings OpenAI，先 ollama pull nomic-embed-text。其余步骤同 [Google Drive 文档问答](/zh/advanced-ai/recipes/rag-google-drive.md)。

## 连不上时

- Ollama 默认只听 127.0.0.1。Duaer 在别的机器或容器里时，启动 Ollama 前设 OLLAMA_HOST=0.0.0.0。
- AI Agent 要调用工具时，选支持工具调用的模型，例如 qwen2.5、llama3.1 及以上。
- Duaer 云连不到你电脑上的 localhost。要在云上用，把 Ollama 放到有 HTTPS 的反向代理后面，并在凭证里填 API Key。
## Questions

### Duaer 云能直接用我电脑上的 Ollama 吗？

不能。Duaer 云访问不到你的 localhost。用自托管的 Duaer，或把 Ollama 放到公网 HTTPS 地址并设 API Key。

### Duaer 里用 Ollama 要扣积分吗？

不扣 Duaer AI 积分。Ollama 跑在你自己的机器上，Duaer 只调用它。

## 相关

- [在 Duaer 里配置 Ollama 凭证](https://doc.duaer.com/zh/integrations/builtin/credentials/ollama.md)
- [在 Duaer 里搭一个能回答 Google Drive 文档的 AI 助手](https://doc.duaer.com/zh/advanced-ai/recipes/rag-google-drive.md)
- [在 Duaer 数字组织里使用 DeepSeek 模型](https://doc.duaer.com/zh/advanced-ai/recipes/deepseek.md)

