deepseek-ai-chat

DeepSeek AI Chat Model sub-node for n8n AI Agent workflows (V4-native)

Package Information

Released: 3 mo ago
Downloads: 0 weekly / 0 monthly
Latest Version: 0.1.3

Documentation

n8n-nodes-deepseek-ai-chat

DeepSeek V4-native Chat Model community node for self-hosted n8n.

Connect DeepSeek AI Chat Model to AI Agent, Basic LLM Chain, or any node that accepts an ai_languageModel connection.

npm package n8n-nodes-deepseek-ai-chat
Version 0.1.3
Node type n8n-nodes-deepseek-ai-chat.lmChatDeepSeekAi
Display name DeepSeek AI Chat Model
Credential DeepSeek AI Chat API (deepSeekAiChatApi)
License MIT
Author Danielnke

Status

Item Status
Phase 1 Chat Model sub-node Implemented
Credentials + model list Implemented
Thinking mode + reasoning effort Implemented
Host LangChain resolution (dual-package fix) Implemented (0.1.1+)
Sub-node tracing (output panel + running glow) Implemented (0.1.2+)
Cost / latency / cache meta on model panel Implemented (0.1.3+)
Build / TypeScript Passes (npm run build, npm run lint)
Git repository Initialized (main)
npm publish Not published yet (install from source)
Phase 2 action node (message / classify / FIM) Not started

Why this package?

n8n’s built-in DeepSeek Chat Model works but lags DeepSeek V4 product needs:

  • Models: deepseek-v4-flash, deepseek-v4-pro
  • Explicit thinking toggle (API defaults thinking on; we default UI to disabled for safer agents/tools)
  • Reasoning effort (high / max)
  • Visible base URL (including /beta when needed)
  • No deprecated frequency/presence penalty UI
  • Sub-node UX parity with built-ins: glow while calling + raw I/O in the model panel

Legacy aliases deepseek-chat / deepseek-reasoner are deprecated by DeepSeek (see API docs).


Features

  • OpenAI-compatible chat via LangChain ChatOpenAI + DeepSeek base URL
  • supplyData Chat Model sub-node (ai_languageModel)
  • Static V4 model options + dynamic load from GET /models
  • Thinking mode always sent as explicit thinking.type (DeepSeek V4 default is enabled if omitted)
  • Options: temperature, top P, max tokens, JSON mode, timeout, max retries, stop, user id
  • Credential test: GET /models
  • Host module resolution for @langchain/openai (avoids dual-package instanceof breaks with Basic LLM Chain)
  • LLM tracing callbacks (host N8nLlmTracing when available, else fallback):
    • addInputData → running glow
    • addOutputData → panel output (messages, generations, token usage)

Prerequisites

  • Self-hosted n8n with LangChain AI nodes (roughly 1.77+; tested around 2.x)
  • DeepSeek API key: platform.deepseek.com/api_keys
  • Node.js for building (package uses TypeScript 5.9 / modern n8n peers)

n8n Cloud / verified community: This package has runtime LangChain deps and is intended for self-hosted installs. Cloud verification generally disallows external runtime dependencies.


Installation

From source (current)

cd n8n-nodes-deepseek-ai-chat
npm install
npm run build

Load the package root (folder with package.json + dist/) into n8n, then restart n8n.

Common patterns:

# Custom extensions path (process / Docker)
N8N_CUSTOM_EXTENSIONS=/path/to/n8n-nodes-deepseek-ai-chat

Or install/copy per n8n community / private nodes docs.

After restart, search the palette for DeepSeek AI Chat Model.

From npm (when published)

Settings → Community Nodes → Install
Package: n8n-nodes-deepseek-ai-chat

Not on the registry until you run npm publish.


Credentials

Create DeepSeek AI Chat API:

Field Default Notes
API Key — From DeepSeek platform (password field)
Base URL https://api.deepseek.com Use https://api.deepseek.com/beta only for beta features

Credential test calls GET {baseURL}/models.


Usage

  1. Add AI Agent or Basic LLM Chain.
  2. Add DeepSeek AI Chat Model on the Chat Model port (AI connection, not main).
  3. Select model (default deepseek-v4-flash).
  4. Prefer Thinking Mode → Disabled when using tools or strict output parsers.
  5. Run the workflow.

Expected sub-node UX

During call After call
Edge glow on the DeepSeek model node Panel shows generations, tokens, cost estimate, latency, model meta

Panel fields after a successful call (v0.1.3+):

Field Contents
response.generations Model text (+ generationInfo / finish reason when available)
tokenUsage prompt / completion / total; cache hit/miss & reasoning when API provides them; source: api | estimate
costEstimate USD breakdown (input cache hit/miss, output, total) using documented list rates
meta model, thinkingMode, durationMs, finishReasons, baseURL

Cost is an estimate (pricing table snapshot in deepseekPricing.ts), not a billing invoice. When cache split is unknown, prompt tokens are priced at cache-miss (upper bound).

If the panel is blank or there is no glow, rebuild 0.1.3+, redeploy dist/, restart n8n.

Suggested tests

Scenario Thinking Expected
Basic LLM Chain, short Q&A, no output parser Disabled Answer + model panel I/O
Basic LLM Chain Enabled Answer; CoT at API level
AI Agent without tools Either Completes; glow on model
AI Agent with tools Disabled Tool loop should work
AI Agent with tools Enabled May 400 if n8n strips reasoning_content

Node parameters

Model

  • Default: deepseek-v4-flash
  • Also listed: deepseek-v4-pro
  • Dropdown can load live models from the API when credentials work

Thinking Mode

Value Behavior
Disabled (default) Sends thinking: { type: "disabled" }
Enabled Sends thinking: { type: "enabled" } + optional reasoning effort

Reasoning Effort

Visible only when thinking is Enabled: high (default) or max.

Options

Option Default Notes
Sampling Temperature 0.7 Omitted when thinking is enabled
Top P 1 Omitted when thinking is enabled
Maximum Number of Tokens -1 -1 omits the field; UI max 384000
Response Format Text json_object requires the word json in the prompt
Timeout 360000 ms
Max Retries 2
Stop Sequences empty Optional single stop string
User ID empty Maps to DeepSeek user_id (no PII)

Architecture (implementation)

AI Agent / Basic LLM Chain
        ▲  ai_languageModel
DeepSeek AI Chat Model  ──supplyData──► ChatOpenAI (prefer host @langchain/openai)
        │                                  + callbacks: N8nLlmTracing / fallback
        ▼
POST {baseURL}/chat/completions
File Role
nodes/LmChatDeepSeekAi/LmChatDeepSeekAi.node.ts Node description + supplyData
nodes/LmChatDeepSeekAi/loadChatOpenAI.ts Resolve host ChatOpenAI
nodes/LmChatDeepSeekAi/hostModules.ts Host require.resolve roots (Docker/global/n8n)
nodes/LmChatDeepSeekAi/DeepSeekLlmTracing.ts Official tracing if present, else fallback addInputData / addOutputData
credentials/DeepSeekAiChatApi.credentials.ts API key + base URL + test

Troubleshooting

Failed to parse agent steps (Basic LLM Chain)

  1. Dual LangChain packages — fixed in 0.1.1+ by loading host @langchain/openai. Redeploy and restart.
  2. Chain v1.9 + Structured Output Parser / “Require Specific Output Format” — known n8n bug (#29903). Workarounds: disable parser, pin chain < 1.9, upgrade n8n (~2.30+ reports fix), or parse JSON in a second step.

No output data / no running glow on the model node

Fixed in 0.1.2+ via LLM tracing callbacks (cost/latency in 0.1.3+). Rebuild, redeploy, restart. Confirm version in package.json is 0.1.3+.

Thinking on and off both fail

Usually chain/parser dual-package or n8n chain bug—not the thinking toggle. Test with thinking Disabled and no output parser.

401 / 402 / 429

DeepSeek auth, balance, or rate limits—check credential test and error codes.


Limitations

  1. Self-hosted first (LangChain runtime deps).
  2. Thinking + tools may 400 if n8n does not preserve reasoning_content.
  3. Chat Model only—no Phase 2 action node yet.
  4. No audio transcription (not in DeepSeek chat API).

Development

npm install
npm run build   # tsc → dist/ + copy deepseek.png
npm run lint    # tsc --noEmit
npm run dev     # tsc --watch

Repository layout

n8n-nodes-deepseek-ai-chat/
├── credentials/
│   └── DeepSeekAiChatApi.credentials.ts
├── nodes/
│   └── LmChatDeepSeekAi/
│       ├── LmChatDeepSeekAi.node.ts
│       ├── loadChatOpenAI.ts
│       ├── hostModules.ts
│       ├── DeepSeekLlmTracing.ts
│       ├── deepseekPricing.ts
│       └── deepseek.png
├── dist/                    # build output (gitignored; what n8n loads)
├── package.json
├── package-lock.json
├── tsconfig.json
├── .gitignore
├── README.md
├── AGENTS.md
└── PROJECT_PLAN.md

Git

  • Branch: main
  • node_modules/, dist/, .env* are gitignored
  • Bump package.json version when releasing

Publish to npm (when ready)

npm run build
npm login
npm publish --access public

Confirm name still free: npm view n8n-nodes-deepseek-ai-chat.


References

License

MIT

Discussion