n8n integration

Images and video inside n8n Generate, wait, download, publish — in one workflow

Connect n8n to BananaBanana with one API key and call Nano Banana, Veo, Gemini Omni, Wan, Grok Imagine, GPT Image, Qwen and Gemini TTS from your workflows. Two ways in: an AI Agent with the MCP Client Tool node, or plain HTTP Request nodes without any language model.

Create an API keyImages from $0.03, video from $0.06 — pay per generation
01What you get

What a workflow can do and what it costs

Every generation is paid from your BananaBanana balance at the same prices as on the website. There is no subscription and no n8n-specific fee. Expensive calls (video, several images at once) return a quote first and charge nothing until you confirm it; failed and filtered generations are refunded automatically.

CallPrice
Image (generate_image, edit_image)$0.03–$0.20 per image
Video clip (generate_video, edit_video)$0.06–$6.00 per clip
Speech (generate_speech)$0.01 per started 200 characters
Status, models, account (get_result, list_models, get_account)free

The exact price of a model, resolution and duration is in list_models and on the pricing page.

02Step 1

Create an API key

  1. Sign up and top up your balance.
  2. Open Profile → API Keys and create a key. It starts with bb_live_ and is shown once — copy it straight into an n8n credential.
  3. Set a daily spending cap on the key that matches your workflow, for example the cost of the runs you expect per day. A loop gone wrong then stops at the cap instead of draining the balance.
  4. In n8n create a Bearer Auth credential and paste the key as the Bearer Token. Both methods below use this one credential.
03Method A

AI Agent + MCP Client Tool

Add an AI Agent node, attach a chat model and attach the MCP Client Tool node with these settings:

Node: MCP Client Tool  (connect it to the AI Agent "Tool" input)
Endpoint URL:      https://bananabanana.pro/api/mcp
Server Transport:  HTTP Streamable
Authentication:    Bearer Auth → your BananaBanana credential
Tools to Include:  Selected → list_models, get_account, generate_image, get_result

The agent needs its own language model (OpenAI, Anthropic, Gemini or any model n8n supports) with its own API key: BananaBanana generates the media, the model decides which tools to call.

Price confirmation

Video and multi-image calls first answer status: confirmation_required with quoted_cost_usd and charge nothing. The money is taken only when the same call comes back with confirm_cost equal to the quote. Tell the agent in its system message what to do: stop and report the price (as below), or confirm on its own up to a limit you name.

System message we use in the ready workflow

You create images with the BananaBanana tools. Call generate_image with the user's
request (model nano-banana-2-lite unless the user names another model; list_models
shows models and prices). generate_image returns a job_id: call get_result with that
job_id and wait_seconds 30 until status is completed. If a tool answers status
confirmation_required, tell the user the quoted price and stop: never pass
confirm_cost on your own. Finish with the first file URL from get_result on its own line.

Generation is asynchronous: generate_image returns a job_id, and get_result waits up to 30 seconds per call until the file is ready. The answer contains a signed file link, which an HTTP Request node after the agent downloads as a file.

Node: HTTP Request  (after the AI Agent)
Method:  GET
URL:     {{ $json.output.match(/https?:\/\/\S+?\/api\/files\/[^\s)"'\]]+/)[0] }}
Options → Response → Response Format: File
04Method B

HTTP Request nodes, no language model

The MCP endpoint is plain JSON over POST, so ordinary HTTP Request nodes can call it directly. This is the cheapest and most predictable option: no model tokens and no agent choosing parameters.

  1. Generate image — POST a tools/call for generate_image. Use {{ $execution.id }} in idempotency_key: if n8n retries the node, the same key returns the original job instead of charging twice.
  2. Get result — POST get_result with the job_id and wait_seconds: 30. An If node sends status: processing to a 5-second Wait and back; completed goes on.
  3. Download file — GET files[0].url with Response Format set to File. The binary goes on to Google Drive, S3, WordPress, YouTube, social posting — any node that accepts a file.
Node: HTTP Request "Generate image"
Method:          POST
URL:             https://bananabanana.pro/api/mcp
Authentication:  Generic Credential Type → Bearer Auth
Send Headers:    Accept = application/json, text/event-stream
Send Body:       JSON →
{{ JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: {
     name: "generate_image",
     arguments: { prompt: $json.prompt, model: "nano-banana-2-lite",
                  aspect_ratio: "1:1", idempotency_key: "n8n-" + $execution.id } } }) }}

→ {{ $json.result.structuredContent.job_id }}   (status: "processing")
Node: HTTP Request "Get result"   (same URL, credential and headers)
{{ JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: {
     name: "get_result",
     arguments: { job_id: $('Generate image').item.json.result.structuredContent.job_id,
                  wait_seconds: 30 } } }) }}

If  {{ $json.result.structuredContent.status }} is "processing"  → Wait 5 s → Get result
If  … is "completed"  → HTTP Request GET {{ $json.result.structuredContent.files[0].url }}
                        Options → Response → Response Format: File

Video: quote, check, confirm

For generate_video send the call twice: the first answer carries quoted_cost_usd; an If node compares it with your limit, and only then the second call passes it back as confirm_cost. Videos take one to ten minutes, so keep the get_result loop.

1. generate_video  { prompt, model: "veo-3.1-fast", duration: 8, resolution: "720p" }
   ← { status: "confirmation_required", quoted_cost_usd: 0.70 }      nothing charged
2. If  {{ $json.result.structuredContent.quoted_cost_usd }}  ≤  your limit
3. generate_video  { …same arguments…, confirm_cost: {{ $json.result.structuredContent.quoted_cost_usd }},
                     idempotency_key: "n8n-" + $execution.id }
   ← { job_id, status: "processing", cost_charged_usd: 0.70 }
4. get_result loop as above (videos take 1–10 minutes)
05Ready workflows

Import a workflow in one minute

Both workflows contain no keys or credentials. In n8n choose Workflows → Import from File (or paste the JSON into the editor), then pick your credentials in the nodes marked with a warning.

  • AI Agent + MCP Client Tool: Manual Trigger → AI Agent (OpenAI Chat Model, BananaBanana MCP) → Download file. Select your OpenAI credential and the Bearer Auth credential.

    Download JSON · bananabanana-n8n-agent.json
  • HTTP Request: Manual Trigger → request settings → Generate image → Get result (with a wait loop) → Download file, plus clear error stops. Select the Bearer Auth credential in the three request nodes.

    Download JSON · bananabanana-n8n-http.json

Both workflows were imported and executed end to end on self-hosted n8n 2.48.7; the default image costs $0.03 per run.

06Troubleshooting

Common errors and what to do

  • 401 — the key is missing, mistyped or revoked. The credential must hold the key itself; n8n adds the word Bearer.
  • INSUFFICIENT_BALANCE — the balance does not cover the call. The answer includes a top-up link; nothing was charged.
  • confirmation_required — not an error: the call needs confirm_cost (see Method A and the video recipe).
  • RATE_LIMITED — more than 20 tool calls per minute on one key. Add a Wait or enable Retry On Fail with a pause.
  • DAILY_CAP_EXCEEDED — the key reached the daily cap you set. Raise it in the profile or wait for the next UTC day.
  • SAFETY_FILTERED — the model's content filter refused the prompt or the result; the charge is refunded. Rephrase the prompt.
  • File links expire after 24 hours. Download the file in the same run; within 30 days get_result returns fresh links.
07FAQ

Questions about n8n and BananaBanana

Is there a BananaBanana node in n8n?

Not in the node list yet. The MCP Client Tool and HTTP Request nodes that ship with n8n already reach every BananaBanana tool, and the ready workflows above set them up for you.

Do I need an OpenAI or other model key?

Only for Method A, where an AI Agent decides which tool to call. Method B with HTTP Request nodes needs nothing but the BananaBanana key.

How much does one workflow run cost?

Exactly the price of what it generates: from $0.03 for an image, from $0.06 for a video clip, $0.01 per started 200 characters of speech. Status checks and downloads are free, and failed generations are refunded.

Can a retry or a loop charge me twice?

Not when the call carries an idempotency_key: a repeated call with the same key returns the original job without a new charge. A daily cap on the key limits the damage of a runaway loop.

Which models can a workflow use?

All models of the platform: Nano Banana 2, 2.1, Lite and Pro, GPT Image and Qwen for images; Veo 3.1, Gemini Omni, Wan 3.0 and Grok Imagine for video; Gemini TTS for speech. list_models returns the current list with prices.

Plug generation into your next workflow

One key, pay per generation, quotes before every expensive call.

Create an API key