AI Assistant
This feature is only available in paid plans. Learn More
The AI Assistant adds a chat panel to the Image Editor where users describe the edit they want in plain language — "remove the background", "increase brightness", "make it look vintage" — and the editor applies it to the image. The panel also offers one-click suggestions for common edits.
AI edits participate in the same undo/redo history as manual edits, so users can freely combine both.
Enabling the AI Assistant
Enable the assistant through the features.ai flag:
window.ImageEditor.createEditor({
container: '#editor-container',
image: imageUrl,
projectId: 1234, // Required for AI features
features: {
ai: {
enabled: true,
assistant: true,
},
},
});
AI features require a projectId so usage can be attributed to your Unlayer project. Without a projectId, the AI Assistant is hidden from the editor.
Panel State
When the AI Assistant is available, its panel starts open by default. Set aiAssistantOpenState to 'closed' if you want users to open it themselves from the tool rail:
window.ImageEditor.createEditor({
container: '#editor-container',
image: imageUrl,
projectId: 1234,
features: { ai: { enabled: true, assistant: true } },
aiAssistantOpenState: 'closed', // 'open' (default) or 'closed'
});
Default Prompt
You can pre-fill the chat input with a prompt — useful when your application already knows what the user wants to do (for example, a "Remove background" button that opens the editor):
window.ImageEditor.createEditor({
container: '#editor-container',
image: imageUrl,
projectId: 1234,
features: { ai: { enabled: true, assistant: true } },
aiAssistantOpenState: 'open',
defaultPrompt: 'Remove the background',
autoSubmitPrompt: true, // Submit immediately instead of just pre-filling
});
With autoSubmitPrompt: false (the default), the prompt is pre-filled and the user submits it themselves.
Auto-submit only happens when the panel is open — autoSubmitPrompt: true requires aiAssistantOpenState: 'open'. With the panel closed, the prompt is only pre-filled.
Customizing the Assistant's Strings
All AI Assistant copy — the panel title, input placeholder, progress messages, and the built-in suggestions — can be translated or overridden through the translations option using the image_editor.ai_assistant.* keys. See Configuration → Custom Translations and the full key reference.