UNPKG

@inductiv/node-red-openai-api

Version:

Enhance your Node-RED projects with advanced AI capabilities.

271 lines 7.46 kB
[ { "id": "2d1b8a57c16b4e11", "type": "tab", "label": "Image Examples", "disabled": false, "info": "Images parity example flow.\n\nThis tab keeps the current Image 2 contract visible in one place:\n- `gpt-image-2` generate requests can use arbitrary `WIDTHxHEIGHT` sizes such as `1536x864`\n- Image 2 transparency should use `background = \"opaque\"` or `\"auto\"`, not `\"transparent\"`\n- generate and edit can stream image events with `stream = true`\n- edit requests can send multiple input image paths with `payload.image[0]`, `payload.image[1]`, and so on", "env": [] }, { "id": "fb12602d94d979a3", "type": "comment", "z": "2d1b8a57c16b4e11", "name": "Image 2 generate, stream, and multi-image edit examples.", "info": "This flow covers the current image contract in one place:\n- `gpt-image-2` generate requests with arbitrary `WIDTHxHEIGHT` sizes such as `1536x864`\n- `background = \"auto\"` for Image 2 output\n- streaming image events on generate\n- multi-image edit input using `payload.image[0]` and `payload.image[1]`\n\nThe sample file paths are placeholders for local image files.", "x": 540, "y": 120, "wires": [] }, { "id": "21b9e1f63d8310f5", "type": "inject", "z": "2d1b8a57c16b4e11", "name": "Create Image 2 Request", "props": [ { "p": "payload.model", "v": "gpt-image-2", "vt": "str" }, { "p": "payload.prompt", "v": "Create a widescreen transit poster with crisp typography and a sunrise skyline.", "vt": "str" }, { "p": "payload.size", "v": "1536x864", "vt": "str" }, { "p": "payload.background", "v": "auto", "vt": "str" }, { "p": "payload.output_format", "v": "png", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 240, "y": 220, "wires": [ [ "9d53e901db08fd7a" ] ] }, { "id": "9d53e901db08fd7a", "type": "OpenAI API", "z": "2d1b8a57c16b4e11", "name": "Create Image", "service": "", "method": "createImage", "x": 520, "y": 220, "wires": [ [ "519c760e1f253c3e" ] ] }, { "id": "519c760e1f253c3e", "type": "debug", "z": "2d1b8a57c16b4e11", "name": "Image 2 Response", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 780, "y": 220, "wires": [] }, { "id": "f6179cd6673ef32b", "type": "inject", "z": "2d1b8a57c16b4e11", "name": "Create Streaming Image 2 Request", "props": [ { "p": "payload.model", "v": "gpt-image-2", "vt": "str" }, { "p": "payload.prompt", "v": "Create a magazine cover illustration with layered geometric clouds.", "vt": "str" }, { "p": "payload.size", "v": "1536x1024", "vt": "str" }, { "p": "payload.background", "v": "auto", "vt": "str" }, { "p": "payload.output_format", "v": "png", "vt": "str" }, { "p": "payload.stream", "v": "true", "vt": "bool" }, { "p": "payload.partial_images", "v": "2", "vt": "num" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 256, "y": 320, "wires": [ [ "90beb15338ee2b3b" ] ] }, { "id": "90beb15338ee2b3b", "type": "OpenAI API", "z": "2d1b8a57c16b4e11", "name": "Create Image Stream", "service": "", "method": "createImage", "x": 540, "y": 320, "wires": [ [ "6e8eb722311c12b5" ] ] }, { "id": "6e8eb722311c12b5", "type": "debug", "z": "2d1b8a57c16b4e11", "name": "Image Stream Events", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 790, "y": 320, "wires": [] }, { "id": "33f2c9438c57aa68", "type": "inject", "z": "2d1b8a57c16b4e11", "name": "Create Multi-Image Edit Request", "props": [ { "p": "payload.image[0]", "v": "/path/to/source-1.png", "vt": "str" }, { "p": "payload.image[1]", "v": "/path/to/source-2.png", "vt": "str" }, { "p": "payload.prompt", "v": "Blend these two source images into one clean poster composition.", "vt": "str" }, { "p": "payload.model", "v": "gpt-image-2", "vt": "str" }, { "p": "payload.size", "v": "1536x1024", "vt": "str" }, { "p": "payload.background", "v": "auto", "vt": "str" }, { "p": "payload.output_format", "v": "png", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 255, "y": 420, "wires": [ [ "de1e1b1529113bca" ] ] }, { "id": "de1e1b1529113bca", "type": "OpenAI API", "z": "2d1b8a57c16b4e11", "name": "Create Image Edit", "service": "", "method": "createImageEdit", "x": 532, "y": 420, "wires": [ [ "369f4f6bf69af6e0" ] ] }, { "id": "369f4f6bf69af6e0", "type": "debug", "z": "2d1b8a57c16b4e11", "name": "Image Edit Response", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 786, "y": 420, "wires": [] } ]