在 Telegram 中使用 GPT-4o 增强和 Flux Pro 生成 AI 图像
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 If, Set, Telegram, Aggregate, AimlApi 等节点。 在 Telegram 中使用 GPT-4o 增强和 Flux Pro 生成 AI 图像
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "29cf227651b207fca8739269056bd8f95a432c5e246ffae4aaf9220581f6fe53",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "339179e6-1f09-435f-9b5e-c85dc3d9ed98",
"name": "📩 接收 Telegram 消息",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-208,
0
],
"webhookId": "3ceea664-fd53-4141-8bc6-4fdaca0a661d",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "QcfQneMUvIojzFQz",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "38840cb5-dd2d-4e2c-87c0-e57b6064294c",
"name": "📊 获取使用日志",
"type": "n8n-nodes-base.googleSheets",
"position": [
16,
0
],
"parameters": {
"options": {
"returnFirstMatch": false
},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.message.from.id }}",
"lookupColumn": "user_id"
},
{
"lookupValue": "={{ new Date().toISOString().slice(0,10) }}",
"lookupColumn": "date"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 2060422727,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RHgZNdT0whop0JY3vrj83yLtmVluG73NIfLBBa8ckPg/edit#gid=2060422727",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1RHgZNdT0whop0JY3vrj83yLtmVluG73NIfLBBa8ckPg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RHgZNdT0whop0JY3vrj83yLtmVluG73NIfLBBa8ckPg/edit?usp=drivesdk",
"cachedResultName": "Image bot usage statistic"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "FAqNqtaHmPjIXEtc",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "31ef4475-8a58-4dd8-850c-cfe2bbfc3ad7",
"name": "📈 统计今日请求数",
"type": "n8n-nodes-base.aggregate",
"position": [
240,
0
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "67f85ddc-9bcf-4c35-81a1-5a0e1f5d30a6",
"name": "🔢 设置每日限制",
"type": "n8n-nodes-base.set",
"position": [
464,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1514c5a1-1bd4-4ba2-8bb9-30c679ae4f8e",
"name": "daily_limit",
"type": "number",
"value": 5
}
]
}
},
"typeVersion": 3.4
},
{
"id": "19a8f732-f6e0-4134-84fc-dfd7e14c7812",
"name": "🚦 检查是否超出限制?",
"type": "n8n-nodes-base.if",
"position": [
688,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "08e8aac4-9f6a-4fc0-b1ad-7d8493ff74bf",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{$('📈 Count Today’s Requests').item.json.data.length }}",
"rightValue": "={{ $json.daily_limit }}"
}
]
}
},
"executeOnce": false,
"typeVersion": 2.2
},
{
"id": "47ff6a8c-8a13-41f1-8847-7bb50c63014e",
"name": "🚫 通知:超出限制",
"type": "n8n-nodes-base.telegram",
"position": [
912,
112
],
"webhookId": "bb58ce7a-45e5-42d1-a780-7cc47f7402b1",
"parameters": {
"text": "=Sorry! Your *daily limit of {{ $('🔢 Set Daily Limit').item.json.daily_limit }} generations* is exceeded!",
"chatId": "={{ $('📩 Receive Telegram Message').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "QcfQneMUvIojzFQz",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "900536f7-d366-45a9-bafb-2fae6c1c0065",
"name": "📝 记录成功生成",
"type": "n8n-nodes-base.googleSheets",
"position": [
1808,
-96
],
"parameters": {
"columns": {
"value": {
"date": "={{ new Date().toISOString().slice(0,10) }}",
"query": "={{ $('📩 Receive Telegram Message').item.json.message.text }}",
"user_id": "={{ $('📩 Receive Telegram Message').item.json.message.from.id }}",
"result_url": "={{ $('🎨 Generate Image (AI/ML API | flux-pro)').item.json.images[0].url }}"
},
"schema": [
{
"id": "user_id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "query",
"type": "string",
"display": true,
"required": false,
"displayName": "query",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "result_url",
"type": "string",
"display": true,
"required": false,
"displayName": "result_url",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"user_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 2060422727,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RHgZNdT0whop0JY3vrj83yLtmVluG73NIfLBBa8ckPg/edit#gid=2060422727",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1RHgZNdT0whop0JY3vrj83yLtmVluG73NIfLBBa8ckPg",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RHgZNdT0whop0JY3vrj83yLtmVluG73NIfLBBa8ckPg/edit?usp=drivesdk",
"cachedResultName": "Image bot usage statistic"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "FAqNqtaHmPjIXEtc",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "70630f26-3817-41f6-94ee-4f479ad15afe",
"name": "🎨 生成图像(AI/ML API | flux-pro)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1136,
-96
],
"parameters": {
"url": "https://api.aimlapi.com/v1/images/generations",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "model",
"value": "flux-pro"
},
{
"name": "prompt",
"value": "={{ $json.content }}"
},
{
"name": "n",
"value": "1"
},
{
"name": "size",
"value": "1024x1024"
},
{
"name": "response_formats",
"value": "=1"
}
]
},
"nodeCredentialType": "aimlApi"
},
"credentials": {
"aimlApi": {
"id": "fzkUXwSArkMtWVYd",
"name": "AI/ML account"
}
},
"typeVersion": 4.2
},
{
"id": "a47d6a9b-9ca6-4716-9083-d43b666da2e0",
"name": "🧠 增强提示词(AI/ML API | GPT-4o)",
"type": "n8n-nodes-aimlapi.aimlApi",
"position": [
912,
-96
],
"parameters": {
"model": "openai/gpt-4o",
"prompt": "=You are a prompt enhancer for AI image generation. Your task is to take the user's input and return only an improved version of the prompt. Do not include any explanations, introductions, or formatting. Output only the final prompt, nothing else.\n\n🧠 The user’s message is taken as the foundation for visual content generation. This input is then carefully analyzed, enriched, and transformed into a more expressive, structured, and detailed prompt. The purpose of this enhancement is to guide the AI model more effectively, resulting in an image that better matches the user's intent and imagination.\n\n✏️ Original user input:\n{{ $('📩 Receive Telegram Message').item.json.message.text }}",
"options": {},
"requestOptions": {}
},
"credentials": {
"aimlApi": {
"id": "fzkUXwSArkMtWVYd",
"name": "AI/ML account"
}
},
"typeVersion": 1
},
{
"id": "dcffa91d-a4c7-4851-9bdb-85552f4420e5",
"name": "🖋 描述图像(AI/ML API | GPT-4o)",
"type": "n8n-nodes-aimlapi.aimlApi",
"position": [
1360,
-96
],
"parameters": {
"model": "openai/gpt-4o",
"prompt": "=Write a vivid and visually rich description for an AI-generated image, starting with the phrase: \"Here’s your image:\". The description should reflect the result of the prompt below, as if the image already exists.\n\nPrompt:\n\"{{ $json.prompt }}\"\n\nAvoid repeating the prompt verbatim. Use expressive language and sensory detail. Keep it to 1–2 elegant sentences.\n",
"options": {},
"requestOptions": {}
},
"credentials": {
"aimlApi": {
"id": "fzkUXwSArkMtWVYd",
"name": "AI/ML account"
}
},
"typeVersion": 1
},
{
"id": "560a50a5-a96a-48b2-ab1e-1f6f0bcf2a15",
"name": "📤 向用户发送图像",
"type": "n8n-nodes-base.telegram",
"position": [
1584,
-96
],
"webhookId": "4a46da0a-9a91-4f31-802a-f0ce89516aa7",
"parameters": {
"file": "={{ $('🎨 Generate Image (AI/ML API | flux-pro)').item.json.images[0].url }}",
"chatId": "={{ $('📩 Receive Telegram Message').item.json.message.chat.id }}",
"operation": "sendPhoto",
"additionalFields": {
"caption": "={{ $json.content }}"
}
},
"credentials": {
"telegramApi": {
"id": "QcfQneMUvIojzFQz",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "1fed89b3-457f-457e-ba5d-13f209a63cd4",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-272,
-160
],
"parameters": {
"color": 4,
"width": 224,
"height": 336,
"content": "## 传入消息"
},
"typeVersion": 1
},
{
"id": "3623d8a3-1933-4809-ab5b-ed54f039f116",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
-160
],
"parameters": {
"width": 864,
"height": 336,
"content": "## 使用限制检查"
},
"typeVersion": 1
},
{
"id": "a34ed607-47b0-4966-a11f-7298c41b4223",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
-256
],
"parameters": {
"color": 6,
"width": 208,
"height": 336,
"content": "## 提示词增强"
},
"typeVersion": 1
},
{
"id": "02a9f22d-a4d4-4deb-8ed1-4818a9ddf198",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
-256
],
"parameters": {
"color": 6,
"width": 208,
"height": 336,
"content": "## 图像生成"
},
"typeVersion": 1
},
{
"id": "31f52e39-80dc-45d5-9ef8-7c96d55b81a0",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1296,
-256
],
"parameters": {
"color": 6,
"width": 208,
"height": 336,
"content": "## 图像描述"
},
"typeVersion": 1
},
{
"id": "d923875c-b2d0-4804-8050-5b8daa2aaad8",
"name": "便签说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1520,
-256
],
"parameters": {
"color": 4,
"width": 416,
"height": 336,
"content": "## 交付与记录"
},
"typeVersion": 1
},
{
"id": "46afbb51-ec45-49b2-b6b1-c3333328edf1",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
96
],
"parameters": {
"color": 3,
"width": 256,
"height": 352,
"content": ""
},
"typeVersion": 1
},
{
"id": "53ac8095-8518-465d-bc4c-965a7110bd78",
"name": "## 为什么选择 4o 模型?👆",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
-1904
],
"parameters": {
"color": 5,
"width": 560,
"height": 608,
"content": "# 🧠 AI 图像生成器机器人 — Telegram + AIMLAPI(通过 n8n)"
},
"typeVersion": 1
},
{
"id": "56bb2e61-b024-4e87-9471-7f379e9ee6b9",
"name": "便签 9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
-1280
],
"parameters": {
"color": 5,
"width": 560,
"height": 736,
"content": "## ⚙️ 自定义"
},
"typeVersion": 1
},
{
"id": "352ebd4e-5f9e-44b7-8802-2fcf323ca0ad",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
-1808
],
"parameters": {
"color": 5,
"width": 560,
"height": 912,
"content": ""
},
"typeVersion": 1
},
{
"id": "63074211-fe01-4947-9ffd-f45baab48fbd",
"name": "便签11",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
-880
],
"parameters": {
"color": 5,
"width": 560,
"height": 336,
"content": "## 📁 记录的数据"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"🔢 Set Daily Limit": {
"main": [
[
{
"node": "🚦 Check Limit Exceeded?",
"type": "main",
"index": 0
}
]
]
},
"📊 Fetch Usage Logs": {
"main": [
[
{
"node": "📈 Count Today’s Requests",
"type": "main",
"index": 0
}
]
]
},
"📤 Send Image to User": {
"main": [
[
{
"node": "📝 Log Successful Generation",
"type": "main",
"index": 0
}
]
]
},
"🚦 Check Limit Exceeded?": {
"main": [
[
{
"node": "🧠 Enhance Prompt (AI/ML API | GPT-4o)",
"type": "main",
"index": 0
}
],
[
{
"node": "🚫 Notify: Limit Exceeded",
"type": "main",
"index": 0
}
]
]
},
"📈 Count Today’s Requests": {
"main": [
[
{
"node": "🔢 Set Daily Limit",
"type": "main",
"index": 0
}
]
]
},
"📩 Receive Telegram Message": {
"main": [
[
{
"node": "📊 Fetch Usage Logs",
"type": "main",
"index": 0
}
]
]
},
"📝 Log Successful Generation": {
"main": [
[]
]
},
"🖋 Describe Image (AI/ML API | GPT-4o)": {
"main": [
[
{
"node": "📤 Send Image to User",
"type": "main",
"index": 0
}
]
]
},
"🧠 Enhance Prompt (AI/ML API | GPT-4o)": {
"main": [
[
{
"node": "🎨 Generate Image (AI/ML API | flux-pro)",
"type": "main",
"index": 0
}
]
]
},
"🎨 Generate Image (AI/ML API | flux-pro)": {
"main": [
[
{
"node": "🖋 Describe Image (AI/ML API | GPT-4o)",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用Telegram、AIMLAPI和Google表格创建多模型AI聊天机器人
使用Telegram、AIMLAPI和Google表格创建多模型AI聊天机器人
If
Set
Code
+8
25 节点AI/ML API | D1m7asis
个人效率
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+26
156 节点Diptamoy Barman
内容创作
1. 播放列表详情设置机器人副本
使用 Suno、GPT-4、Runway 和 Creatomate 创建 AI 生成的 YouTube 音乐播放列表
If
Set
Code
+22
203 节点Joseph
内容创作
合并
使用Suno API、Claude和Telegram机器人创建完整的20首YouTube播放列表
If
Set
Code
+17
150 节点Joseph
内容创作
使用Veo3、YouTube和Google套件自动化AI视频制作与分发
使用Veo3、YouTube和Google套件自动化AI视频制作与分发
If
Wait
Aiml Api
+6
26 节点Dmitry
内容创作
使用GPT-5和Google Veo-3从文本提示生成视频
使用GPT-5和Google Veo-3从文本提示生成视频
If
Set
Wait
+5
20 节点AI/ML API | D1m7asis
内容创作