generateImage creates images from text or edits source images with an optional mask. Omit account to use the platform Vercel AI Gateway credential. Platform generations run in the background, and the result signal emits after generation finishes. Their model cost counts toward the organization’s monthly Platform AI allowance; customer-managed accounts don’t use this allowance. The platform default is bfl/flux-2-flex and generates at most 16 images per action. Use a provider account for larger batches.
If background generation exhausts its retries, the result signal fails with the provider error and prevents dependent actions from running.
Generate an image
automations/create-campaign-image.automation.ts
markSignificant keeps the completed run in the default Recent runs view. Each run uses the organization’s Platform AI allowance.
Edit images
Pass source images and an optional mask in the structured prompt. Each image or mask can be aBlob, base64 string, data URL, HTTP(S) URL, Uint8Array, or ArrayBuffer. generateImage normalizes these inputs, but the selected provider and model must support image editing and masks.
sourceImageBytes and maskBytes can be byte signals returned by earlier actions. Mark the edited image so the completed run stays visible:
Inputs
Generation inputs accept compatible signals. Account selection is static. Model autocomplete follows the selected provider, but arbitrary string IDs remain valid for newly released models.
The inputs mirror the AI SDK
generateImage surface. generateImage also accepts Blob source images and normalizes generated files to Blob values. It omits abortSignal because actions execute durably after planning, so an in-memory AbortSignal can’t control the later provider call.
Output
images contains every generated image as a Blob. The first generated image is images[0]. Read its media type from blob.type, and use standard Blob methods such as arrayBuffer(), bytes(), or text() when you need the contents.
generateImage also returns provider warnings, combined token usage when reported, providerMetadata, and a responses entry for each underlying provider call. Each response includes its start timestamp, model ID, and optional headers.
Provider accounts
Connect credentials withbunx automate.ax accounts, then pass a named account reference. API keys don’t appear in automation code or signals.
Pass a named provider account and mark the generated file: