How to build Ai Agents with DeepSeek R1 (97% cheaper)

Rory Bridges shows how to build AI agents with DeepSeek R1, a reasoning model that matches OpenAI's O1 performance at 97% lower cost. He demonstrates two integration methods and builds an agent that takes app ideas, generates detailed project plans via DeepSeek R1, and automatically creates Google Docs documents.
Chapters
What's up guys, in this video we're going to be going over how to use the new Deepseek R1 model in our AI agents and also what it means for AI agent development in the future. This is a massive step in AI agent development just because how good this model is and also how cheap it is. It's really just something that we have not seen before. If you're new here, my name is Rory Bridges and I help business owners to integrate AI agent systems into their businesses. So if that's something you might be interested in, then I've left a link to my website in the description. You can go ahead and book in a call with me or you can just fill out the contact form. Also, the agent that I make in this video will be available for completely free in description. So if you want to get started right away using Deepseek's new R1 model, you can just go ahead, go into the description, get the free templates, and get started straight away. But let's not waste any more time, let's get into it. So if you haven't heard of the new Deepseek R1 model, what it is, this is a new model from Deepseek, which is a Chinese AI company, and it's basically a reasoning model. So if you've used ChatGPT-01, where you can see it actually thinking when you ask it questions, it's similar to that. So it can actually think and actually produce better answers to anything that you ask it, which is really, really cool. And the cost of it is just absolutely crazy compared to things like O1. So just to kind of set the scene here, I want to show you the benchmarks between O1, O1 Mini, Deepseek R1, and then also Deepseek V3. So Deepseek V3 is just sort of the standard Deepseek model, kind of like GPT-04. So it doesn't think but it's still really, really good. So they've included that in this benchmarks. But, but I just want to show you the difference between Deepseek R1 and OpenAI's O1. As you can see, they're pretty much neck and neck on every single benchmark here. There's a couple where O1 are a little bit better, but then a lot of them Deepseek R1 is actually better, which is crazy. So you can see in coding and in maths it's better, which is really, really cool. And then a few of these other ones it's also actually beating O1 in, which might not sound too crazy, but when you look at the price difference it's crazy. So if we go over to OpenAI here, you can see the O1 model. This is the pricing for O1. So you can see we've got the inputs and the output tokens. So the inputs are going to be $15 per a million input tokens, and then the output is going to be $60 for a million output tokens. And if you don't really know what the input and output tokens mean, basically one character is usually about 0.3 tokens. So one token is usually sort of 3 or 4 characters. So when there's an input, let's say, has 30 characters in it, that's probably going to be about 10 tokens. And then the same thing when the AI model outputs something, let's say outputs 30 characters, that's probably going to be about 10 tokens worth. So that's how that works. For a million tokens, $60.01, and then for a million input tokens, it's going to be $15. This is for O1. So then if we look at Deepseek, we can come over to here, models and pricing. It's crazy. So Deepseek Reasoner, the input price is going to be for a million tokens, so the same thing, it's going to be $0.14 compared to $15 for the O1, which is crazy. And then the output is going to be $2.19 compared to $60 on O1. So the price difference is absolutely crazy considering that these two models are pretty much neck and neck on every benchmark, with O1 even surpassing it on some benchmarks. But I'm going to jump straight in and show you how you can actually start using Deepseek R1 for some of your AI agents. If we come over to Relevance AI, we're going to be using Relevance AI and then also one small Make.com scenario for this, but that's kind of optional. To actually use R1, we only need to use Relevance AI. There's two different ways you can do it. You can do it natively on Relevance AI, or you can do an HTTP request to Deepseek and talk to it through that. But I'll show you both ways. If we look at Relevance AI here, I've got a tool which is called the Deepseek R1 tool. We have one input which is going to be user request. It's just going to be what the user obviously wants to say to Deepseek. The way I've set this agent up is that it is a software coding advice agent. So a user can input a software idea that they have. So say I've got a to-do list app idea, something like that, anything you like, and then it will get sent over to R1 and it can sort of think through and create a plan. But we've got a prompt for R1, I'll show you that in a second. First of all, I want to show you how you can actually connect to R1 through Relevance AI. So this is the way I've doing it, is the HTTP request, but a little bit more complicated. So first I'm going to show you just the native integration on Relevance AI. If you go to this LLM block here, you can see we can change your model. If we literally just type up Deepseek, then you can see R1 here, and you can see it's 0.82 credits for 1,000 tokens. If we just want to compare this to O1, you can see it's 22.5 credits for 1,000 tokens. So, so much cheaper, it's crazy. Go to Deepseek again, R1. You can do it through here, and this works perfectly fine, but it's going to be a little bit more expensive because you're actually going to be getting charged through Relevance AI rather than just through your API key on Deepseek. You can do it this way, and obviously you can prompt it with whatever you want, and it'll work fine. But like I said, you're going to be getting billed through Relevance AI, so obviously you're going to put a bit of a markup on that, and it's going to take away from your credits. So if you're not really too familiar with sort of coding or API requests or anything like that, then I might recommend doing it this way. But the API request method is really, really simple as well. So if you just want a quick way of doing it, do it this way. But if you want to do it a little bit more cost-effectively, then I'm going to show you how to do it that way. So we've come over to the Deepseek docs here. You can see we've got the Your First API Call. They make it really, really easy for us. This is basically what we're going to be sending off to actually be able to talk Deepseek. You can see we've got the curl here, which is going to be our endpoint URL. We've got two different headers, and then we've actually got the JSON body here. And you can switch between Deepseek Reasoner, which is R1, and then Deepseek Chat, which is V3, but we're going to be using Deepseek Reasoner, which is R1, because we want it to do some sort of slightly more complex stuff. So this is the curl here, this is what we want to copy over. If you come over to Relevance AI, we've put an API request node here. The method is going to be POST, the URL is going to be this URL here, so https://apidepseek.com/chat/completions So we put that in the URL section here. The headers are going to be content-type: application/json, so we put that in there. And the other header is going to be authorization and then bearer and then your API key, so we put that in here. Show you how to get the API key in a second. The body is going to be a JSON object, and then in here we paste this part here because this is what we're going to be actually sending over to Deepseek. So we paste that in there, and as you can see, we have two different types of prompts. We've got the system prompt and then we have the user prompt. So the system prompt is going to be sort of the predefined prompt that we want for this Deepseek model, so we can sort of fine-tune it a little bit to do what we wanted to do. So I'm going to show you what I've put in here. You don't have to read through all of this, but this is basically just— as I said, this is going to be a sort of a software assistant kind of thing. It's going to be able to plan out your software applications for you. So I've put in a prompt here of all the things that I need to include in these plans. You can see You have extensive knowledge on software engineering, best practices, project management methodologies, user-centered design, system architecture, da da da. And then I've given it sort of a checklist of all the things it needs to include in the plan. And then for the user prompt, there's a header for content, and all we put in is the user request variable here. So it's just going to be this input. We literally just put that in there. You just tap on the screen like this, and then you can copy it and paste it in here. And that's all we need to do to be able to communicate with Deepseek R1. And if we do it this way, we're going to be getting billed straight through Deepseek rather than Relevance AI, so it's actually going to be a lot cheaper. But of course, we need our API key. So to do that, you come over to the Deepseek platform. You'll need to put some money in your account. I've literally just done $2. That'll last you quite a while, which is nice. You go to API keys, create new API key. You can call it anything you want. I'll just call it test. Create API key. Get this API key. Click copy. And then we can literally just paste it in there. Perfect. We're going to send off a request here and just make sure it's all working. So I've just said for the user request, I have an idea for a fitness coaching app with AI integration. So just quite simple, we're going to send that off to Deepseek. You can see this working. And now it does take a second because it's actually— it's a reasoning model, so it kind of has to think about it before it does it. So we're just going to give this a second and we'll come back when it's done. Okay, so this is what we got back from Deepseek. You see, we've got all this stuff here— the ID, the object created, the model, the tokens, everything like that. We don't really need any of that. All we need is we go to choices, then click on message, and then this is what it's actually returned to us. In my case, I've made output in HTML. I'll show you why in a second, but obviously you wouldn't do that if you didn't want it to output in HTML. It's just because I put at the end of the prompt always output in HTML format, so that's why it's in HTML. But you can see here we've got this plan and we can read this a little bit better later on, but we're just making sure that actually works. And one of the other cool things is you can see the reasoning content here. So this is what actually thought, which is really cool. Okay, the user wants a detailed project plan for a fitness coaching app with AI integration. Let me start by breaking down the key components they mentioned, da da da, and then it's given it sort of its thought process into creating this plan here, which is really, really cool. So on its own like that, you can just do it like that. But I wanted to add one more step where we actually add this plan to a Google Docs. So really, really simple. We're just linking this to a simple make.com scenario here. We have a webhook setup, Google Docs create a document, and then a webhook response. So all we do here is we just do the method as POST, we put the URL as the webhook URL that we get here, copy that. The headers, done content type application/json, the body's raw, and then in the body section we literally just put the output of this API step here, which is obviously going to be the content that we want. We send that over to make.com. We create a document, the name— I've just done a software plan— the content. We get all these different variables through. This is the variables from the API step here, so all of these things like the tokens, everything like that. We get all of that. Obviously we don't want all of that, so we just go to choices, message, and then content. We put that in there. It's in HTML because you can do that with Google Docs and it'll actually render it, which is nice. And then obviously choose a folder, everything like that. And then we just send back to the scenario the web view link. When we're talking to this through the agent, the agent could send this off to Deepseek, and then it can give us back a link to the document and we can view it on there. So really, really nice. So we're going to put all of this into an agent. As you can see, I've started making it here. The agent name, Deepseek R1. The agent description, this agent could create software app plans using Deepseek R1. The tools is going to be the Deepseek R1 tool. And then I'm actually going to take you along while I build the prompt for this because it's a really, really simple prompt. All it's doing is just putting the input from the user into this tool, so dead simple. So I've just said the role: your job is to use Deepseek R1 to create software plans. Really, really simple. And then we're just going to say task: you have one tool. And then we can hit the forward slash, go to tool, then we can reference the tools directly. I want you to put the entire user's input into the only input for this tool. The user's input will be a software app idea. So I've literally just said you have one tool, the Deepseek R1 tool. I want you to put the entire user's input into the only input for this tool. User input will be a software app idea, and the Deepseek R1 tool will generate a full plan and then return a link to the documents. Simply return that link to the user. So not really much prompting needed at all for this agent because we're just using the Deepseek R1 tool, and it's literally just putting the user input into the tool and then returning the output from the tool. So we can test this out and actually give it a, um, software idea that we might want to make. Okay, so I said to it, I want to make a to-do list app with an AI assistant built in. This needs to be a mobile app and I only have a budget of $10,000. So quite a simple prompt here, quite vague. We're going to see what the Deepseek R1 tool comes out with. We're just going to let this run and then I'll come back to you when it's done. Okay, so it's just finished and it said to us, here's a link to the full plan for your to-do list app with an AI assistant. So if we click on this, yeah, it should take us to Google Docs, which is absolutely perfect. We've got the project summary, the functional requirements, technology and architecture. It's even made us a little table here, which is really, really cool. With the roadmaps and milestones, and then the team and responsibilities. And it's given us— it's actually worked with our budget here. So a full-stack dev, 5K. Part-time AI specialist, 2K. A tester, 1.5K. A UX designer, 1.5K. It's given us a testing bit here, the risk management, deployment, and maintenance. It's actually given us the different softwares to use, which is really, really cool. So Firebase app distribution, the backend is going to be Render, and the monthly cost estimate with hosting and the AI API, they're talking about $120. Scalability. So the phases, phase 1, phase 2, and then the future, and also the assumptions here. So really, really cool. That's absolutely perfect. And I mean, it did it for literally a fraction of the cost of what O1 would have done this for. So just that alone, you might think, okay, that's not that crazy. I mean, any AI model could do this. But the reason this is so crazy, like I said, is because of the cost of this. It's actually making the use of reasoning models in your AI agents and tools sort of a viable solution. Because with O1, it was kind of just not out of the question, but it was just so crazy expensive to use it. It kind of wasn't really worth it a lot of the time. A lot of the time you were kind of better off just using 4o Mini with a good prompt. But with Deepseek R1, it has completely changed the game. It's made these reasoning models actually a viable solution in your tools and agents, as I said. So I really can't wait to see all the different things that people build with this. I know for coding it's going to be absolutely insane because O1 is probably the best AI model at coding before this came out, but to use it to actually build applications and stuff, it was just too expensive for people. But with R1, you can achieve pretty much the exact same thing for a fraction of the cost. So I'd love to hear how you guys are using R1, and also, as I said at the start of the video, If you were interested in working with me, I've left a link to my website in the description. You can go ahead and book in a call, or you can just fill out the contact form and I'll get back to you. And if you want to get started using R1 straight away, as I said, the free templates will be available for free in the description, so you can go ahead and grab them. Guys, have any video suggestions that you'd like to see coming up in 2025, then please do let me know. But if not, then I'll see you in the next video.
More from Rory

Dynamic Workflows are crazy. This is how to actually use them (beginner's guide)










