Overview
This node generates an image based on a text prompt using OpenAI's image generation API and then uploads the generated image to UploadThing, a file hosting service. It is useful for automating workflows where you want to create AI-generated images and immediately store or share them via a cloud upload service.
Common scenarios:
- Automatically generating visual content for marketing materials or social media posts.
- Creating unique images for blog articles or newsletters without manual design work.
- Integrating AI image creation into content management systems with automatic upload and storage.
Practical example:
You provide a prompt like "A futuristic cityscape at sunset," specify the desired image size and file name, and the node returns a URL to the uploaded image that can be used downstream in your workflow.
Properties
| Name | Meaning |
|---|---|
| Prompt | The textual description used to generate the image (e.g., "A futuristic cityscape at sunset..."). This is required. |
| Size | The resolution of the generated image. Options: 1024×1024, 1536×1024, 1024×1536, or Auto. |
| File Name | The name to assign to the uploaded image file (default: generated.png). |
| ACL | Access control level for the uploaded file. Options: Public Read or Private. |
| Content Disposition | How the file should be served when accessed. Options: Inline (displayed in browser) or Attachment (downloaded). |
Output
The node outputs an array of JSON objects, each representing one processed input item. Each output object contains:
prompt: The original prompt string.size: The requested image size.fileName: The name assigned to the uploaded file.acl: The access control setting used.contentDisposition: The content disposition setting used.fileKey: The internal key identifying the uploaded file.url: The publicly accessible URL of the uploaded image.name: The name of the uploaded file as stored.sizeBytes: The size of the uploaded file in bytes.
If the node encounters an error and is configured to continue on failure, it outputs the original input JSON along with an error field describing the issue.
No binary data is output directly; the image is uploaded and only metadata plus URLs are returned.
Dependencies
Requires valid API credentials for:
- OpenAI API (for image generation).
- UploadThing API (for file uploading).
These credentials must be configured in n8n prior to using the node.
The node uses the OpenAI SDK and UploadThing server SDK internally.
Troubleshooting
Common issues:
- Missing prompt: The node throws an error if the prompt property is empty because it is required to generate an image.
- OpenAI API errors: If the OpenAI API does not return image data, the node will fail with an error indicating no image was received.
- Upload failures: If UploadThing fails to upload the file, the node reports the error message from UploadThing.
- Credential problems: Invalid or missing API keys for either OpenAI or UploadThing will cause authentication errors.
Error messages and resolutions:
"Prompt is required": Ensure the prompt field is filled in for every input item."OpenAI did not return image data": Check your OpenAI API usage limits and ensure the prompt is valid."UploadThing upload failed": Verify your UploadThing API token and network connectivity.- Credential-related errors: Confirm that both API credentials are correctly set up in n8n.