Hey all, I have a pretty basic question about how n8n interacts with Gemini. Just getting started.
I’ve spun up n8n in Docker on Digital Ocean. I also created a Gemini API key and added it to my credentials and then created a very simple workflow to just send requests to Gemini and give me back results just using the chat window.
And for the most part it works. If I type something in the chat I get a response back from Gemini, very similar to if I typed the same question directly in Gemini. Except for YouTube videos.
For example, if I type “Summarize the youtube video https://www.youtube.com/watch?v=7FxmK_6g190” directly into Gemini, it works perfectly. But if I send the same request through n8n it returns the summary of a seemingly random YouTube video instead.
I know there are a lot of templates and examples of using n8n to summarize YouTube videos, but they all seem to involve things like extracting the transcript and everything first. I am curious as to why just sending the raw text command to Gemini doesn’t just work as it does when typed directly into the Gemini UI?
It looks like the behavior you’re seeing is due to the fact that the n8n AI agent nodes don’t natively support handling YouTube video requests the same way the Gemini UI does
Gemini’s API expects a more structured payload for video processing. Specifically, for YouTube videos, Gemini requires a payload where the video is specified with its MIME type and URI, like so:
When you send the raw text command through n8n, Gemini doesn’t receive the necessary information to correctly determine that it’s a YouTube video request. That’s why it hallucinate.
What You Can Do:
Adjust the Payload: Format your request to include Gemini’s required fileData object for video requests.
Customize Your Workflow: Use an HTTP Request node to send the JSON payload—just update the prompt and video link as needed.
Check the API Docs: Look at the Gemini API documentation for extra parameters you might need.
I also made a simple working example for you to test native support for YouTube links:
If this answers your question, please mark the reply as the solution ✅🙏🏻