Générer des images IA à partir de invites texte avec BananaAPI et le moteur Nano Banana
Ceci est unContent Creation, Miscellaneous, Multimodal AIworkflow d'automatisation du domainecontenant 16 nœuds.Utilise principalement des nœuds comme If, Set, Wait, FormTrigger, HttpRequest. Générer des images IA à partir de prompts texte avec BananaAPI et le moteur Nano Banana
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
Nœuds utilisés (16)
{
"meta": {
"instanceId": "ae35fcac1ced05e71449f098fbec8ecb6349893e0c2112cc033acbf2f682aad4"
},
"nodes": [
{
"id": "c77e4131-abb7-4f10-bac4-809dc2467d42",
"name": "Formulaire — Saisir le prompt",
"type": "n8n-nodes-base.formTrigger",
"position": [
560,
1136
],
"webhookId": "9f404ff0-1029-4086-b044-43cbbd9d1039",
"parameters": {
"options": {},
"formTitle": "Banana API — Image Generator",
"formFields": {
"values": [
{
"fieldLabel": "api_token",
"placeholder": "Bearer xxxxxxx...",
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "prompt",
"placeholder": "Ví dụ: a neon cyberpunk cat, detailed, 4k",
"requiredField": true
},
{
"fieldType": "dropdown",
"fieldLabel": "Output Format [optional]",
"fieldOptions": {
"values": [
{
"option": "png"
},
{
"option": "jpeg"
}
]
}
},
{
"fieldType": "dropdown",
"fieldLabel": "Image Size [optional]",
"fieldOptions": {
"values": [
{
"option": "16:9"
},
{
"option": "9:16"
},
{
"option": "1:1"
},
{
"option": "3:4"
},
{
"option": "4:3"
}
]
}
},
{
"fieldLabel": "image_url_1 [optional]",
"placeholder": "https://example.com/input.jpg"
},
{
"fieldLabel": "image_url_2 [optional]"
},
{
"fieldLabel": "image_url_3 [optional]"
},
{
"fieldLabel": "image_url_4 [optional]"
},
{
"fieldLabel": "image_url_5 [optional]"
}
]
},
"formDescription": "Enter the prompt and (optionally) the original image link for the Banana API to generate a new image."
},
"typeVersion": 2.2
},
{
"id": "aa769a6a-0170-4851-82b8-0169eca8ec4a",
"name": "Soumettre — Banana API",
"type": "n8n-nodes-base.httpRequest",
"position": [
1072,
1136
],
"parameters": {
"url": "https://bananaapi.com/api/n8n/generate/",
"method": "POST",
"options": {},
"jsonBody": "={\n \"input\": {\n \"prompt\": \"{{ $json.prompt }}\",\n \"image_size\": \"{{ $json['Image Size [optional]'] }}\",\n \"output_format\": \"{{ $json['Output Format [optional]'] }}\",\n \"image_urls\": [\"{{ $json['image_url_1 [optional]'] }}\",\"{{ $json['image_url_2 [optional]'] }}\",\"{{ $json['image_url_3 [optional]'] }}\",\"{{ $json['image_url_4 [optional]'] }}\",\"{{ $json['image_url_5 [optional]'] }}\"]\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "=Bearer {{ $json.api_token }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "c3522fe8-9442-4fcc-a2d2-cd90ac3fef15",
"name": "Attendre 5s",
"type": "n8n-nodes-base.wait",
"position": [
1472,
1136
],
"webhookId": "72d55c47-b651-4121-b59f-dab21489cb35",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "037eee00-f9da-41bc-b508-6bb3fa87c68a",
"name": "Vérifier le statut",
"type": "n8n-nodes-base.httpRequest",
"position": [
1632,
1136
],
"parameters": {
"url": "=https://bananaapi.com/api/n8n/image-status/{{$('Submit — Banana API').item.json.taskId}}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "749b2fd0-650c-4b31-9527-c7b84a2c7357",
"name": "Attendre 5s (boucle)",
"type": "n8n-nodes-base.wait",
"position": [
2048,
1088
],
"webhookId": "b347eefb-f36a-4072-9135-fb4ad8abed5d",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "3d5b6f8d-364b-4a48-82cb-fc5409502788",
"name": "Retourner les liens",
"type": "n8n-nodes-base.set",
"position": [
2528,
1056
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "80fd7573-3eac-4fc4-aced-b122e5eac718",
"name": "image_url",
"type": "string",
"value": "={{$json.imageUrl}}"
},
{
"id": "26339522-2fe9-48f6-aafd-e1aa9ed89327",
"name": "task_id",
"type": "string",
"value": "={{$('Submit — Banana API').item.json.taskId}}"
},
{
"id": "3e26803c-640d-463d-b857-a3bd29ea2358",
"name": "status",
"type": "string",
"value": "={{$json.status}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "01a74ecd-93e3-4eb3-ab72-3ab82a008294",
"name": "Condition Si",
"type": "n8n-nodes-base.if",
"position": [
1808,
1072
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4e3a3b7c-61e8-49c4-abf7-5eb3db4a3eef",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Check Status').item.json.status }}",
"rightValue": "=completed"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "0f715abf-ae0a-42d5-8647-5e9488cd3f9d",
"name": "NOTE — Aperçu",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
448
],
"parameters": {
"color": 3,
"width": 480,
"height": 336,
"content": "## Overview\nThis workflow integrates **BananaAPI.com** with the **Google Nano Banana** image generation engine. Users can submit prompts and optional reference images via a form, then the workflow calls BananaAPI.com, checks the task status in a loop, and finally returns the generated image link.\n\n**Why use it?**\n- Cost effective: only **$0.025 per image**\n- **Pay-as-you-go**: pay only for what you use\n- **Credits never expire**: no monthly subscription pressure\n\nIdeal for creators, marketers, and developers who want affordable and automated image generation."
},
"typeVersion": 1
},
{
"id": "71c558a9-d4e5-4ba2-8dc1-170e8a4ba0db",
"name": "NOTE — Prérequis",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
448
],
"parameters": {
"color": 3,
"width": 480,
"height": 336,
"content": "## Prerequisites\n- **BananaAPI.com account + API key (Bearer)** — create your key at https://bananaapi.com/api\n- An **n8n instance** (Cloud or self-hosted)\n- Basic knowledge of AI prompts to get the best quality images\n\n⚠️ Never commit or share your API key publicly. Use **n8n Credentials** for production setups."
},
"typeVersion": 1
},
{
"id": "77a8c9f2-61af-4e2e-9ba4-6c3ca1494567",
"name": "NOTE — Étape 1 (Saisie formulaire)",
"type": "n8n-nodes-base.stickyNote",
"position": [
400,
800
],
"parameters": {
"width": 464,
"height": 496,
"content": "## Step 1 — User Form Input\nThe **Form Trigger** asks the user to provide:\n- `api_token` (required) — Banana API Bearer token\n- `prompt` (required) — image description (e.g. *“a neon cyberpunk cat, detailed, 4k”*)\n- `Output Format [optional]` — choose PNG or JPEG\n- `Image Size [optional]` — 16:9, 9:16, 1:1, 3:4, 4:3\n- `image_url_1 ... image_url_5 [optional]` — reference images for editing or transformation"
},
"typeVersion": 1
},
{
"id": "5ae4ce78-4f6c-4148-8485-a90d21ba32dd",
"name": "NOTE — Étape 2 (Requête POST)",
"type": "n8n-nodes-base.stickyNote",
"position": [
896,
800
],
"parameters": {
"width": 464,
"height": 496,
"content": "## Step 2 — Submit to Banana API\nThe **HTTP POST** node sends the request:\n- URL: `https://bananaapi.com/api/n8n/generate/`\n- Headers:\n - `Content-Type: application/json`\n - `Authorization: Bearer {{ $json.api_token }}`\n- JSON Body includes:\n - `prompt`\n - `image_size`\n - `output_format`\n - `image_urls` (array of up to 5)\n\nBananaAPI will return a `taskId` to track progress."
},
"typeVersion": 1
},
{
"id": "3c7bfc47-5d0f-45fb-a53f-25c24d2ed1f5",
"name": "NOTE — Étape 3 (Traitement)",
"type": "n8n-nodes-base.stickyNote",
"position": [
1392,
800
],
"parameters": {
"width": 912,
"height": 496,
"content": "## Step 3 — Processing\nBananaAPI forwards the request to the **Nano Banana** engine, which generates or edits the image based on the prompt and optional input images.\n\n⏱ Average generation time: a few seconds to ~1 minute, depending on complexity and server load.\n- After 5s wait, the workflow calls:\n `GET https://bananaapi.com/api/n8n/image-status/{{ taskId }}`\n- If `status != completed`, the loop waits 5s and retries\n- When `status = completed`, the workflow continues"
},
"typeVersion": 1
},
{
"id": "583222b7-f53c-4376-8958-4c544c4ace60",
"name": "NOTE — Étape 5 (Sortie)",
"type": "n8n-nodes-base.stickyNote",
"position": [
2336,
800
],
"parameters": {
"width": 464,
"height": 496,
"content": "## Step 4 — Return Output\nWhen completed, the **Set node** outputs:\n- `image_url` — the final generated image link\n- `task_id` — the task reference ID\n- `status` — task completion state\n\n💡 Tip: Add a **Webhook Response** node to return a clean JSON payload for frontend apps."
},
"typeVersion": 1
},
{
"id": "abfd4d9f-d7be-4a74-87ae-8618a6ff826a",
"name": "NOTE — Référence API",
"type": "n8n-nodes-base.stickyNote",
"position": [
2320,
448
],
"parameters": {
"color": 3,
"width": 480,
"height": 336,
"content": "## API Reference\n- **POST** `https://bananaapi.com/api/n8n/generate/`\n- **GET** `https://bananaapi.com/api/n8n/image-status/{taskId}`\n\nDocs: https://bananaapi.com/api\n\n✅ Always include `Authorization: Bearer <token>` in headers."
},
"typeVersion": 1
},
{
"id": "5074a457-5ec7-4a5c-81bc-54c120818b08",
"name": "NOTE — Avantages tarifaires",
"type": "n8n-nodes-base.stickyNote",
"position": [
1360,
448
],
"parameters": {
"color": 3,
"width": 480,
"height": 336,
"content": "## Pricing Advantages\n- **Only $0.025 per image** — very cost-effective\n- **Pay-as-you-go**: no monthly subscription\n- **Credits never expire** — use anytime, no rush\n\nPerfect for scaling automation workflows or experimenting without wasted costs."
},
"typeVersion": 1
},
{
"id": "1d11806a-56e9-4e02-9aeb-5dfef750b1ae",
"name": "NOTE — Dépannage",
"type": "n8n-nodes-base.stickyNote",
"position": [
1840,
448
],
"parameters": {
"color": 3,
"width": 480,
"height": 336,
"content": "## Troubleshooting\n- **401/403 Unauthorized** → Check Authorization header (`Bearer token`)\n- **Invalid JSON** → Ensure POST body is valid JSON (double quotes, no trailing commas)\n- **No imageUrl returned** → Task still pending; wait longer or re-check taskId\n- **Slow performance** → Increase wait interval from 5s to 8–10s"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"01a74ecd-93e3-4eb3-ab72-3ab82a008294": {
"main": [
[
{
"node": "3d5b6f8d-364b-4a48-82cb-fc5409502788",
"type": "main",
"index": 0
}
],
[
{
"node": "749b2fd0-650c-4b31-9527-c7b84a2c7357",
"type": "main",
"index": 0
}
]
]
},
"c3522fe8-9442-4fcc-a2d2-cd90ac3fef15": {
"main": [
[
{
"node": "037eee00-f9da-41bc-b508-6bb3fa87c68a",
"type": "main",
"index": 0
}
]
]
},
"037eee00-f9da-41bc-b508-6bb3fa87c68a": {
"main": [
[
{
"node": "01a74ecd-93e3-4eb3-ab72-3ab82a008294",
"type": "main",
"index": 0
}
]
]
},
"749b2fd0-650c-4b31-9527-c7b84a2c7357": {
"main": [
[
{
"node": "037eee00-f9da-41bc-b508-6bb3fa87c68a",
"type": "main",
"index": 0
}
]
]
},
"c77e4131-abb7-4f10-bac4-809dc2467d42": {
"main": [
[
{
"node": "aa769a6a-0170-4851-82b8-0169eca8ec4a",
"type": "main",
"index": 0
}
]
]
},
"aa769a6a-0170-4851-82b8-0169eca8ec4a": {
"main": [
[
{
"node": "c3522fe8-9442-4fcc-a2d2-cd90ac3fef15",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé - Création de contenu, Divers, IA Multimodale
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Tran Trung Nghia
@trungnghialkPartager ce workflow