Skip to Content
Cheapest Imagen
Guides

Use with n8n

Generate images in an n8n workflow with GPT Image or Nano Banana through the Cheapest Imagen API, using the HTTP Request node. Settings, the request body, and how to save the image.

n8n can call the API with its built-in HTTP Request node. You need an API key from your account.

1. Store the key

In n8n, create a credential of type Header Auth:

FieldValue
NameAuthorization
ValueBearer YOUR_KEY

2. Generate the image

Add an HTTP Request node:

SettingValue
MethodPOST
URLhttps://api.cheapestimagen.com/v1/images/generations
AuthenticationGeneric Credential Type, Header Auth, the credential from step 1
Send Bodyon, Body Content Type JSON
Options, Timeout420000 (an image can take a few minutes)

Body:

{
  "model": "nano-banana-2.1",
  "prompt": "{{ $json.prompt }}",
  "size": "1024x1024",
  "response_format": "url"
}

The node returns the link to the image at data[0].url. To use GPT Image, change model to gpt-image-2 or gpt-image-2.6; every id is on the models page.

3. Save the image

Add a second HTTP Request node:

SettingValue
MethodGET
URL{{ $json.data[0].url }}
Options, Response, Response FormatFile

Its output is the image as binary data, ready for a storage, email or chat node. The link works for 72 hours.

Edit an image

To change an existing picture, call https://api.cheapestimagen.com/v1/images/edits with a JSON body that carries the picture as a link:

{
  "model": "nano-banana-2.1",
  "prompt": "{{ $json.prompt }}",
  "images": [{ "image_url": "{{ $json.imageUrl }}" }],
  "response_format": "url"
}

Limits to plan for

An account may have 50 requests in progress and send 300 a minute. In a loop over many items, set the batch size of the node to 50 or fewer. See Rate limits and bulk generation.

On this page