Skip to main content
LLM Node
In Lesson 2, we set up the Ingredients (Start Node) and the Serving Plate (Output Node). If the Start Node is the prep cook, the LLM Node is the Master Chef. It is the brain and core of your workflow. It handles all the thinking, analyzing, and creative writing. Whether you want to summarize an article, write code, or draft an email, this is the node that does the heavy lifting.

Configure the Model

Before getting started, we need to connect to a model provider.
1

Open Settings

Click on your avatar in the top right corner and select Settings.
Settings
2

Install OpenAI Provider

On the left menu, click Model Provider. Find OpenAI, and click Install.
Choose OpenAI
Install OpenAI
3

Return to the Canvas

Once installed, you are ready to go! Click ESC (or the X) in the upper right corner to return to your canvas.

Understand the Tags

A pastry chef is great at cakes but terrible at sushi. Similarly, different AI models have different strengths. When selecting a model in Dify, you will see tags next to their names. Here’s how to read them so you can pick the right one for you.
This is the bread and butter of AI. It’s best for:
  • Dialogue
  • Writing articles
  • Summarizing text
  • Answering questions
This number represents the Context Window. You can think of it as short-term memory.Here, K stands for thousand. 128K means the model can hold 128,000 tokens (roughly equals to a word or a syllable). The bigger the number is, the better its memory is.
If you need to analyze a massive PDF report or a whole book, you need a model with a big number here.
Modal just means Type of Information. Most early AI models could only read text. Multi-modal models are evolved—they have senses like eyes and ears.VISION (The Eyes)Models with this tag can do more than read; they can see! You can upload a photo of a sunset and ask, What colors are in this? or upload a picture of your fridge ingredients and ask, What can I cook with this?AUDIO (The Ears)Models with this tag can hear. You can upload an audio recording of a meeting or a lecture, and the model can transcribe it into text or write a summary for you.VIDEO (The Movie Analyst)These models can watch and understand video content. They can analyze what is happening in a video clip, just like a human watching a movie.DOCUMENT (The Reader)These models are expert readers. Instead of copying and pasting text, you can just upload a file (like a PDF or Word document). The model will read the file directly and answer questions based on what is written inside.
For our Email Assistant, the LLM with the CHAT tag is exactly what we need.

Hands-On 1: Add the LLM Node

Let’s put the brain into our workflow.
1

Open your App

Go back to the AI Email Assistant workflow we created in Lesson 2.
2

Add the Node

Right-click in the empty space between Start and Output node. Click on the new LLM block. In the right-side panel, look for Model. Select gpt-4o-mini.
Add the Node
3

Connect the Nodes

Drag a line from the Start node to the LLM node. Drag a line from the LLM node to the Output node. Your flow should look like this: Start → LLM → Output.
Connect the Nodes
Now we need to tell LLM exactly what to do by sending instructions which is called a Prompt.
Add Prompt

Key Concept: The Prompt (The Instructions)

What is a Prompt? Think of the Prompt as the specific note you attach to the order ticket. It tells the AI exactly what to do and how to do it. The most critical part is the ability to use Variables from the Start Node directly within your Prompt. This allows the AI to adapt its output based on the different raw materials you provide each time. In Dify, when you insert a variable like customer_name into the prompt, you are telling the AI: Go and look in the box labeled Customer Name and use the text inside.

Hands-On 2: Write the Prompt

Now, let’s apply this. We are going to write a prompt that mixes instructions with our variables.
1

Draft the Instructions

Click the LLM Node to open the panel and find the system box. System instructions set the rules for how the model should respond—its role, tone, and behavioral guidelines.Let’s start by writing out the instructions. You can copy and paste the text below.
You are a professional customer service manager. Based on the customer's email, please draft a professional reply.
Requirements:
1. Start by addressing the customer name with a friendly tone.
2. Thank them for their email.
3. Let them know we have received it.
4. Sign off as Anne.
2

Add User Messages

User messages are what you send to the model—a question, request, or task for the model to work on.In this workflow, the customer’s name and the email content change every single time. Instead of typing them out manually, we add Variables in user messages.
  1. Click Add Message button below system box.
  2. In the User Message box, type customer name:.
  3. Press / on your keyboard.
  4. The Variable Selection menu pops out, and click customer_name.
  5. Press Enter to start a new line, and type email content:. Then, Press the / key again and click on email_content.
Add User Message
You don’t need to type out those curly brackets manually! Just hit /, then pick your variable from the menu.
  1. Finally, your final Prompt will look like this:
Final Prompt
Hooray! You’ve finished your first AI workflow in Dify!

Run and Test

The ingredients are prepared, the chef is stand-by, and the instructions are ready. But does the dish taste good? Before we serve it to the customer, let’s do a recipe testing. Testing is the secret sauce to a stable workflow. It helps us catch those sneaky little issues before they are put into work.

Quick Concept: The Checklist

Think of the Checklist as your workflow’s personal Health Check Doctor. It monitors your work in real-time, automatically spotting incomplete settings or mistakes (like a node that isn’t connected to anything). Glancing at the Checklist before you hit Publish button is the best way to catch unnecessary errors early.

Hands-On 3: Test & Debug

1

The Pre-flight Check

Look at the top right corner of your canvas. Do you see the Checklist icon with a little number 1 on it? This is Dify telling you: Wait a second! There’s one small thing missing here_._
Checklist
2

Analyze the Warning

Click on it, and you will see a warning: output variable is required. It means that the output node receives nothing.Imagine your Head Chef (the LLM) has finished cooking the food, but the Waiter (the Output Node) has empty hands.
3

Fix the Issue

  1. Click on the Output Node
  2. Look for Output Variable and click the Plus (+) icon next to it
  3. Type email_reply in the Variable Name field
  4. Select the value: Click the variable selector and choose {x} text from the LLM Node
Fix the Issue
4

Make a Test Run

Now, there’s no pop-up number on checklist. Let’s do a test run.Click Test Run at the top right corner of the canvas. Enter the customer’s name and the email, then click Start Run.
Test Run
Customer Name: Amanda

Original Email:
Hi there,

I'm writing to ask for more information about Dify. Could you please tell me more on it?

Best regards,
Amanda
5

Success!

This time, you will see green checkmarks ✅ on each of the nodes and the generated reply from AI.
Great job!You didn’t just build a workflow, but also know how to use the checklist and check before it goes live.

Mini Challenge

Use the same structure to build a travel planner.
Explore the Prompt Generator to help you craft better prompts!
Prompt Generator