> ## Documentation Index
> Fetch the complete documentation index at: https://docs.easy-peasy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Image

> Programmatically generate [AI Images](https://easy-peasy.ai/ai-images) using 40+ models including DALL-E 3, Midjourney, FLUX.2, Imagen 4, Stable Diffusion, Seedream, and more.

## Text-to-image vs. editing with a reference image

* **Text-to-image** — Provide `prompt` + `model`. The `model` picks the generator (e.g. `DALL-E 3`, `Seedream 4.5`).
* **Editing / reference image** — Provide `prompt` + `image` (or `images`). The request switches to image-to-image mode and the image is processed by **`editModel`**, **not** `model`. The `model` field is ignored once an image is supplied.

<Note>
  The two model lists are different. When you send an `image`, choose the model with **`editModel`** (default `Nano Banana 2`). Setting `model` alongside an `image` has no effect on which model edits the image.
</Note>

The reference image does not need to be hosted on Easy-Peasy, but it **must be downloadable server-side** — some hosts (e.g. Wikimedia, or sites that block hotlinking / non-browser requests) return **HTTP 403** to automated fetches and will fail. If in doubt, host it on your own public CDN/bucket. Write the `prompt` as an instruction about the image (e.g. "change the color to yellow", "place this product on a marble counter").

### One reference image

```bash theme={null}
curl -X POST https://easy-peasy.ai/api/generate-image \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Place this product on a marble kitchen counter with soft morning light",
    "image": "https://yourcdn.com/product.png",
    "editModel": "Nano Banana 2",
    "dimensions": "1:1"
  }'
```

### Multiple reference images

Pass `images` as a **JSON-encoded string array** (not a JSON array):

```bash theme={null}
curl -X POST https://easy-peasy.ai/api/generate-image \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Put the person from the first image into the room in the second image",
    "images": "[\"https://yourcdn.com/person.png\", \"https://yourcdn.com/room.png\"]",
    "editModel": "Nano Banana 2",
    "dimensions": "1:1"
  }'
```

## Model naming notes

* **GPT Image 2** is exposed as three quality tiers — use the exact strings `OpenAI GPT Image 2 Low`, `OpenAI GPT Image 2 Medium`, or `OpenAI GPT Image 2 High`. There is no bare `"GPT Image 2"` value.
* **Reve** is `REVE` for text-to-image (`model`), and `Reve` / `Reve Fast` for editing (`editModel`). There is no `"Reve 2.0"`.
* Model names are matched **exactly** — always send a value as listed in the schema enums below. An unrecognized `editModel` returns a `400` error; an unrecognized `model` may fall back to a default generator, so a typo can silently produce the wrong model.

<Note>
  When authenticated with an API key, image generation is **synchronous** — the finished image comes back in the response, so you don't need to poll.
</Note>


## OpenAPI

````yaml POST /api/generate-image
openapi: 3.0.1
info:
  title: Easy-Peasy.AI API
  description: >-
    OpenAPI Specifications for the Easy-Peasy.AI API.


    All API requests must be authenticated with an API key. Include the
    `x-api-key` API key in the request header with all requests. You can get the
    API key [here](https://easy-peasy.ai/settings/api).
  version: 1.0.4
servers:
  - url: https://easy-peasy.ai
security:
  - apiKeyAuth: []
paths:
  /api/generate-image:
    post:
      summary: Generate Image
      description: >-
        Programmatically generate [AI Images](https://easy-peasy.ai/ai-images)
        using 40+ models including DALL-E 3, Midjourney, FLUX.2, Imagen 4,
        Stable Diffusion, Seedream, and more.
      operationId: generateImage
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: Your API key
          example: 27feb2bb-aeb4-4a83-9fb6-8f3f2a15885e
      requestBody:
        description: The prompt and model to generate the image
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationRequest'
      responses:
        '200':
          description: Successful image generation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResponse'
        '400':
          description: Bad request - missing required fields or invalid values
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Invalid input
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Server error
components:
  schemas:
    ImageGenerationRequest:
      type: object
      required:
        - prompt
        - model
      properties:
        prompt:
          type: string
          description: The textual description of the image to be generated
          example: neon cat
        model:
          type: string
          description: The model to use for image generation
          enum:
            - DALL-E 3
            - OpenAI GPT Image 1
            - OpenAI GPT Image 1.5
            - OpenAI GPT Image 2 Low
            - OpenAI GPT Image 2 Medium
            - OpenAI GPT Image 2 High
            - Midjourney V6
            - Midjourney V7
            - FLUX.1
            - FLUX 1.1 Pro
            - FLUX 1.1 Pro Ultra
            - FLUX.2 [dev]
            - FLUX.2 [flex]
            - FLUX.2 [pro]
            - FLUX.2 [max]
            - Flux Kontext Pro
            - Flux Kontext Max
            - Flux.1 Krea
            - Stable Diffusion XL
            - Stable Diffusion 3.0
            - Stable Diffusion 3.5
            - Imagen 3
            - Imagen 4
            - Imagen 4 Ultra
            - Imagen 4 Fast
            - Seedream 3.0
            - Seedream 4.0
            - Seedream 4.5
            - Seedream 5.0 Lite
            - Recraft v3
            - Recraft v4.1
            - Recraft v4.1 Pro
            - Recraft v4.1 Vector
            - Recraft v4.1 Pro Vector
            - REVE
            - ImagineArt 1.5
            - Mai Image 2.5
            - HiDream
            - HunyuanImage 3.0
            - Bria 3.2
            - Dreamina 3.1
            - Qwen-Image
            - Grok
            - Grok Pro
            - Ideogram v3
            - Ideogram v4
            - MiniMax Image 01
            - Kandinsky 3.0
            - Kandinsky 2.2
            - Kandinsky 2
            - WAN 2.2
            - WAN 2.5 Preview
            - Nano Banana
            - Nano Banana 2
            - Nano Banana Pro
            - Nano Banana Flash
            - Z-Image Turbo
          example: DALL-E 3
        style:
          type: string
          description: >-
            Style for the image (e.g. Cyberpunk, Watercolor). Not all models
            support this parameter.
          example: Cyberpunk
        artist:
          type: string
          description: >-
            Artist style to emulate (e.g. Van Gogh). Not all models support this
            parameter.
          example: Van Gogh
        dimensions:
          type: string
          description: >-
            Dimensions of the generated image. Accepted values vary by model:


            - **DALL-E 3**: `1024x1024`, `1792x1024`, `1024x1792`

            - **OpenAI GPT Image 1/1.5**: `1024x1024`, `1536x1024`, `1024x1536`

            - **Midjourney V6/V7, FLUX.1, FLUX 1.1 Pro/Ultra**: `1:1`, `2:3`,
            `3:2`, `4:5`, `5:4`, `16:9`, `9:16`

            - **FLUX.2 [dev/flex/pro/max]**: `1:1`, `2:3`, `3:2`, `4:5`, `5:4`,
            `16:9`, `9:16`

            - **Flux Kontext Pro/Max, Stable Diffusion 3.0/3.5**: `1:1`, `21:9`,
            `16:9`, `4:3`, `3:2`, `2:3`, `3:4`, `9:16`, `9:21`

            - **Imagen 3/4/4 Ultra/4 Fast, Seedream, HiDream, Dreamina,
            HunyuanImage, MiniMax, WAN, ImagineArt, Ideogram v3, Qwen-Image**:
            `1:1`, `3:4`, `4:3`, `9:16`, `16:9`

            - **Grok/Grok Pro**: `1:1`, `3:4`, `4:3`, `9:16`, `16:9`, `2:3`,
            `3:2`, `1:2`, `2:1`

            - **Recraft v3**: `1024x1024`, `1365x1024`, `1024x1365`,
            `1536x1024`, `1024x1536`, `1820x1024`, `1024x1820`, `2048x1024`,
            `1024x2048`

            - **Nano Banana/Pro/Flash**: `1:1`, `2:3`, `3:2`, `3:4`, `4:3`,
            `4:5`, `5:4`, `9:16`, `16:9`, `21:9`

            - **Nano Banana 2**: same as above plus `1:4`, `4:1`, `1:8`, `8:1`

            - **REVE**: `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `9:16`, `16:9`

            - **Bria 3.2**: `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`,
            `9:16`, `16:9`

            - **Z-Image Turbo**: `1:1`, `4:3`, `3:4`, `16:9`, `9:16`

            - **Stable Diffusion XL**: `1024x1024`, `2048x1536`, `1536x2048`
          example: 1024x1024
        useHD:
          type: boolean
          description: Use HD quality. Supported by select models.
          default: false
          example: false
        image:
          type: string
          format: uri
          description: >-
            Reference/input image URL for image editing. When provided with a
            prompt, the request switches to image-to-image mode and the image is
            edited/transformed by the model named in `editModel` (NOT `model`,
            which only applies to text-to-image). Any publicly reachable URL is
            accepted. Defaults to `editModel: "Nano Banana 2"`. For multiple
            reference images use `images` instead.
        images:
          type: string
          description: >-
            JSON-encoded array of reference image URLs, for edit models that
            accept several inputs (e.g. combine subjects/scenes). Example:
            `"[\"https://.../a.png\", \"https://.../b.png\"]"`. When set, takes
            precedence over `image`.
          example: >-
            ["https://media.easy-peasy.ai/a.png",
            "https://media.easy-peasy.ai/b.png"]
        action:
          type: string
          description: >-
            Action to perform on the image. If not specified when `image` is
            provided, defaults to `Edit Image with AI` (which then uses
            `editModel`). "Character Reference" / "Style Reference" generate new
            scenes that keep a subject/style rather than editing the source
            image.
          enum:
            - Edit Image with AI
            - Remove Background
            - Replace Background
            - Colorize
            - Relight
            - Stylization
            - Realistic Photos
            - Hyper Realistic Photos
            - Sketch to Image
            - Ghiblify
            - Caricature
            - Muppets
            - Halloween
            - Professional Headshot
            - Character Reference
            - Consistent Character
            - Style Reference
            - Style Reference SD3
            - Find and Replace
            - Visualize What Happens Next
        editModel:
          type: string
          description: >-
            Model to use for image editing (only used with `action: "Edit Image
            with AI"`, which is the default when `image`/`images` is provided).
            Defaults to `Nano Banana 2`.
          enum:
            - Nano Banana 2
            - Nano Banana Pro
            - Grok
            - Grok Pro
            - OpenAI GPT Image 1.5
            - OpenAI GPT Image 2 Low
            - OpenAI GPT Image 2 Medium
            - OpenAI GPT Image 2 High
            - Seedream 4.5
            - Seedream 5.0 Lite
            - FLUX.2 [max]
            - FLUX.2 [pro]
            - FLUX.2 [flex]
            - Seedream 4.0
            - Nano Banana
            - Qwen Image
            - Reve
            - Reve Fast
            - Mai Image 2.5
            - Flux Kontext Pro
            - Flux Kontext Max
            - OpenAI GPT Image 1
            - Ideogram v3 Character
          default: Nano Banana 2
        outputs:
          type: integer
          description: Number of images to generate.
          default: 1
          example: 1
        resolution:
          type: string
          description: >-
            Resolution quality level. Supported by FLUX.2, Nano Banana, and
            other select models.
          enum:
            - 1K
            - 2K
          example: 1K
        recraftStyle:
          type: string
          description: Style preset for Recraft v3 model.
          default: any
          example: any
        waitForResult:
          type: boolean
          description: >-
            Wait for the image to be fully generated before returning the
            response. If false, returns immediately with a pending status.
          default: false
          example: false
    ImageGenerationResponse:
      type: array
      items:
        type: object
        properties:
          id:
            type: integer
            description: Unique identifier for the generated image
            example: 545135
          image_url:
            type: string
            description: URL of the generated image
            example: >-
              https://fdczvxmwwjwpwbeeqcth.supabase.co/storage/v1/object/public/images/27feb2bb-aeb4-4a83-9fb6-8f3f2a15885e/138c3903-2355-4489-8ccf-b4bdade6289a.png
          model:
            type: string
            description: The model used for the image generation
            example: DALL-E 3
          used_credits:
            type: integer
            description: The number of credits used for the generation
            example: 2
          prompt:
            type: string
            description: The prompt used for image generation
            example: neon cat
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid API key
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get yours at
        https://easy-peasy.ai/settings/api

````