This video demonstrates how to build an automated AI thumbnail generator for YouTube using n8n workflow automation, OpenRouter API, and Google Gemini image models. The workflow takes a YouTube video topic, uses an LLM to optimize the image prompt, generates the thumbnail as base64 data, converts it to a PNG file, and produces a ready-to-use thumbnail. The process involves integrating multiple AI services (LLM for prompt engineering, image generation model for visual creation) through n8n's workflow automation platform, showing how to combine LLMs, image generation models, and APIs to create practical AI content generation tools.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Building an AI Thumbnail Generator Agent in n8n Using OpenRouter and Gemini Image ModelsAdded:
Hello everyone.
In this video, I'm going to show you how you can build a real artificial intelligent image generation agent inside N8N.
And this workflow automatically creates YouTube thumbnails using artificial intelligence. So, basically, we will use N8N, OpenRouter, Google Gemini image models, and artificial intelligent prompt engineering.
And at the end of the workflow, we will get a real PNG thumbnail generation completely by artificial intelligence.
So, let's start. Yeah, and first of all, we need to start from the workflow overview.
This workflow does several things. First of all, it takes a YouTube video topic, then LLM improves the image prompt.
After that, we send the optimized prompt into an artificial intelligence image generation model, and the image is returned as base64 data. Then, we will convert the data into a real PNG image file, and finally, we will get a ready-to-use YouTube thumbnail. Yeah, but um before we will start, we need here uh to get familiar with what does it mean OpenRouter, how it looks like. So, it's a UI uh representation, but we need uh to get API key to work with uh N8N because we will send data via HTTP request, yeah?
And how to get data? So, first of all, we need to register to openrouter.ai.
Uh then, we need to click API keys, generate the new API key, and further, we will use it.
So, here how our workflow looks like, yeah? So, first of all, we need to start our workflow from the manual uh trigger, but in your case, of course, it can be different nodes, it can be web hook, and so on. But in my case, it's a manual execution, yeah?
And this node is used to start the workflow manually. It's useful during testing and development. And every time we click execute workflow, and the agent starts running.
The next one, we need to use node set fields.
Yeah, and how this node looks like. So, inside this node, we create a field, call it topic, like this.
And uh this field contains the topic of the YouTube video, for example, like this, yeah? So, it's the name of the YouTube video.
For example, in my case, I'm using KEI agent working with data set records in n8n and nocodb.
And this becomes the input for the entire workflow.
The next step, we need to use open router uh AI LLM, yeah? So, how to add this node, you need to click add It looks like that. Um open router.
Open the second.
Yeah, like this, open router.
Yeah? And you need to uh add this after I add uh condition.
Yeah? Uh okay, the next step, yeah? How to work with this node?
Now, we move uh to the most important part, yeah? And of course, we need to have a good prompt engineering. So, here we use the basic LLM chain, yeah? And as you can uh see, this LLM connected to this open router chat model.
And of course, here you need uh of course to uh create a connection with this open router, yeah? Like this.
You need to use API key and create a connection.
And also you can here select the model.
The next step we need to add a prompt, yeah?
And here the prompt includes the following: you are professional YouTube thumbnails prompt engineering and create a clean and powerful image generation prompt based on this video topic. And here we send a topic name here from the previous node.
Yeah, and here we can describe some requirements how our image uh should look like. Yeah, and here some requirements to this picture, as you can see.
And return only the final image prompt without explanations, yeah? And we send uh we click execute flow and we receive this text.
Yeah, and of course uh we need to send this text to the next node. And then uh the next node will be uh OpenRouter API, yeah?
So, it means that this node will call via uh API OpenRouter model. And here we use the Google Gemini 2.5 Flash image model.
So, we send the optimized prompt, the selected model, and image generation settings. The AI model generates the thumbnail image and returns it as a base 64 image data. So, we received a text from LLM.
Yeah, and uh we create HTTP node. So, we need to use post method, the following URL.
Yeah, the next step we need to send specific headers, so it token bearer that we received here, like this any token.
Yeah, the next one we need to send content type application JSON, name HTTP referrer, and this value, and X-Title like this.
And of course, we need to send the JSON, yeah? So, we use model Google Gemini like this.
And the message. A message we use from this previous note text. But be attention that uh the uh content should follow specific format. And here you can see how this format looks like.
Yeah, and image text. Then we click execute step.
Yeah? The next one.
Once we click execute step, yeah, I will show you. I will click and will show you how it looks like here because I switch to JSON.
Yeah, so and here you can see that we received big JSON here, and here is base 64 format of the image.
The next step, yeah, this result that we received from OpenRouter, of course, we need yeah to extract for this case, yeah, uh we need to use node set fields, and uh then function of this node uh extract the image data from the API response.
Yeah, and we also remove the data uh PNG and so on, some prefixes. So, this is important because because next node expects only clear base 64 data.
And here you can see how uh to extract this, so image base, yeah, and how this format looks like, and prompt.
Yeah? Okay, and the next step, we need to send this data to the node convert to file.
And finally, uh we'll you we use this node to convert uh our base 64 yet to the image. And at this point, the AI-generated thumbnail becomes a downloadable image inside an A10.
And here you can see, so you can download or you can click view and receive a picture, yeah?
AI agent, an A10, and NocoDB. Also, you can click here and save this picture.
So, to summarize, yeah, we now have a fully working AI thumbnail generation engine running completely inside an A10. And this workflow can easily be expanded further.
For example, sending thumbnails into Telegram, saving results into NocoDB, or generating multiple thumbnail variations, or building a complete AI content generation pipeline. And of course, this is great example of combining LLMs, image generation models, APIs, and of course, workflow automation. So, guys, thank you for attention and see you on next videos.
Related Videos
VALORANT's Latest 'Exclusive' Tier Bundle is Rough...
KangaValorant
17K views•2026-05-28
Flight Attendant Mocks Poor Looking Black Woman — Mid Air Announcement Exposes Her Real Power
SkyboundStories-b4r
184 views•2026-05-28
I FIXED My Friend’s Blown Turbo RX-8… Then Sold It
Cameron-RX8
134 views•2026-05-28
NewsWatch 12 at 5: Top Stories
NewsWatch12
1K views•2026-05-28
Simon Jordan & Danny Murphy deliver PREDICTIONS for Arsenal's Champions League FINAL with PSG
talkSPORTArsenal
6K views•2026-05-28
Botting is OUT OF CONTROL in Classic WoW (Again)...
SolheimGaming
108 views•2026-05-28
The "AI Job Apocalypse" is CANCELLED!
WesRoth
9K views•2026-05-28
STREET FIGHTER 6 - INGRID Story Walkthrough @ 4K 60ᶠᵖˢ ✔
RajmanGamingHD
12K views•2026-05-28











