Sora 2 in n8n is INSANE (full setup guide)

In this tutorial the presenter demonstrates how to connect OpenAI's newly released Sora 2 video‑generation model to an n8n workflow. The guide walks through creating a trigger, configuring an HTTP node to call the Sora 2 API (POST https://api.openai.com/v1/videos) with the required Authorization and Content‑Type headers, and building a JSON body that includes the model name, a free‑form prompt, and optional parameters such as video length (seconds) and resolution (size). The speaker shows how to generate an API key, set up the request, and adjust the body format from URL‑encoded to JSON. After the video creation request returns a video ID, a polling loop is built using a Loop node, a Wait node (5 seconds), and a second HTTP node (GET https://api.openai.com/v1/videos/{video_id}/content) to retrieve the binary video once it is ready. Error handling is added so that the loop repeats until the video is available. The tutorial also covers Sora 2’s duration constraints (only 4, 8, 12 seconds) and pricing ($0.10 per second). Finally, the binary video is saved to Google Drive via an Upload File node, allowing the user to view or share the result. Throughout, the presenter offers practical tips, troubleshooting notes, and a brief plug for a paid community.
Chapters
So Sora 2 just dropped in the API and you've probably been seeing the videos absolutely everywhere on Instagram and TikTok. So in this video, I want to show you how you can integrate it really, really easily with NAN and start creating videos via API in your NAN workflow. And you can do absolutely anything with these videos. It could be for social media, could be for your website, it could be for absolutely anything. But using this system, you'll be able to generate any type of video you want really, really easily with Sora 2. So We're going to jump straight into it right now. I just have a when clicked to execute trigger, which is just how we're going to be triggering it for this demo. And then the first step is going to be a HTTP node, and we of course need to send this over to OpenAI to get it to use Sora2 to generate our videos. Okay, so we're on the OpenAI platform now to get the HTTP— or the code, sorry, uh, to put into the HTTP request. So we're just going to go to videos and then create video. And the way it works is you send one API request to create the video, and then you send another one to actually get the video back, so the binary data back, which is just the video. So here you can see the curl of what we need to add into our HTTP request in order to use Sora 2. So what we can do— well, first we can look at it. The endpoint URL is just going to be api.openai.com/v1/videos, and then we need an authorization header with our API key, and then we need to put the model in, and then we need to do the prompt. So we're just going to copy this, come over to Nan. If we come over to here and to import curl, and then we can just paste in this curl, hit import, and then you can see now it's in here. But I have found from testing this that one, this on its own doesn't work, and two, there's more data that you can put in the request. So I'm gonna sort of walk you through that now. By the way guys, just to interrupt the video, if you're really serious about learning NAN and want to properly master it and master how to implement it into a business, then the waitlist for my new community where you can learn exactly how to do this Personally from me is out now. So if you go to my bio, you go to the link on this video, you'll be able to sign up and you'll get an early bird discount as well as being notified as soon as it drops. All right, back to the video and show you the extra things that you need to add slash can add. So the things that you need to add is going to be first your API key. So if we come back over to the platform, go to dashboard, and then if we go to API keys, create new secret key, and we're just going to call this one Sora demo, hit create key, and then you see we get this key and then we can just paste it into here. Okay, cool. And then we need to add one more parameter. We need to add another header and this is just going to be the content type. So we're just going to do content and then -type with capitals like that and then application/json just like that. And then before, if we was to send off this request without that header, it would just throw back an error and say basically we need the header to define the content type. Now we've got that header in, it'll actually work. But if we scroll down, usually this would be as a JSON body. But you can see right now the body content form is form, uh, URL encoded, which it isn't what we want. So we can just change this to JSON, and now it's going to send over as JSON as we've defined in our header there. So we've got the name of the model, so model, and then the value is Sora 2. And by the way, if you're wondering why it's in these inputs like this rather than a JSON body, we could switch it to a JSON body, but, um, there's no point because it's just the names of the inputs plus the value. We can just do it like this and it's the exact same thing. It still sends over as a JSON body, it's just a little bit easier for us to put in. So accidentally just deleted the, um, parameters when I changed it for you there, but I've added them back in. We've got the model, which is Sora 2, and then the prompt, and then in here we can do absolutely anything we like. So we come back to that. Then the new ones that we can add is seconds and size. So for seconds, we're just going to say, uh, 5— let's do 6 seconds actually. And by the way, in terms of pricing, it's 10 cents per second, so actually pretty affordable for a video generation model. So 6 seconds of course is only going to cost me 60 cents, which is pretty good. And then the size, we can do whatever aspect ratio we want, so we're just going to do 1280 by 720, um, like a horizontal one. So, and then the prompt, we can say literally anything in here. So let's say for example, just to test it out, We'll say, uh, a cat riding a skateboard with rock music in the background. So pretty simple, but this is just to test it out. And then like I said, the way it works is when we execute this, it will then start creating the video and it'll give us back a video ID. And then what we need to do with that is we need to basically poll it and keep hitting the GET requests to then get the actual video. So we're going to set that system up quickly. If we go to Loop, this is going to be sort of our polling system that's going to keep going over. You can just set the batch size to 1 and then get rid of all of this stuff. Cool. And then what we're going to do is we're going to do a Wait node. So wait, we'll just do it at 5 seconds. And then we do another HTTP node, and this is going to be a GET request. And in here we're going to need to do this URL, which is the exact same thing with the v1/videos, but then we do the video ID, which is going to be a variable. So we'll get that from the step before. And then just /content. And this time it's going to be a GET request. We also need to send over our authorization headers, so I'll do that now. Okay, cool. So we've got that in. Uh, so what we're going to do now is we're just going to run this through, and then we'll disconnect this so it errors, and then we can get the video ID to put into here. I can see this error. I actually didn't know this. Apparently you can't do 6 seconds, it's either 4, 8, or 12. All right, so let's just do 4. Uh, didn't know that, now I do. Let's run it through again. So execute workflow, run it through again. This doesn't take long to do, but of course it doesn't actually create the video there, it just starts the video. Uh, as you can see, we get a video ID from here. So then we're going to come into here and then we can just replace this video ID, delete that, come over to this node here, and then we can just drag in this variable. Perfect. Then if we hit execute step now, it's going to wait the 5 seconds again and then it's going to go here and And then we get this error saying resource you're requesting could not be found, video is not ready yet, which is actually all right. What we can do here is we can simply just go onError and then continue using error output. And then onError, we can just have it loop back up like that. So now this way it's going to loop around and then success will do that when it comes to it. So let's just run it through again. And then if it errors, it will shoot back up and then it will just keep looping around. And then if it successes, it will go the other way. Okay, so error this time. You can see the error, uh, video is not ready yet. Use Git. Okay, perfect. So it just means, yeah, video isn't ready yet, so we'll have to give it a minute. It does take like a minute to create these videos, of course, because it's generating videos. So we'll kind of come back when it's done. I'll keep manually running this. Of course, when it's, um, automated and when it's doing it automatically, it'll just keep polling through because of this loop node, but I'd have to restart the entire workflow again and generate a new video, which costs money, and we're not going to get the same video output. Okay, so that only took around 30, 40 seconds, and you can see now it's a success. So we got this binary data, and in here, this is the actual video itself. So it's gone down the success branch because there was no error. We actually got the video back. Now we have the binary data. Now we need to do something so we can actually use that video and also watch it as well. So the way we do that is to go to Google Drive and then upload a file. So upload a file, and then the input data field name is just going to be data. As you can see. And then new file name, for this I'll just call it Sora test, but of course you can do anything you like here. And what this is going to do is it's just going to save it to your Google Drive, and that way it's going to be processed and you'll actually be able to watch it and send the link to people, whatever you want to do with it. It'll be a video that you can actually use. So we'll hit execute step. It's just going to run through here again. Okay, it's doing an HTTP request again to get the video, and then it's going to Google Drive. And then you can see now it works. So if we go to web view link, open this up, it should say— yeah, so video's still being processed, it's just Google Drive I think it takes a minute for videos to process when you upload them. But if we want to view it, we could just hit download and then we can actually open this up. Okay, so here we go. This is the video. Okay, cool, perfect. So that is the simplest way to just integrate Sora with NAN. Now you can do absolutely anything. I'm not going to make a full video— well, this video at least isn't going to be a full video of how to actually use it for business use cases and useful use cases. This was just to show you the simplest method to set this all up. So using this, you can now create absolutely anything you want inside of Sora— well, using Sora inside of NAN.
More from Rory

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










