Image Generation

Generate AI images from text prompts with support for references, templates, and chaining.

Basic Generation

Generate an image by sending a text prompt to the generations endpoint:

Create Generation
curl -X POST https://api.banatie.app/api/v1/generations \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "prompt": "a serene mountain landscape at sunset",
    "aspectRatio": "16:9"
  }'

The response contains your generated image immediately:

201 Created
{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "status": "success",
    "prompt": "a serene mountain landscape at sunset",
    "aspectRatio": "16:9",
    "outputImage": {
      "id": "8a3b2c1d-4e5f-6789-abcd-ef0123456789",
      "storageUrl": "https://cdn.banatie.app/my-org/my-project/img/8a3b2c1d-4e5f-6789-abcd-ef0123456789",
      "width": 1792,
      "height": 1008
    },
    "flowId": "770e8400-e29b-41d4-a716-446655440002"
  }
}

One request, one result. The storageUrl is your production-ready image, served via CDN.

Aspect Ratios

Choose the aspect ratio that fits your use case:

Ratio
Dimensions
Best For
1:11024 x 1024Social media posts, profile pictures, thumbnails
16:91792 x 1008Blog headers, presentations, video thumbnails
9:161008 x 1792Stories, mobile backgrounds, vertical banners
3:21536 x 1024Photography-style images, print layouts
21:92016 x 864Ultra-wide banners, cinematic headers

Default is 16:9 if not specified.

Prompt Templates

Templates improve your prompt for specific styles. Available templates:

Template
Description
generalBalanced style for most use cases
photorealisticPhoto-like realism with natural lighting
illustrationArtistic illustration style
minimalistClean, simple compositions
stickerSticker-style with clear edges
productE-commerce product photography
comicComic book visual style
Template selection coming soon. Currently uses general style for all generations.

Using Reference Images

Add reference images for style guidance or context. Pass image IDs or aliases in the referenceImages array:

With References
curl -X POST https://api.banatie.app/api/v1/generations \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "prompt": "product photo in this style",
    "referenceImages": ["@brand-style", "@product-template"],
    "aspectRatio": "1:1"
  }'
Pro Tip: Use aliases like @logo instead of UUIDs. See Working with Images to learn about aliases.

You can also mention aliases directly in your prompt text — they're auto-detected:

Auto-detected aliases
{
  "prompt": "create a banner using @brand-colors and @logo style"
}

Continuing Generation

Chain multiple generations together by passing the same flowId:

Continue in Flow
curl -X POST https://api.banatie.app/api/v1/generations \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "prompt": "same scene but at night",
    "flowId": "770e8400-e29b-41d4-a716-446655440002"
  }'

Each response includes a flowId you can use to continue the sequence. Flows help organize related generations together.

Regeneration

Want a different result with the same parameters? Regenerate an existing generation:

Regenerate
curl -X POST https://api.banatie.app/api/v1/generations/550e8400-e29b-41d4-a716-446655440000/regenerate \
  -H "X-API-Key: YOUR_API_KEY"

Same prompt, new image. The generation ID and URL stay the same — the image content is replaced.

Next Steps