Skip to main content
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

Authorization
string
required
Bearer token for authentication

Body

prompt
string
required
Text description of the image to generate
model
string
Model to use for generation. Defaults to configured model.OpenAI models:
  • dall-e-2
  • dall-e-3
  • gpt-image-1
  • gpt-image-1.5
Gemini models:
  • imagen-3.0-generate-002
size
string
Image dimensions in format WIDTHxHEIGHT (e.g., 512x512, 1024x1024)Can also be auto for models that support dynamic sizing.
n
number
default:"1"
Number of images to generate
steps
number
Number of inference steps (for Stable Diffusion-based engines)
negative_prompt
string
Negative prompt describing what to avoid in the image (for Stable Diffusion-based engines)

Response

Returns an array of generated image objects.
url
string
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: predict or generateContent
  • 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:
  1. Automatically uploaded to the files system
  2. Associated with the user who generated them
  3. Accessible via the standard file content endpoint
  4. Linked to chat messages if chat_id and message_id are provided in metadata

Permissions

Requires the features.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
  • POST /api/images/edit - Edit existing images with prompts
  • GET /api/images/models - List available models for current engine
  • GET /api/images/config - Get image generation configuration (admin only)