Actions26
- Upload Actions
- Transform Actions
- Generate Actions
- Asset Actions
- Widget Actions
- Library Actions
- Asset (Legacy, by Public ID) Actions
Generate → Generate Image From Text
AI-generatedSummary
Generates an image from a text prompt using Cloudinary's AI image generation, returning storage metadata or the raw API response based on configuration.
Inputs
- prompt (required) — The text description of the image to generate (up to 16,384 characters)
- modelSelection — Selects the model and quality tier for image generation. Options include Default, family-based tiers, specific model IDs, or auto-selection.
- modelFamily — Selects the model family (e.g., FLUX, GPT Image, Ideogram, Nano Banana, Recraft) when modelSelection is set to family.
- modelTier — Selects the quality tier within the chosen model family (Standard or Premium).
- textToImageModelId — Specifies an exact model ID for generation. Use Expression mode to enter custom IDs not listed.
- modelPreference — Optimizes model selection for balanced quality/cost, quality-only, economy-only, or fast model completion.
- imageSize — Controls output size: model default, aspect ratio tier, or exact pixel dimensions.
- imageSizeAspectRatio — Output aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4). Required when imageSize is set to aspectRatio.
- imageSizeResolution — Resolution tier (0.5K, 1K, 2K, 4K) for the longest edge. Required when imageSize is set to aspectRatio.
- imageSizeWidth — Output width in pixels (64-4096). Required when imageSize is set to dimensions.
- imageSizeHeight — Output height in pixels (64-4096). Required when imageSize is set to dimensions.
- generateOptions — Optional generation settings including async mode, output format, notification URL, public ID, seed, storage type, and upload preset.
- simplify — When true (default), returns a single item with image storage fields (public_id, asset_id, secure_url). When false, returns the raw Cloudinary API response.
Output shape
A single record with image generation storage fields (public_id, asset_id, secure_url, etc.) at the top level when simplify is true; otherwise the raw Cloudinary API generation response.
Shape depends on the simplify parameter. If async mode is enabled in generateOptions, the operation returns immediately with a task_id instead of waiting for the image. Format, storage type, and model settings affect URL availability and asset persistence.
Examples
Example 1: Generate a basic image and retrieve stored asset details.
Set prompt to a text description; keep simplify as default (true) to receive public_id, asset_id, and secure_url in the output.
Example 2: Generate an image with a specific model family and aspect ratio.
Set modelSelection to family, modelFamily to flux, imageSize to aspectRatio 16:9, and imageSizeResolution to 1K; set simplify to false for raw API response.
Example 3: Generate an image asynchronously for later polling.
Enable async in generateOptions to receive a task_id immediately; use the Get Generation Task operation later to retrieve the result.