使用AI翻译音频
中级
这是一个AI领域的自动化工作流,包含 12 个节点。主要使用 Set, HttpRequest, ManualTrigger, ChainLlm, LmChatOpenAi 等节点,结合人工智能技术实现智能自动化。 使用AI翻译音频
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "f2ec712a-5120-44d8-9581-285d8b866322",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-160,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b16a56a5-0b0c-43cc-952c-f6db1b63d1e9",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
20,
60
],
"parameters": {
"color": 7,
"width": 199.37543798209555,
"height": 420.623805972039,
"content": "1] 在ElevenLabs中,将语音添加到您的[语音实验室](https://elevenlabs.io/voice-lab)并复制其ID。打开此节点并在那里添加ID"
},
"typeVersion": 1
},
{
"id": "08e26051-58e9-42c5-b198-7854ab3e58d6",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
60
],
"parameters": {
"color": 7,
"width": 212,
"height": 418,
"content": "2] 获取您的ElevenLabs API密钥(点击[ElevenLabs](https://elevenlabs.io/voice-lab)左下角的您的姓名,选择\"个人资料\")"
},
"typeVersion": 1
},
{
"id": "de6eb950-862e-472b-8776-b45e3109561a",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
60
],
"parameters": {
"color": 7,
"width": 392,
"height": 415,
"content": "3] 在此节点的\"凭据\"字段中,使用您的[OpenAI API密钥](https://platform.openai.com/api-keys)创建新的OpenAI凭据"
},
"typeVersion": 1
},
{
"id": "e1d8158a-ad82-4b65-a2a8-a8f86cafd970",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-280,
20
],
"parameters": {
"color": 7,
"width": 230.39134868652621,
"height": 233.3354221029769,
"content": "### 关于"
},
"typeVersion": 1
},
{
"id": "9614bb02-3b9c-4c5d-b596-8f94704cdb8b",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"color": 7,
"width": 906,
"height": 498,
"content": "### 设置步骤"
},
"typeVersion": 1
},
{
"id": "69ebcaf8-58ab-48ba-967a-a1f0497524bb",
"name": "转录音频",
"type": "n8n-nodes-base.httpRequest",
"position": [
720,
320
],
"parameters": {
"url": "https://api.openai.com/v1/audio/transcriptions",
"method": "POST",
"options": {
"lowercaseHeaders": false
},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "file",
"parameterType": "formBinaryData",
"inputDataFieldName": "data"
},
{
"name": "model",
"value": "whisper-1"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "multipart/form-data"
}
]
},
"nodeCredentialType": "openAiApi"
},
"credentials": {
"openAiApi": {
"id": "8gccIjcuf3gvaoEr",
"name": "OpenAi account"
}
},
"typeVersion": 4.2
},
{
"id": "4109bccb-2bfd-454b-accb-074bd6980897",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
940,
500
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8gccIjcuf3gvaoEr",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "5178a17e-737c-4ad1-8f56-95707430e892",
"name": "设置ElevenLabs语音ID和文本",
"type": "n8n-nodes-base.set",
"position": [
60,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c0f610ff-e200-4e55-a140-e8a4d6fa0eed",
"name": "voice_id",
"type": "string",
"value": "Xb7hH8MSUJpSbSDYk0k2"
},
{
"id": "6755d8ae-e3df-465c-97ef-4f0187c31824",
"name": "text",
"type": "string",
"value": "=Après, on a fait la sieste, Camille a travaillé pour French Today et j’ai étudié un peu, et puis Camille a proposé de suivre une visite guidée de l’Abbaye de Beauport qui commençait à 17 heures. On a marché environ vingt minutes, et je m’arrêtais souvent pour prendre des photos : la baie de Paimpol est si jolie ! Mais Camille m’a dit : « Dépêche-toi Sunny ! La visite guidée commence dans cinq minutes. » Donc, j’ai bougé mes fesses et on est arrivées à l’abbaye"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "7aafe155-28da-43f4-8305-2dc834f0d95a",
"name": "生成法语音频",
"type": "n8n-nodes-base.httpRequest",
"position": [
300,
320
],
"parameters": {
"url": "=https://api.elevenlabs.io/v1/text-to-speech/{{ $json.voice_id }}",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
},
"jsonBody": "={\"text\":\"{{ $json.text }}\",\"model_id\":\"eleven_multilingual_v2\",\"voice_settings\":{\"stability\":0.5,\"similarity_boost\":0.5}}",
"sendBody": true,
"sendQuery": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"queryParameters": {
"parameters": [
{
"name": "optimize_streaming_latency",
"value": "1"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "audio/mpeg"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "wXsJ55OgKMW01nWm",
"name": "ElevenLabs API Key"
}
},
"typeVersion": 4.2
},
{
"id": "a8e75db9-4164-4332-bec3-01f91f40127f",
"name": "将文本翻译为英语",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
960,
320
],
"parameters": {
"text": "=Translate to English:\n{{ $json.text }}",
"promptType": "define"
},
"typeVersion": 1.5
},
{
"id": "57ea8bc0-a372-41f8-9b7c-6aef0350d9eb",
"name": "将英语文本转换为语音",
"type": "n8n-nodes-base.httpRequest",
"position": [
1320,
320
],
"parameters": {
"url": "=https://api.elevenlabs.io/v1/text-to-speech/{{ $('Set ElevenLabs voice ID and text').first().json.voice_id }}",
"method": "POST",
"options": {},
"jsonBody": "={\"text\":\"{{ $json[\"text\"].replaceAll('\"', '\\\\\"').trim() }}\",\"model_id\":\"eleven_multilingual_v2\",\"voice_settings\":{\"stability\":0.5,\"similarity_boost\":0.5}}",
"sendBody": true,
"sendQuery": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"queryParameters": {
"parameters": [
{
"name": "optimize_streaming_latency",
"value": "1"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "audio/mpeg"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "wXsJ55OgKMW01nWm",
"name": "ElevenLabs API Key"
}
},
"typeVersion": 4.2
},
{
"id": "d6bb0022-8c51-41f1-9159-139a45457201",
"name": "添加文件名",
"type": "n8n-nodes-base.code",
"position": [
540,
320
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.binary.data.fileName = \"audio.mp3\";\n}\n\nreturn $input.all();"
},
"typeVersion": 2
}
],
"pinData": {},
"connections": {
"Add Filename": {
"main": [
[
{
"node": "Transcribe audio",
"type": "main",
"index": 0
}
]
]
},
"Transcribe audio": {
"main": [
[
{
"node": "Translate Text to English",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Translate Text to English",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Generate French Audio": {
"main": [
[
{
"node": "Add Filename",
"type": "main",
"index": 0
}
]
]
},
"Translate Text to English": {
"main": [
[
{
"node": "Translate English text to speech",
"type": "main",
"index": 0
}
]
]
},
"Set ElevenLabs voice ID and text": {
"main": [
[
{
"node": "Generate French Audio",
"type": "main",
"index": 0
}
]
]
},
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Set ElevenLabs voice ID and text",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
评估指标示例:RAG文档相关性
评估指标示例:RAG文档相关性
Set
Evaluation
Google Sheets
+13
26 节点David Roberts
工程
在n8n中使用任意LangChain模块(通过LangChain代码节点)
在n8n中使用任意LangChain模块(通过LangChain代码节点)
Set
Manual Trigger
Code
+2
6 节点David Roberts
人工智能
基于动态提示与Airtable的AI数据提取
通过动态提示与Airtable实现AI数据提取
Set
Code
Filter
+11
51 节点Jimleuk
人工智能
来自域名 - Perplexity、Linkedin、网站、Hunter、Airtop的B2B研究公司
AI潜在客户研究员:仅需公司名称和域名,集成ISCP
Set
Wait
Merge
+13
36 节点LukaszB
销售
高级聊天机器人+RAG代理
基于OpenAI、Google Sheets、Glide和Supabase的AI驱动RAG问答聊天机器人
Set
Webhook
Google Drive
+14
34 节点Sam Yassine
客户支持
博客自动化模板
从Google表格撰写和发布博客文章
If
Set
Code
+7
35 节点Daniel Nolde
人工智能