Build AI Agents for $0.014 with DeepSeek V3 in n8n

Dr. Violet Howard shows how to use DeepSeek V3, an open-source model that costs $0.014 per million tokens, inside n8n workflows. She walks through two setup methods: direct HTTP requests and routing through OpenRouter, then tests both by generating sample Facebook posts. The model matches GPT-4o and Claude 3.5 on benchmark tests while costing a fraction of the price.
Chapters
Today we're going to be walking through how to use Deepseek V3 in N8n for a fraction of what it costs to use something like GPT-4o or Claude 3.5 Sonnet. But real quick, what is Deepseek V3? It's an open source model that was recently released and it pretty much outperforms every other open source model out there. And it also performs pretty comparable to the leading closed source models like GPT-4o. Now I'm not an expert on models and fine tuning and training and all that kind of stuff, but I've got a couple of graphics that I'll walk through here and I'll also include the link to the technical report in the description if you guys want to check it out for yourself. So as you can see right here in the blue, we've got Deepseek, and then we've got other models like Llama, GPT, and Claude-35, and it's pretty much outperforming all of them in these 6 metrics. But why did I decide to make this video, and why did you probably click on it? Because of the price. So as you can see here in the green, we've got $0.014 per 1 million tokens. So you can just throw something like $2 in there, and it's going to get you a really, really long way. Here's another graphic from that report that I was talking about. This is the needle in the haystack test. As you can see, the whole board is green, so perfect 10 out of 10 score across everything. This basically tells us that Deepseek V3 is really, really good with its context length and understanding everything that's going through and not missing out any information the way that some other models might. So something really interesting about Deepseek V3 is that it uses a mixture of experts model rather than having one model across all the parameters. This one has submodels that it can sort of send out based on expertise in certain areas, which is pretty cool. Once again, it's not something I fully understand as far as all the technicalities. Go check out that report if you want to read more about it. But, um, you know, this isn't me recommending that it's better or recommending that you should use it. And of course, you should be careful with the data that you're putting into something like DeepSeq v3. But I just kind of wanted to bring you the facts of what I know and how to actually plug it into N8n and just get in there and play around with it a little bit. So let's get into N8n. So today I'm going to be talking about two ways to connect Deepseek V3 into N8N. So the first one is hooking it up as the brain for your AI agent, the chat model for your AI agent. As you can see right here, it looks like we're connecting to an OpenAI chat model, but if you click in, you can see that we're actually using an OpenRouter base URL to point us to Deepseek chat. So that's what's going on here. And then the second way is to use it as sort of its own node, like an OpenAI message model node. So as you can see here, we're doing a POST request to Deepseek and we're sending in information for it to come back with a response. I'll real quickly show off these two methods and then we'll get into how you actually do it. So first we'll do this one. As you can see here, it's a POST request to Deepseek. We have our stuff that I'll show you guys how to configure. And then pretty much in here, what we're asking it to do is we're sending, write me a Facebook post about the following topic. The topic's dynamic based on what we put into this set node right here, which is health and fitness in 2025. So let's fire this off real quick. As you can see, it's hitting Deepseek and then it's gonna come back to us with a result. Which should be a formatted Facebook post with emo— with emojis and probably hashtags at the end. As you can see, health and fitness, the future is here. It's got a couple points and then it ends with a nice little motivational message. And if this is confusing to you, it's the exact same way that you would set up an OpenAI message model node, and you've probably done that multiple times. You've got a system role right here, which is we're defining what this node is going to do. We're just saying you're a helpful assistant, and then we have the actual user role, which is what we want it to take and do, which is writing a Facebook post about health and fitness in 2025. So if that's confusing, just look at it like this, right? In OpenAI, usually you set up your different messages. We've got a system role and then a user role. So right here, helpful assistant, write me a Facebook post, and it's pretty much the exact same thing coming through. So, um, that's pretty much all that's going on here. I just wanted to let this finish so we could see the difference. There we go. So this was using 4.0, um, and this one again is a little bit different because it used a different model, but same aspect of Facebook post. Anyways, now we'll come up here and we'll pretty much do that same thing. So, um, this is connected to, um, what's it called, Deepseek V3, and we'll do the same thing. Make a Facebook post about health and fitness. 2025. And okay, so we actually didn't connect our credential real quick. We were connected to our OpenAI account, but as you can see, I have a different credential here, which is the DeepSeq one. So I'll show you guys how to set this up. But now this should work fine. Let's go back in here, send that off. And I know it's a little confusing because it looks like it's still an OpenAI chat model, but like I said, all we have to do is grab an API key from OpenRouter, and then we'll be good to go to set everything up. Okay, there we go. So now we got our Facebook post back, um, very similar with its hashtags at the end, with its different emojis for different sections. And yeah, so those are the two use cases that we're going to walk over real quick. Um, so let's hop into Deepseek and set everything up. Okay, so you're going to go to deepseek.com. You'll come into the screen, you'll sign in or you create an account, and then you're going to click on Access API. So this is going to take you straight to your API settings. So It took me to my usage. As you can see, I put in $2, I've got over 7 million tokens. You're going to click on API keys, create new key. We'll call this one demo, and then you want to copy that and paste it somewhere safe because you won't be able to reaccess it. And you could always just create a new one, but best practice is to paste it somewhere safe. Then you need to make sure you have some tokens available, so just add in like $2, and then you want to click on docs down here on the left side. This is going to bring you to this API documentation, and all you have to do is scroll down right here. We've got a curl. We're going to copy this curl, and it's going to be super easy. We'll hop back into N8N. As you can see, there's currently no DeepSeq integration, so what we have to do is grab an HTTP request, and all we have to do is import curl and paste that right in there. So as you can see, it's going to change it to a POST request. It put in the correct endpoint, and it has our header already, which is our authorization. And then it has our JSON already filled out. So super easy. Now what you want to do is you got to go grab that API key and then you want to get rid of this. It's going to be bearer space, your API key, and then make sure there's no extra leading or trailing whitespace as well. And that should work. So right now what we're sending over is the prompt is hello to a helpful assistant. We'll just hit test step to make sure everything's working. And as you can see, we got back, hello, how can I assist you today? So it was responding to the message, which was hello. So that's pretty much it. At this point, you would set up, you know, you could prompt this, this Deepseek node a little differently if you wanted it to do something more specific. And then you could dynamically give the information that you want it to respond to. Okay, now to set up a chat model. So let's delete this one. We're going to add another one, which is an OpenAI chat model. And this is like the default way that it pretty much opens up. And we need to create a new credential. But before that, we need to set up everything with OpenRouter. So we're going to click add option and we're going to add a base URL. Default, of course, it points to OpenAI because that's the model we're grabbing. But we're going to go to OpenRouter. You'll create an account and then all we need to do is go to Deepseek V3. What we want to do here is click on API and we're looking for a base URL to point to to grab Deepseek. So we're going to grab this right here, base URL. Within the quotations, copy that, go back into AnyDen, paste that in there. So now we're accessing the base URL of OpenRouter. And then up here, instead of accessing GPT-4o-mini or whatever model you're using, change it to an expression. You're going to get rid of that, go back into OpenRouter and make sure you're on DeepSeek V3. You're going to copy that right here, DeepSeek, DeepSeek-chat, and then you're going to paste that in there. So now We're pointing to OpenRouter URL, which is grabbing this model of DeepSeek. And now before we head out of here, we need to create new credentials. So you can see I've got a DeepSeek credential. I'm going to create a new one, but first we need to create an API key. So you're already in this page, you're going to click Create API Key, you're going to create key, name it whatever you want, and then same thing as always, copy this into somewhere safe. And then you're pretty much just going to go back into NN, hit create new credential, and paste your API key right into here. Once you do that, you're going to hit save. In the bottom right, it's going to go green and say your credential is currently private to you. And right here, it's going to go red. Not exactly sure why it does that, but you're connected if, if you get the green down here. That might just be a bug, but we're good to go. So we've got our API key from OpenRouter set up right here. We have the DeepSeek model that we want, and then we have OpenRouter being able to access this model for us. So now we just want to test to make sure it's working. We're going to open up a chat and we'll do this again, but instead of health and fitness, we will do sports and we'll see what it says here. And as you can see, it's hitting the model right now, which is obviously Deepseek, even though it looks like OpenAI. And we know that it's working because it would have already failed by now if we didn't have it set up. As you saw earlier, it failed really quick. Okay, so it just popped through. We've got Sports in 2025, where innovation meets passion. Again, emojis, little things. And remember, this is zero prompting at all. Um, but then it ends with some hashtags. But yeah, like I said, there's no prompting going on in here. But this is, of course, the chat input that I got and our output. So, um, that's pretty much going to be it for this one. I know it wasn't too complex, but I just wanted to show you guys how you can access this stuff so you can get in there and start playing around with it. I'm definitely going to play around with a little bit more you know, some complex agents with our Deepseek model and just seeing how it reacts to them, you know, using different tools and stuff. But, you know, 2 credits in Deepseek, 5 credits in OpenRouter. In OpenRouter, you have a ton of different models you can access as well, but those credits will get you a long way for sure. But yeah, as always, if you found this one helpful, please give it a like. Definitely helps me out. Great to be back. Hope you guys all had a happy new year. I'm really excited to see what 2025 brings as far as, you know, the channel, the AI space, all that kind of stuff. And definitely let me know in the comments what else you guys are looking to see in the next few weeks, in the next few months, and in the next year. So thanks for making it to the end of this one, guys.










