n8n 模板:DeepSeek V3 对话与 R1 推理快速启动
在 n8n 中通过四种方式接入 DeepSeek:凭证配置 → 对话式 Agent(含记忆)→ Ollama 本地部署 → HTTP Request 直连 API
- 给谁
- 已在运行 n8n、需要快速接入 DeepSeek V3/R1 的自动化搭建者
- 你会得到
- 获得一个含四种集成路径的工作流模板,可直接导入并替换凭证后运行
硬约束
前置条件:n8n 实例(自托管或 Cloud)。需准备三类凭证之一或全部:DeepSeek API Key(openAiApi 类型)、Ollama 本地端点(ollamaApi 类型)、HTTP Header Auth(用于 HTTP Request 节点)。DeepSeek API 基础地址为 https://api.deepseek.com,兼容 OpenAI 格式。本地 Ollama 需提前拉取 deepseek-r1:14b 或对应版本。
他们做了什么
作者 joe 在 n8n 官方模板库发布了一个工作流,展示四种接入 DeepSeek 的方式:通过 OpenAI 兼容格式的 lmChatOpenAi 节点调用 deepseek-reasoner、通过 lmChatOllama 节点本地运行 deepseek-r1:14b、通过 HTTP Request 节点分别用 JSON Body 和 Raw Body 直接调用 deepseek-chat(V3)与 deepseek-reasoner(R1)的 chat completions 端点。模板包含 Window Buffer Memory 为对话 Agent 提供上下文记忆。
效果如何
模板在 n8n.io 上获得超过 4 万次查看(author_report)。四种路径的节点参数、连线关系和凭证类型均在 workflow.json 中完整定义,可直接导入。
值得知道
1) 来源未提供实测性能数据或成本对比;2) deepseek-chat 模型名已映射到 V3,API 格式不变;3) Ollama 本地运行需足够显存承载 14B 或更大模型;4) HTTP Request 节点的 httpHeaderAuth 需自行在 Header 中填入 Bearer Token;5) 模板默认 inactive,导入后需手动激活;6) 本站未实测(reproduction=not_tested),导入后建议先用样例消息测试再投入生产。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- DeepSeek 节点:绑定OpenAI API 凭证。
- Ollama DeepSeek 节点:绑定ollamaApi 凭证。
- DeepSeek JSON Body 节点:绑定HTTP Header Auth 凭证。
- DeepSeek Raw Body 节点:绑定HTTP Header Auth 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #2777(约 15 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-25
步骤
配置凭证与基础参数
在 n8n 中创建凭证:1) openAiApi 类型,Base URL 填 https://api.deepseek.com,API Key 从 platform.deepseek.com/api_keys 获取;2) ollamaApi 类型,指向本地 Ollama 服务;3) httpHeaderAuth 类型,Header 名通常为 Authorization,值填 Bearer + DeepSeek API Key。Sticky Note4 提示:也可使用 https://api.deepseek.com/v1 作为 base_url,其中 v1 与模型版本无关。
搭建指导 · 来源原文。模板整体说明与快速启动指南
This n8n workflow demonstrates multiple ways to harness DeepSeek's AI models in your automation pipeline! 🌟 ## Core Features **Multiple Integration Methods** 🔌 - Local deployment using Ollama for DeepSeek-R1 - Direct API integration with DeepSeek Chat V3 - Conversational agent with memory buffer - HTTP request implementation with both raw and JSON formats **Model Options** 🧠 - DeepSeek Chat V3 for general conversation - DeepSeek-R1 for advanced reasoning - Memory-enabled agent for persistent context ## Quick Setup 🛠️ **API Configuration** - Base URL: https://api.deepseek.com - Get your API key from platform.deepseek.com/api_keys **Local Setup** 💻 - Install Ollama for local deployment - Set up DeepSeek-R1 via Ollama - Configure local credentials in n8n ## Implementation Details 🔧 **Conversational Agent** - Window Buffer Memory for context - Customizable system messages - Built-in error handling with retries **API Endpoints** 🌐 - Chat completions for V3 and R1 models - OpenAI API format compatibles
搭建指导 · 来源原文。Sticky Note4 节点内容;凭证配置参考
# Your First DeepSeek API Call The DeepSeek API uses an API format compatible with OpenAI. By modifying the configuration, you can use the OpenAI SDK or softwares compatible with the OpenAI API to access the DeepSeek API. https://api-docs.deepseek.com/ ## Configuration Parameters | Parameter | Value | |-----------|--------| | base_url | https://api.deepseek.com | | api_key | https://platform.deepseek.com/api_keys | ## Important Notes - To be compatible with OpenAI, you can also use `https://api.deepseek.com/v1` as the base_url. Note that the v1 here has NO relationship with the model's version. - The deepseek-chat model has been upgraded to DeepSeek-V3. The API remains unchanged. You can invoke DeepSeek-V3 by specifying `model='deepseek-chat'`. - deepseek-reasoner is the latest reasoning model, DeepSeek-R1, released by DeepSeek. You can invoke DeepSeek-R1 by specifying `model='deepseek-reasoner'`.
搭建对话式 Agent(含记忆)
导入模板后,找到「AI Agent」节点(conversationalAgent)与「Window Buffer Memory」节点。AI Agent 的 systemMessage 默认为 "You are a helpful assistant.";DeepSeek 节点(lmChatOpenAi)model 字段填 =deepseek-reasoner,凭证选步骤 1 创建的 openAiApi。Window Buffer Memory 保持默认参数,其 ai_memory 输出连到 AI Agent 的 ai_memory 输入。当 chat message received 触发后,Agent 将使用 DeepSeek-R1 进行带上下文的对话。
运行提示词 · 来源原文。AI Agent 节点 parameters.options.systemMessage
You are a helpful assistant.
配置 Ollama 本地模型链路
找到「Basic LLM Chain2」节点与「Ollama DeepSeek」节点。Basic LLM Chain2 的 messages.messageValues[0].message 为 "You are a helpful assistant."。Ollama DeepSeek 节点(lmChatOllama)参数:model=deepseek-r1:14b,options.format=default,options.numCtx=16384,options.temperature=0.6,凭证选 ollamaApi。Ollama DeepSeek 的 ai_languageModel 输出连到 Basic LLM Chain2 的 ai_languageModel 输入。When chat message received 的 main 输出连到 Basic LLM Chain2 的 main 输入。
运行提示词 · 来源原文。Basic LLM Chain2 节点 parameters.messages.messageValues[0].message
You are a helpful assistant.
运行提示词 · 来源原文。Ollama DeepSeek 节点 parameters.model
deepseek-r1:14b
配置 HTTP Request 直连 API(JSON Body 与 Raw Body)
模板提供两个 HTTP Request 节点示例。DeepSeek JSON Body 节点:URL=https://api.deepseek.com/chat/completions,Method=POST,specifyBody=json,jsonBody 内含 model=deepseek-chat、messages 数组(system 角色内容取 {{ $json.chatInput }},user 角色为 "Hello!"),stream=false,authentication=genericCredentialType,genericAuthType=httpHeaderAuth。DeepSeek Raw Body 节点:URL 相同,contentType=raw,rawContentType=application/json,body 内含 model=deepseek-reasoner、messages 取 {{ $json.chatInput.trim() }},stream=false,同样使用 httpHeaderAuth。分别对应 V3 与 R1 的直连调用。
运行提示词 · 来源原文。DeepSeek JSON Body 节点 parameters.jsonBody
={ "model": "deepseek-chat", "messages": [ { "role": "system", "content": "{{ $json.chatInput }}" }, { "role": "user", "content": "Hello!" } ], "stream": false }运行提示词 · 来源原文。DeepSeek Raw Body 节点 parameters.body
={ "model": "deepseek-reasoner", "messages": [ {"role": "user", "content": "{{ $json.chatInput.trim() }}"} ], "stream": false }
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限
这一段是提示词,页面不会在这里插入广告。
请在 n8n 中导入此工作流模板,按上述四步依次配置凭证、Agent 记忆链路、Ollama 本地节点、HTTP Request 直连节点。导入后先检查 connections 中的 ai_languageModel / ai_memory / main 连线是否与模板一致,再替换所有 credential-id 为实际凭证。
若仅需快速测试 DeepSeek API,优先使用步骤 4 的 HTTP Request 节点,无需配置 LangChain 节点。
来源
🐋DeepSeek V3 chat & R1 reasoning quick start · joe · n8n.io · 2025-01-22
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。