DEV Community

Cover image for Integrating DeepSeek into n8n: Low-Cost AI Automations
Douglas Toledo
Douglas Toledo

Posted on

Integrating DeepSeek into n8n: Low-Cost AI Automations

Upgrade your automations with AI without spending much, integrate DeepSeek with n8n in your solution!


What is n8n?

n8n is a low-code/no-code automation platform that lets you connect apps, services, and APIs in a visual way. With it, you can create complex workflows without coding, integrating tools like WhatsApp, Google Sheets, and AI models. It's like a digital LEGO® for automations, offering flexibility and scalability.


Meet DeepSeek

DeepSeek is an open-source AI model that stands out for offering performance comparable to GPT-4 and Claude 3.5 Sonnet, but at significantly lower costs.

DeepSeek Models:

  • DeepSeek V3 (Chat):
    • Focus: Simple tasks like chatbots and virtual assistants.
    • Performance: Quick responses, ideal for agile interactions.
  • DeepSeek R1 (Reasoning):
    • Focus: Complex tasks requiring advanced reasoning.
    • Performance: More elaborate responses but with longer response times (up to 50 seconds).

Price Comparison

To better understand the cost-benefit of DeepSeek...

Comparison table (per million tokens):

Model Input Tokens Output Tokens
DeepSeek V3 (Chat) $0.01 $0.28
DeepSeek R1 (Reasoning) $0.14 $2.19
OpenAI GPT-4 $2.50 $10.00
Claude 3.5 Sonnet $3.00 $15.00

The above values are approximate and based on information available until February 1, 2025.


How to Integrate DeepSeek with n8n?

First, you'll need to have n8n installed; follow the official documentation for installation.


Integration Steps:

  1. Install the n8n-nodes-deepseek Node:
    • In n8n, go to Settings > Community Nodes > Install a community node.
    • In npm Package Name, type "n8n-nodes-deepseek", select the checkbox "I understand the risks of installing unverified code from a public source" and click the "Install" button.

Image demonstrating how to install deepseek node

  1. Create the Credentials:

    • Create an account on the DeepSeek website and go to the dashboard of your account.
    • Add a balance (minimum of US$ 2) and generate your API Key.
    • Keep your API Key in a safe place.
  2. Configure the Credentials:

    • Create a workflow by clicking "New Workflow" on the Overview tab;

Image demonstrating how to create a new workflow

  • Click on "Add first step" in the center of the workflow and add a Trigger manually to start the flow;

Image demonstrating how to start the workflow

  • Click the "+" to add a service to the flow and type "deepseek" in the search and click on the node we installed;

Image demonstrating how to add the installed node in the workflow

  • Click on "Create chat completion" to open the configuration screen;

Image demonstrating the node settings

  • In Select Credential input, click the arrow to open the menu and click + Create a new credential;

Image demonstrating how to create a new credential

  • Paste your API Key and click the "Save" button;

Image demonstrating the credential settings

  • Configure the desired model (V3 or R1) in "Model" and set the messages in "Prompt":
    • System Message: type: "You are a helpful assistant";
    • Click "Add Message";
    • User Message: type: "Who are you?".

Image demonstrating how to select the model and add test prompt messages

  1. Test the call:
    • Click the "Test step" button, it will process and respond to the test request.

Image demonstrating the results

Note: The V3 will provide a quick return, the R1 is ideal for detailed responses, but the processing time may not be suitable for real-time applications.

  1. You did it, congratulations!
    • Was it difficult? Leave a comment below.

When to Use Each Model?

  • DeepSeek V3:

    • Ideal for: Chatbots, quick responses, and real-time interactions.
    • Advantages: Low cost and high speed.
  • DeepSeek R1:

    • Ideal for: Tasks requiring complex reasoning and detailed responses.
    • Advantages: In-depth analysis, though with longer response times.

Conclusion

Integrating DeepSeek with n8n is an effective and economical way to implement AI in your automations. With significantly lower costs compared to other models, you can expand your projects without breaking the bank.


Useful Resources

Top comments (0)