Skip to content

Instantly share code, notes, and snippets.

@meetbryce
Created April 23, 2026 00:25
Show Gist options
  • Select an option

  • Save meetbryce/91302f9412bcfdca8c9458153cbaff0f to your computer and use it in GitHub Desktop.

Select an option

Save meetbryce/91302f9412bcfdca8c9458153cbaff0f to your computer and use it in GitHub Desktop.
gpt-image-2 in n8n
{
"nodes": [
{
"parameters": {},
"id": "526dc07a-d279-4ff6-9572-3e3dbb834cbf",
"name": "Manual Trigger",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.openai.com/v1/images/generations",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "openAiApi",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "{\n \"model\":\"gpt-image-2\",\n \"quality\":\"low\",\n \"prompt\":\"A photorealistic image of a family laughing together on a couch, bathed in the warm glow of a television, perfectly targeted ads playing in the background\"\n}",
"options": {}
},
"id": "6f2665ca-e298-4d59-a97c-f75c614eed4c",
"name": "Generate Image (gpt-image-2)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
304,
0
],
"credentials": {
"openAiApi": {
"id": "OKt7V21fcv11ZGwI",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"operation": "toBinary",
"sourceProperty": "image_b64",
"binaryPropertyName": "image",
"options": {}
},
"id": "60038c49-85fb-42b7-a29d-0f2900e3ca65",
"name": "Convert to PNG",
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
912,
0
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "1",
"name": "image_b64",
"value": "={{ $json.data[0].b64_json }}",
"type": "string"
}
]
},
"options": {}
},
"id": "6fff7ae2-b5c5-4611-92ba-a51fb9abdaed",
"name": "Extract Base64",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
608,
0
]
}
],
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Generate Image (gpt-image-2)",
"type": "main",
"index": 0
}
]
]
},
"Generate Image (gpt-image-2)": {
"main": [
[
{
"node": "Extract Base64",
"type": "main",
"index": 0
}
]
]
},
"Extract Base64": {
"main": [
[
{
"node": "Convert to PNG",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "a463bbe617621da70d36da84cf7e7266cd9748bbc4cb278db0b4ee1ef013821a"
}
}
@sglznc
Copy link
Copy Markdown

sglznc commented Apr 25, 2026

thanks
could you give a sample with images?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment