How to run deepseek with n8n?
You can run deepseek with n8n by calling the Deepseek API from an n8n workflow. This guide shows a quick Docker setup for n8n, how to store your DEEPSEEK_API_KEY, and a sample HTTP node that queries Deepseek. The steps are simple and designed for beginners who want automation with external AI search APIs.
What You Need to run deepseek with n8n
- Docker and docker-compose installed.
- An n8n Docker image (official n8n container).
- A Deepseek API key (DEEPSEEK_API_KEY).
- Basic access to the n8n web editor on port 5678.
Step 1: Run n8n with Docker
Start n8n in Docker with environment variables. This example exposes port 5678 and sets a placeholder API key. Replace values before use.
docker run -it --rm \
-p 5678:5678 \
-e N8N_BASIC_AUTH_ACTIVE=true \
-e N8N_BASIC_AUTH_USER=admin \
-e N8N_BASIC_AUTH_PASSWORD=change_me \
-e DEEPSEEK_API_KEY=your_deepseek_api_key_here \
n8nio/n8n:latest
Step 2: Docker Compose example
Use docker-compose to persist settings and make updates easier. Save this as docker-compose.yml in a folder and run docker-compose up -d.
version: '3'
services:
n8n:
image: n8nio/n8n:latest
ports:
- '5678:5678'
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=change_me
- DEEPSEEK_API_KEY=your_deepseek_api_key_here
restart: unless-stopped
Step 3: Create a workflow that calls Deepseek
Create a new workflow in n8n. Add an HTTP Request node. Configure it to call the Deepseek API using your key.
Example HTTP node settings (method, URL, headers, body):
Method: POST
URL: https://api.deepseek.ai/v1/search
Headers:
Authorization: Bearer {{$env.DEEPSEEK_API_KEY}}
Content-Type: application/json
Body (raw JSON):
{
"query": "find documents about product X",
"limit": 5
}
Step 4: Test with curl
Test the same request from your terminal to confirm the API key and endpoint work.
export DEEPSEEK_API_KEY=your_deepseek_api_key_here
curl -X POST "https://api.deepseek.ai/v1/search" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"test search","limit":3}'
Step 5: Workflow logic (numbered)
- 1. Trigger the workflow (manual, schedule, or webhook).
- 2. Use the HTTP Request node to POST the query to Deepseek.
- 3. Parse the JSON response with a Set or Function node.
- 4. Use results to store data, send messages, or trigger other automations.
Update
Keep n8n and the container image updated. Pull the latest n8n image and restart the container. Update steps:
docker pull n8nio/n8n:latest
docker-compose down
docker-compose up -d
Security
- Store DEEPSEEK_API_KEY in environment variables or n8n credentials, not in workflow code.
- Enable n8n basic auth or use a reverse proxy with HTTPS.
- Rotate API keys regularly and restrict IPs if the provider supports it.
- Limit node access and audit workflow history for sensitive data.
Done
You now have n8n running with a working Deepseek API call. The workflow can run on schedules or webhooks. Tweak the HTTP node and parsing to fit your automation needs.