Generate Image
curl --request POST \
--url https://api.example.com/api/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model": "<string>",
"size": "<string>",
"n": 123,
"steps": 123,
"negative_prompt": "<string>"
}
'{
"url": "<string>"
}Files & Media
Generate Image
POST
/
api
/
images
/
generations
Generate Image
curl --request POST \
--url https://api.example.com/api/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model": "<string>",
"size": "<string>",
"n": 123,
"steps": 123,
"negative_prompt": "<string>"
}
'{
"url": "<string>"
}Generate images from text prompts using various AI image generation engines including OpenAI DALL-E, Gemini Imagen, ComfyUI, and Automatic1111.
Request
Headers
Bearer token for authentication
Body
Text description of the image to generate
Model to use for generation. Defaults to configured model.OpenAI models:
dall-e-2dall-e-3gpt-image-1gpt-image-1.5
imagen-3.0-generate-002
Image dimensions in format
WIDTHxHEIGHT (e.g., 512x512, 1024x1024)Can also be auto for models that support dynamic sizing.Number of images to generate
Number of inference steps (for Stable Diffusion-based engines)
Negative prompt describing what to avoid in the image (for Stable Diffusion-based engines)
Response
Returns an array of generated image objects.URL path to access the generated image file
Example
curl -X POST https://your-domain.com/api/images/generations \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain landscape at sunset with a lake",
"model": "dall-e-3",
"size": "1024x1024",
"n": 1
}'
Response
[
{
"url": "/api/v1/files/550e8400-e29b-41d4-a716-446655440000/content"
}
]
Supported Engines
Configure the image generation engine in Admin Settings > Images:OpenAI DALL-E
- Cloud-based image generation
- Models: DALL-E 2, DALL-E 3, GPT-IMAGE series
- Requires OpenAI API key
- Supports various sizes depending on model
Gemini Imagen
- Google’s Imagen 3.0 model
- Two endpoint methods:
predictorgenerateContent - Requires Google API key
ComfyUI
- Local/self-hosted image generation
- Highly customizable workflows
- Supports custom models and nodes
- Configure workflow JSON and node mappings
Automatic1111 (Stable Diffusion WebUI)
- Popular Stable Diffusion interface
- Full control over generation parameters
- Supports negative prompts and custom steps
- Optional API authentication
Advanced Parameters
For Stable Diffusion-based engines (ComfyUI, Automatic1111):{
"prompt": "A futuristic city at night",
"negative_prompt": "blurry, low quality, distorted",
"size": "768x768",
"steps": 50,
"n": 2
}
Image Storage
Generated images are:- Automatically uploaded to the files system
- Associated with the user who generated them
- Accessible via the standard file content endpoint
- Linked to chat messages if
chat_idandmessage_idare provided in metadata
Permissions
Requires thefeatures.image_generation permission. Admin users have access by default.
Error Responses
400
Invalid parameters or generation failed
403
Image generation is disabled or user lacks permission
Related Endpoints
POST /api/images/edit- Edit existing images with promptsGET /api/images/models- List available models for current engineGET /api/images/config- Get image generation configuration (admin only)
⌘I