Category: Automations › Social Media & Content · Best for: Creators and brands on short-form video · Platform: n8n · Steps: 34
What it does
The AI creates short videos for TikTok, YouTube Shorts and Instagram Reels.
- Next we use some custom javascript to total up how many tokens were used for each 5 generations so we can track our costs later.
Works with: Google Sheets, OpenAI, ElevenLabs, PiAPI, Google Drive, Discord
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide
- The list of fields to change for your own accounts (see Install below)
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n, then open http://localhost:5678. -
Accounts and API keys for these services:
- OpenAI API key: how to connect (used by Generate Image Prompts, Generate Video Captions, Generate Script)
- Google (Sheets, Gmail, Drive, Calendar, Docs): how to connect (used by Upload Voice Audio, Set Access Permissions, Load Google Sheet, Upload Final Video, Set Permissions, Update Google Sheet)
- discordWebhookApi: how to connect (used by Notify me on Discord)
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or open the file, copy everything and paste it onto the empty canvas with Ctrl/Cmd + V. - Open each node with a red warning triangle and pick or create the matching credential from the list above.
- Point these fields at your own sheets, chats and accounts:
- Upload Voice Audio →
driveId: choose your own - Upload Voice Audio →
folderId: choose your own - Load Google Sheet →
sheetName: choose your own - Load Google Sheet →
documentId: choose your own - Upload Final Video →
driveId: choose your own - Upload Final Video →
folderId: choose your own - Update Google Sheet →
sheetName: choose your own - Update Google Sheet →
documentId: choose your own
- Upload Voice Audio →
- Click Save.
Test it
- Click Test workflow (or Execute workflow). Once Per Day starts it. Trigger it once with real sample data.
- Click each node to check its output. A green tick means the step worked.
- Fix any red node: it's almost always a credential or a field that still points at a sheet or chat that isn't yours.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- Once Per Day starts the workflow (Schedule).
- Set API Keys reshapes the data for the next step.
- Load Google Sheet uses Google Sheets.
- Generate Video Captions uses AI (OpenAI).
- Create List reshapes the data for the next step.
- Validate list formatting checks a condition and routes items accordingly.
- Generate Image Prompts uses AI (OpenAI).
- Match captions with videos uses Merge.
- Generate Script uses AI (OpenAI).
- Calculate Token Usage reshapes the data for the next step.
- List Elements reshapes the data for the next step.
- Generate voice calls an external API (https://api.elevenlabs.io/v1/text-to-speech/onwK4e9ZLuTAKqWW).
- Generate Image calls an external API (https://api.piapi.ai/api/v1/task).
- Pair Videos with Audio uses Merge.
- Upload Voice Audio uses Google Drive.
- Wait 3min pauses before continuing.
- Render Final Video calls an external API (https://api.creatomate.com/v1/renders).
- Set Access Permissions uses Google Drive to share.
- Get image calls an external API (=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}).
- Wait1 pauses before continuing.
- List Elements1 reshapes the data for the next step.
- Check for failures checks a condition and routes items accordingly.
- Get Final Video calls an external API (=https://api.creatomate.com/v1/renders/{{ $('Render Final Vi).
- Wait 5min pauses before continuing.
- Image-to-Video calls an external API (https://api.piapi.ai/api/v1/task).
- Get Raw File calls an external API (={{ $json.url }}).
- Wait 10min pauses before continuing.
- Upload Final Video uses Google Drive.
- Get Video calls an external API (=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}).
- Set Permissions uses Google Drive to share.
- Fail check checks a condition and routes items accordingly.
- Update Google Sheet uses Google Sheets to update.
- Wait to retry pauses before continuing.
- Notify me on Discord uses Discord.
Extra setup notes
These notes are also on the canvas as yellow sticky notes:
2. Generate images with Flux using PiAPI
(total cost: $0.0948 approx. as of 3/9/25)
- OpenAI is used to generate 5 Flux image prompts based on the 5 captions generated. Edit this node to see/edit the prompt instructions.
- Next we use some custom javascript to total up how many tokens were used for each 5 generations so we can track our costs later.
- Then we generate an image with Flux using the PiAPI service, waiting to check for failures and retrying if there are any.
You can change the image model used by editing the Generate Image node API call. Flux models available (as of 3/9/25):
- Qubico/flux1-dev ($0.015) - Currently set
- Qubico/flux1-schnell ($0.0015)
- Qubico/flux1-advanced ($0.02)
For full list of API settings, see the Flux API Documentation
3. Generate videos with Kling using PiAPI
(total cost: $2.30 approx. as of 3/9/25)
- We use image-to-video with Kling using PiAPI to generate a video from each image.
- Then we wait to check for failures, and repeat the generations the failed if there are any.
You can edit the video model used in the Image-to-Video node. For testing, I'd recommend switching from pro to std for lower quality and cheaper price. Kling models available (as of 3/9/25):
- std (Standard) $0.26 per 5 second video
- pro (Professional) $0.46 per 5 second video - Currently set
For full list of API settings, see the Kling API Documentation
4. Generate voice overs with Eleven Labs
- OpenAI API is used to generate a funny script that relates to the captions. Open this node to see/edit the prompt instructions.
- Then we use the Eleven Labs API to generate the voiceover and upload it to our Google Drive so it can be accessed in the next step.
To replace the voice, find the voice ID of the voice you want to use in Eleven Labs, then change the URL in the Generate Voice node to: https://api.elevenlabs.io/v1/text-to-speech/{voice ID here}
For full list of API settings, see the Eleven Labs API Documentation
5. Complete video with Creatomate
(total cost: $0.38 approx. with the Essential plan credits | Free trial credits available)
- First, the list of videos/captions is combined with the generated voice over into a single item containing all 3 elements.
- Those are then passed over to the Creatomate Template ID you specified, replacing the template captions/video/audio with your generated ones.
- When the video is finished rendering, it's then uploaded to Google Drive and the permissions set so it can be accessed with a link.
- Then we update the original Google Sheet template with the information from our generation, including tokens to calculate cost, then mark this idea as completed.
- Finally, we send a notification to via webhook to the Discord server when the video is ready to be downloaded and used!
AI-Powered Short-Form Video Generator with OpenAI, Flux, Kling, and ElevenLabs
Before you get started, you'll need:
- n8n installation (tested on version 1.81.4)
- OpenAI API Key (free trial credits available)
- PiAPI (free trial credits available)
- Eleven Labs (free account)
- Creatomate API Key (free trial credits available)
- Google Sheets API enabled in Google Cloud Console
- Google Drive API enabled in Google Cloud Console
- OAuth 2.0 Client ID and Client Secret from your Google Cloud Console Credentials
1. Generate video captions from ideas in a Google Sheet
- Setup your API keys for PiAPI, Eleven Labs, and Creatomate.
- Once logged in to your Creatomate account, create a new video template and click "source code" in the top right. Paste this JSON code. This will be your example template for this workflow.
- In your Creatomate template, click the "Use Template" button in the top right and then click "API Integration" and you'll see your template_id. Set this value as your Creatomate Template ID in the Set API Keys node
-
The next node will load a Google Sheet, you can copy the Google Sheet Template, simply choose File > Make a copy. Then in the Google Sheets node, connect to your copied sheet template.
-
Next, we generate 5 captions for our video idea with OpenAI. You can edit this node to see the prompt and change it to your needs.
-
In the final two nodes, we use custom javascript code to turn the OpenAI response into a list. Then, it validates to make sure the list was formed correctly (incase of an OpenAI failure to follow instructions)
DO THIS FIRST
Troubleshooting
- "Credentials not found": open the node and select your credential again.
- Google "access blocked": in Google Cloud, add your email as a test user on the OAuth consent screen.
- Webhook not firing: copy the node's Production URL (not Test URL) into the other app, and make sure the workflow is Active.
- AI node errors: check your API key has billing enabled and the model name exists on your plan.
- Nothing happens on schedule: the workflow must be Active, and self-hosted n8n must stay running.
Need help?
Reply to your Morning Method order email and we'll help you get it running.
© Morning Method