OpenAI Generate Image
Description
Section titled “Description”This module generates images from text using OpenAI’s DALL-E 3 model. Its execution flow is:
- Obtains the credentials (apiKey) from the credentials system.
- Determines the prompt to use, with priority:
data.prompt_image>data.prompt>config.prompt. - Sends a request to the OpenAI image generation API with the DALL-E 3 model and 1024x1024 size.
- Downloads the generated image from OpenAI’s temporary URL.
- Saves the image locally in the
temporal/cli_{client_id}/directory with a unique UUID name. - Generates a public download URL based on
ENGINE_HOST. - Returns the OpenAI URL, public download URL, and local file path.
If the prompt comes from data.prompt_image, the original data is preserved in the response (persistent mode).
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | OpenAI API credentials (apiKey). |
| prompt | textarea | Yes | Text description of the image to generate. |
| size | text | No | Image size. The module internally uses 1024x1024 with DALL-E 3. |
Credentials
Section titled “Credentials”credentials_id is required with an object containing apiKey (OpenAI API key with access to DALL-E).
Output
Section titled “Output”{ "nextModule": "siguiente-nodo", "data": { "imageUrl": "https://oaidalleapiprodscus.blob.core.windows.net/...", "urlPath": "https://mi-engine.com/download/cli_1/abc123.png", "localPath": "/app/temporal/cli_1/abc123.png" }, "_meta_": { "prompt": "Un gato astronauta en la luna", "tokens_consumed": 0.4 }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "credentials_id": "credencial-openai", "prompt": "Un paisaje futurista de una ciudad con edificios flotantes al atardecer"}API Used
Section titled “API Used”- OpenAI Images API:
POST https://api.openai.com/v1/images/generations - Model: DALL-E 3
- Authentication: Bearer token with apiKey.
- Images are always generated at 1024x1024 size with DALL-E 3, regardless of the configured
sizeparameter. - The image is saved locally in
temporal/cli_{client_id}/and is accessible via the engine’s download URL. - The OpenAI URL (
imageUrl) is temporary and expires after some time. - The temporary directory is automatically created if it does not exist.
- The estimated cost is reported as 0.4 in
_meta_.tokens_consumed(approximate reference). - If
data.prompt_imageexists, persistent mode is activated which preserves all original data in the response.
Related Nodes
Section titled “Related Nodes”- openaiAccess - OpenAI API (for text generation)
- gemini - Gemini AI (Google alternative)