Picking an Image Model
features.ai.image.model controls the preferred model for AI image
generation and editing — Magic Image and the image editor's AI
chat. It is independent of features.ai.model,
which only affects the assistant's text/chat model.
Leave features.ai.image unset and Unlayer picks the best image model for
you. Set it only when you need to pin a specific provider or model.
Pin a model
features.ai.image.model mirrors features.ai.model. It accepts:
- a
"<provider>/<modelId>"pair (e.g."openai/gpt-image-2","google/gemini-3.1-flash-image-preview") — pins both provider and model, unambiguous; - a bare model id (e.g.
"gpt-image-2"); - a provider name (e.g.
"openai","google") — starts on that vendor and lets Unlayer pick that provider's default image model.
The selected model is the first choice. If that provider is overloaded,
rate-limited, unavailable, or returns another transient provider error,
Unlayer may retry the request against a fallback image model when you set
fallbackModels to true or an explicit ordered list.
unlayer.init({
features: {
ai: {
enabled: true,
assistant: true,
image: {
// Provider only — Unlayer picks that provider's image model:
model: 'openai',
// Or pin an exact model:
// model: 'openai/gpt-image-2',
// model: 'google/gemini-3.1-flash-image-preview',
// Quality tier (low | medium | high). Defaults to 'medium'.
// quality: 'high',
// Optional transient-outage fallback controls:
// fallbackModels: ['google/gemini-2.5-flash-image', 'openai/gpt-image-1.5'],
// fallbackModels: true,
// fallbackModels: false,
},
},
},
});
Supported providers: google and openai. An unsupported provider or image
model is rejected.
Configure fallback image models
features.ai.image.fallbackModels controls the transient-outage fallback
tail for image generation and editing:
- omit it to use Unlayer's default fallback picks only when
features.ai.image.modelis unset; - set
trueto use Unlayer's default fallback picks even whenfeatures.ai.image.modelpins a provider or model; - set
falseto disable the default outage fallback tail; - pass an ordered model array to replace the default fallback picks.
Fallbacks are only used for provider availability failures such as network errors, overloads, rate limits, and 5xx responses. They are not used for invalid image prompts, unsupported model IDs, invalid API keys, authorization errors, credit exhaustion, or errors that require a change from you or Unlayer.
Quality vs. cost
If you do pin a model, here's how the provider families generally compare:
| Provider family | Relative cost | Best for |
|---|---|---|
| OpenAI image | Varies | Explicit opt-in control over OpenAI image SKUs. |
| Gemini image | Standard | Strong all-rounder for generation and editing. |
The quality tier (low | medium | high) applies to every provider — higher tiers cost more. It's mapped internally (OpenAI → quality tier, Gemini → 1K/2K/4K resolution).
Related
- Picking a model — the assistant's text/chat model.
- Custom OpenAI Key — bring your own OpenAI billing.
- Custom Gemini Key — bring your own Google billing.
- Pricing — how AI usage is billed.