Music Producer Chatbot π΅π€ using Gemini + Suno (via Kei AI) & Google Drive Upload
Go to WorkflowDescription
This workflow creates an AI-powered chatbot that generates custom songs through an interactive conversation, then uploads the results to Google Drive.
This workflow transforms n8n into a complete AI music production pipeline by combining:
Conversational AI
Structured data validation
Tool orchestration
External music generation API
Cloud automation
It demonstrates a powerful hybrid architecture:
LLM Agent + Tools + API + Storage + Async Control Flow
Key Advantages
1. β
Fully Automated AI Music Production
From idea β to lyrics β to full generated track β to cloud storage
All handled automatically.
2. β
Conversational UX
Users donβt need technical knowledge.
The AI collects missing information step-by-step.
3. β
Smart Tool Selection
The agent dynamically chooses:
Songwriter tool (for original lyrics)
Search tool (for existing lyrics)
This makes the system adaptive and intelligent.
4. β
Structured & Error-Safe Design
Strict JSON schema enforcement
Output parsing and validation
Cleanup of malformed LLM responses
Reduces failure rate dramatically.
5. β
Asynchronous API Handling
Uses webhook-based resume
Handles long-running AI generation
Supports multiple song outputs
Scalable and production-ready.
6. β
Modular & Extensible
The architecture allows:
Switching LLM provider
Changing music API
Adding new tools (e.g., cover art generation)
Supporting different vocal styles or languages
7. β
Memory-Enabled Conversations
Uses buffer memory (last 10 messages)
Maintains conversational context and continuity.
8. β
Automatic File Management
Generated songs are:
Automatically downloaded
Properly renamed
Stored in Google Drive
No manual file handling required.
How it Works
Here's the flow:
User Interaction: The workflow starts with a chat trigger that receives user messages. A "Music Producer Agent" powered by Google Gemini engages with the user conversationally to gather all necessary song parameters.
Data Collection: The agent collects four essential pieces of information:
Song title
Musical style (genre)
Lyrics (prompt) - either generated by calling the "Songwriter" tool or searched online via the "Search songs" tool
Negative tags (styles/elements to avoid)
Validation & Formatting: The collected data passes through an IF condition checking for valid JSON format, then a Code node parses and cleans the JSON output. A "Fix Json Structure" node ensures proper formatting with strict rules (no line breaks, no double quotes).
Song Generation: The formatted data is sent to the Kie.ai API (HTTP Request node) which generates the actual music track. The workflow includes a callback URL for asynchronous processing.
Wait & Retrieve: A Wait node pauses execution until the Kie.ai API sends a webhook callback with the generated songs. The "Get songs" node then retrieves the song data.
Process Results: The response is split out, and a Loop Over Items node processes each generated song individually. For each song, the workflow:
Downloads the audio file via HTTP request
Uploads it to a specified Google Drive folder with a timestamped filename
Setup steps
API Credentials (3 required):
Google Gemini (PaLM) API: Configure in the two Gemini Chat Model nodes
Gemini Search API: Set up in the "Search songs" tool node
Kie AI Bearer Token: Add in the HTTP Request nodes (Create song and Get songs)
Google Drive Configuration:
Authenticate Google Drive OAuth2 in the "Upload song" node
Verify/modify the folder ID if needed
Ensure the Drive has proper write permissions
Webhook Setup:
The Wait node has a webhook ID that needs to be publicly accessible
Configure this URL in your Kie.ai API settings as the callback endpoint
Optional Customizations:
Adjust the AI agent prompts in the "Music Producer Agent" and "Songwriter" nodes
Modify song generation parameters in the Kie.ai API call (styleWeight, weirdnessConstraint, etc.)
Update the Google Drive folder path for song storage
Change the vocal gender or other music generation settings in the "Create song" node
Testing: Activate the workflow and start a chat session to test song generation with sample requests like "Write a pop song about summer" or "Find lyrics for 'Bohemian Rhapsody' and make it in rock style"
π Subscribe to my new YouTube channel. Here Iβll share videos and Shorts with practical tutorials and FREE templates for n8n.
Need help customizing?
Contact me for consulting and support or add me on Linkedin.