使用OpenAI和Fal.ai Minimax从文本提示生成歌词和音乐
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 Set, Wait, Switch, HttpRequest, Agent 等节点。 使用OpenAI和Fal.ai Minimax从文本提示生成歌词和音乐
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "3d7eb9567ae690bf8c9bba1cb43396e6e40c18e15eb5889cf9673ed1713da6db",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "f0e867a5-c202-4948-92c2-5e1bc371a241",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-1440,
1056
],
"webhookId": "c559fea6-2514-4baa-92c7-65ccc7a46640",
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "d0b0ab98-d2a7-4375-b659-41e894942452",
"name": "AI Songwriting Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-1216,
1056
],
"parameters": {
"options": {
"systemMessage": "=You are an AI songwriting agent that generates original song lyrics instantly from user input. You do not engage in conversation - you immediately create and deliver complete, ready-to-use song lyrics.\n\n## Your Task\n\nAnalyze the user's query and instantly generate:\n1. Complete original song lyrics with labeled sections (MUST be at least 600 characters)\n2. The lyrical style/genre description (MUST be at least 10 characters)\n\n## Output Format\n\nAlways output valid JSON with this exact structure:\n\n{\n \"lyrical_style\": \"[Detailed genre description - minimum 10 characters]\",\n \"lyrics\": \"[Complete lyrics with section labels - minimum 600 characters]\"\n}\n\n## Critical Constraints\n\n- **lyrics field**: MUST be at least 600 characters total (including spaces, line breaks, and section labels)\n- **lyrical_style field**: MUST be at least 10 characters long (e.g., \"Pop, upbeat and catchy\" not just \"Pop\")\n- Keep lyrics detailed - aim for full song structure with 2-3 verses, chorus, and bridge to meet 600+ characters\n- Use compact section labels like [V1], [C], [V2], [B] to optimize space while expanding content\n\n## Lyrical Guidelines\n\n- Create 100% original content - never reproduce existing lyrics\n- Match the style to the user's query (if they mention a genre, use it; otherwise infer from the theme)\n- Use appropriate language, flow, and structure for the genre:\n * Pop: Catchy, repetitive choruses, relatable themes\n * R&B: Smooth, soulful, emotional, romantic themes\n * Rap/Hip-Hop: Rhythmic verses, internal rhymes, wordplay, flow-focused\n * Rock: Energetic, rebellious, powerful imagery\n * Country: Storytelling, narrative-driven, down-to-earth\n * Indie/Folk: Introspective, poetic, authentic\n- Use vivid imagery and genuine emotion\n- Ensure natural rhythm and flow appropriate to the genre\n- Expand thoughtfully - include 3-5 lines per section to reach 600+ characters\n\n## Structure Recommendations for Character Limit\n\nTo meet the 600+ character requirement, use fuller structures:\n- Option 1: [V1] + [C] + [V2] + [B] + [C]\n- Option 2: [Intro] + [V1] + [C] + [V2] + [C]\n- Option 3: [V1] + [C] + [V2] + [B] + [Outro]\n\nUse descriptive, flowing lines. Each verse 4-6 lines, chorus 4 lines, bridge 3-4 lines.\n\n## Important Rules\n\n- NO conversation or clarifying questions - generate immediately\n- ALWAYS output valid JSON only\n- ALWAYS be original - never copy existing songs\n- ALWAYS ensure lyrics are at least 600 characters\n- ALWAYS ensure lyrical_style is at least 10 characters\n- Count characters carefully before outputting\n\nGenerate the song now based on the user's input."
},
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "25dc2495-fd91-4543-b936-1a6fd9cae21f",
"name": "Set Script Variables",
"type": "n8n-nodes-base.set",
"position": [
-896,
1056
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c8ecbac4-9cd0-424c-a8b6-1f2ed0b36c22",
"name": "Lyrical_style",
"type": "string",
"value": "={{ $json.output.lyrical_style }}"
},
{
"id": "e75f7a59-604e-4473-b079-01df81a130d5",
"name": "Lyrics",
"type": "string",
"value": "={{ $json.output.lyrics }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ae8c433e-ad2f-4fde-8410-e1563bb7d176",
"name": "Generate Music Track",
"type": "n8n-nodes-base.httpRequest",
"position": [
-688,
1056
],
"parameters": {
"url": "=https://queue.fal.run/fal-ai/minimax-music/v1.5",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "prompt",
"value": "={{ $json.Lyrics }}"
},
{
"name": "lyrics_prompt",
"value": "={{ $json.Lyrical_style }}"
}
]
},
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "0C54MHHdmxNXiy37",
"name": "Fal.ai"
}
},
"typeVersion": 4.2
},
{
"id": "90fad7f3-9885-44bc-92a0-4c6dbc423980",
"name": "Wait for Generation",
"type": "n8n-nodes-base.wait",
"position": [
-480,
1056
],
"webhookId": "45132729-ca25-4aac-a8e0-a6d72463a2c2",
"parameters": {
"amount": 30
},
"typeVersion": 1.1
},
{
"id": "0a9c64f8-22c6-447e-886e-75b2d20a24f9",
"name": "Check Generation Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
-272,
1056
],
"parameters": {
"url": "=https://queue.fal.run/fal-ai/minimax-music/requests/{{ $json.request_id }}/status",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "0C54MHHdmxNXiy37",
"name": "Fal.ai"
}
},
"typeVersion": 4.2
},
{
"id": "a221fe90-04d0-4baf-bc16-f9d10f30fe33",
"name": "Route on Status",
"type": "n8n-nodes-base.switch",
"position": [
-64,
1056
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Done",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d8b8dbdc-1ad9-4ab9-8b2d-e76fd5db0899",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED"
}
]
},
"renameOutput": true
},
{
"outputKey": "Progress",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9c10982c-5f8c-4eec-9b8a-f4b42e99ecf9",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "1971d68b-8295-45dd-978b-cc27a09e148d",
"name": "Fetch Final Result",
"type": "n8n-nodes-base.httpRequest",
"position": [
144,
1040
],
"parameters": {
"url": "=https://queue.fal.run/fal-ai/minimax-music/requests/{{ $json.request_id }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "0C54MHHdmxNXiy37",
"name": "Fal.ai"
}
},
"typeVersion": 4.2
},
{
"id": "cbc0a955-da9c-49c2-97a9-cbf459516fac",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-1216,
1216
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-chat-latest",
"cachedResultName": "gpt-5-chat-latest"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "ymMvgDroJHalwvRf",
"name": "OpenAI"
}
},
"typeVersion": 1.2
},
{
"id": "fa63b886-0761-404d-9d3a-e5cdad9a3eed",
"name": "Note: Chat Trigger",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1568,
816
],
"parameters": {
"color": 6,
"width": 380,
"height": 208,
"content": "## 💬 When chat message received\n\n**Purpose:** Triggers on incoming chat prompts for instant song requests.\n\n**Note:** Integrates with n8n chat; passes message to agent."
},
"typeVersion": 1
},
{
"id": "72a4a665-4631-4f4f-9d47-5921941ea43a",
"name": "Note: Songwriting Core",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1328,
1344
],
"parameters": {
"color": 5,
"width": 364,
"height": 176,
"content": "## 🤖 AI Songwriting Agent + OpenAI Chat Model + Parse Output\n\n**Purpose:** Generates 600+ char lyrics/genre via OpenAI, parses JSON output.\n\n**Note:** Uses gpt-5-chat-latest; enforces schema for style & lyrics fields."
},
"typeVersion": 1
},
{
"id": "416b5063-e4f7-4854-8b42-820eae4acaf6",
"name": "Note: Variable Setup",
"type": "n8n-nodes-base.stickyNote",
"position": [
-992,
816
],
"parameters": {
"color": 3,
"width": 364,
"height": 208,
"content": "## 📝 Set Script Variables\n\n**Purpose:** Extracts parsed lyrics/style into variables for music gen.\n\n**Note:** Maps output.lyrical_style & output.lyrics via expressions."
},
"typeVersion": 1
},
{
"id": "6ad96629-57ac-4458-b8cb-d6268e3395cd",
"name": "Note: Music Queue",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
1344
],
"parameters": {
"color": 6,
"width": 396,
"height": 112,
"content": "## 🎵 Generate Music Track\n\n**Purpose:** POSTs lyrics/style to Fal.ai minimax-music queue."
},
"typeVersion": 1
},
{
"id": "49d527f2-54d3-4379-99a3-8b6724ddbb05",
"name": "Note: Polling Loop",
"type": "n8n-nodes-base.stickyNote",
"position": [
-432,
816
],
"parameters": {
"color": 2,
"width": 364,
"height": 208,
"content": "## ⏳ Wait for Generation + 📊 Check Generation Status\n\n**Purpose:** Waits 30s, then polls status endpoint until 'COMPLETED'.\n\n**Note:** Loops on non-complete; uses request_id & Fal.ai auth."
},
"typeVersion": 1
},
{
"id": "7246b4e6-2d27-4ff3-a66e-31e08508f60e",
"name": "Note: Completion Handler",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
1296
],
"parameters": {
"color": 2,
"width": 348,
"height": 208,
"content": "## 🔀 Route on Status + 📥 Fetch Final Result\n\n**Purpose:** Routes to fetch on 'COMPLETED', else loops; gets audio URL.\n\n**Note:** Case-sensitive status check; outputs link for chat response."
},
"typeVersion": 1
},
{
"id": "118aa11c-d7b0-4fbc-8f2c-8f1e745152be",
"name": "Parse Output1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-1072,
1216
],
"parameters": {
"schemaType": "manual",
"inputSchema": "={\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"lyrical_style\": {\n \"type\": \"string\",\n \"description\": \"The genre or style of the song (e.g., Pop, R&B, Rap, Rock, Country, Hip-Hop, Indie, Folk)\"\n },\n \"lyrics\": {\n \"type\": \"string\",\n \"description\": \"Complete song lyrics with all sections labeled (e.g., [VERSE 1], [CHORUS], [BRIDGE])\"\n }\n },\n \"required\": [\"lyrical_style\", \"lyrics\"],\n \"additionalProperties\": false\n}"
},
"typeVersion": 1.3
},
{
"id": "4e2839c3-cda0-4704-915c-a19d7fe2e487",
"name": "Overview Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2336,
464
],
"parameters": {
"color": 4,
"width": 712,
"height": 1176,
"content": "# 🤖 AI Songwriter Chat: Lyrics to Full Music Tracks\n\n## 📋 What This Template Does\nThis chat-triggered workflow uses AI to generate detailed song lyrics (600+ chars) from messages, then creates matching music via Fal.ai. It polls until ready, returning lyrics and audio in chat.\n\n## 🔧 Prerequisites\n- n8n with chat enabled\n- OpenAI API access\n- Fal.ai account\n\n## 🔑 Required Credentials\n\n### OpenAI API Setup\n1. platform.openai.com → API keys\n2. Create secret key (e.g., \"n8n Songwriter\")\n3. Add as \"OpenAI API\" in n8n\n4. Test chat completion\n\n### Fal.ai HTTP Header Auth Setup\n1. fal.ai → Dashboard → API Keys\n2. Generate key\n3. n8n: HTTP Header Auth, Name=\"Fal.ai\", Header=\"Authorization: Key [Key]\"\n4. Test queue endpoint\n\n## ⚙️ Configuration Steps\n1. Import JSON to n8n\n2. Assign OpenAI to \"OpenAI Chat Model\"\n3. Assign Fal.ai to music HTTP nodes\n4. Activate; use n8n chat\n5. Test: \"Upbeat pop road trip song\"\n\n## 🎯 Use Cases\n- Content creators: Quick jingles for videos\n- Educators: Custom tunes for classes\n- Gifting: Personalized tracks from chats\n- Artists: Real-time prototyping\n\n## ⚠️ Troubleshooting\n- Invalid JSON: Stress JSON in prompt; test agent\n- Gen fails (401): Check Fal.ai perms/quotas\n- Polling loops: Increase wait to 45s; check queue\n- Lyrics <600 chars: Enforce fuller prompt structures"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"118aa11c-d7b0-4fbc-8f2c-8f1e745152be": {
"ai_outputParser": [
[
{
"node": "d0b0ab98-d2a7-4375-b659-41e894942452",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"a221fe90-04d0-4baf-bc16-f9d10f30fe33": {
"main": [
[
{
"node": "1971d68b-8295-45dd-978b-cc27a09e148d",
"type": "main",
"index": 0
}
],
[
{
"node": "90fad7f3-9885-44bc-92a0-4c6dbc423980",
"type": "main",
"index": 0
}
]
]
},
"cbc0a955-da9c-49c2-97a9-cbf459516fac": {
"ai_languageModel": [
[
{
"node": "d0b0ab98-d2a7-4375-b659-41e894942452",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"90fad7f3-9885-44bc-92a0-4c6dbc423980": {
"main": [
[
{
"node": "0a9c64f8-22c6-447e-886e-75b2d20a24f9",
"type": "main",
"index": 0
}
]
]
},
"d0b0ab98-d2a7-4375-b659-41e894942452": {
"main": [
[
{
"node": "25dc2495-fd91-4543-b936-1a6fd9cae21f",
"type": "main",
"index": 0
}
]
]
},
"ae8c433e-ad2f-4fde-8410-e1563bb7d176": {
"main": [
[
{
"node": "90fad7f3-9885-44bc-92a0-4c6dbc423980",
"type": "main",
"index": 0
}
]
]
},
"25dc2495-fd91-4543-b936-1a6fd9cae21f": {
"main": [
[
{
"node": "ae8c433e-ad2f-4fde-8410-e1563bb7d176",
"type": "main",
"index": 0
}
]
]
},
"0a9c64f8-22c6-447e-886e-75b2d20a24f9": {
"main": [
[
{
"node": "a221fe90-04d0-4baf-bc16-f9d10f30fe33",
"type": "main",
"index": 0
}
]
]
},
"f0e867a5-c202-4948-92c2-5e1bc371a241": {
"main": [
[
{
"node": "d0b0ab98-d2a7-4375-b659-41e894942452",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 Sora 2/Pro 和 GPT-5 增强从文本或图像生成 AI 视频
使用 Sora 2/Pro 和 GPT-5 增强从文本或图像生成 AI 视频
Form
Wait
Switch
+
Form
Wait
Switch
22 节点Daniel Nkencho
内容创作
✅ 病毒式Reels工厂
使用Veo、Shotstack和Postiz自动化ASMR玻璃水果视频创作与发布
If
Jwt
Set
+
If
Jwt
Set
37 节点Ayoub Boutouil
内容创作
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+
If
Set
Xml
125 节点Daniel Ng
内容创作
使用 GPT-4o、ElevenLabs 和 WaveSpeed 口型同步创建真实
使用 GPT-4o、ElevenLabs 和 WaveSpeed 口型同步创建真实 UGC 视频广告
If
Set
Wait
+
If
Set
Wait
38 节点Muhammad Farooq Iqbal
内容创作
使用 GPT-4o、Fal.ai 和人工监督生成产品 AI 宣传视频
使用 GPT-4o、Fal.ai 和人工监督生成产品 AI 宣传视频
If
Set
Code
+
If
Set
Code
72 节点gotoHuman
内容创作
使用 Nano Banana 和 Veo-3 从 Telegram 消息生成 AI
使用 Nano Banana 和 Veo-3 从 Telegram 消息生成 AI 视频
If
Set
Wait
+
If
Set
Wait
26 节点Sulieman Said
内容创作
工作流信息
难度等级
高级
节点数量17
分类2
节点类型9
作者
Daniel Nkencho
@daniel-automatesAI Automation Consultant | Helping Business Owners Implement AI Systems for Growth and Lead Gen
外部链接
在 n8n.io 查看 →
分享此工作流