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

# Image Generation

> AI image generation, editing, and variations

`ImageAgent()` works without `llm=`. It defaults to `gpt-image-2.5-flare` for `generate()` and `edit()`; `variation()` still defaults to `dall-e-2`, the only model with a variations endpoint. Pass `llm=` when you want a different image model (e.g. `openai/gpt-image-2.5-sunburst`).

## Generate Image

> [tab] Basic
>
> ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> from praisonaiagents import ImageAgent
>
> agent = ImageAgent()
> result = agent.generate("A sunset over mountains")
> print(result.data[0].b64_json[:40], "...")
> ```

> [tab] Advanced
>
> ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> from praisonaiagents import ImageAgent
>
> agent = ImageAgent(llm="openai/gpt-image-2.5-flare")
> result = agent.generate("A futuristic city", size="1536x1024", quality="high")
> print(result.data[0].b64_json[:40], "...")
> ```
>
> `quality` is sent for any model when set (GPT image: `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`, `"auto"`). `style` is forwarded only for the retired `dall-e-3`; `ImageAgent` drops it for other OpenAI models.

## Edit Image

> [tab] Basic
>
> ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> from praisonaiagents import ImageAgent
>
> agent = ImageAgent()  # defaults to gpt-image-2.5-flare
> result = agent.edit("photo.png", "Add a rainbow")
> result.save("edited.png")
> ```

> [tab] Advanced
>
> ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> from praisonaiagents import ImageAgent
>
> agent = ImageAgent(llm="openai/gpt-image-2.5-flare")
> result = agent.edit("photo.png", "Add sunset", mask="mask.png", size="1024x1024")
> result.save("edited.png")
> ```
>
> `markup=` is not supported — `edit()` raises `ValueError`. Use `mask=` or call the OpenAI SDK's `images.edit` directly. See [PR #6262](https://github.com/MervinPraison/PraisonAI/pull/6262).

## Image Variations

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import ImageAgent

# Defaults to dall-e-2 (only model with a variations endpoint); llm= shown for clarity
agent = ImageAgent(llm="openai/dall-e-2")
variations = agent.variation("original.png", n=3)
for img in variations.data:
    print(img.url)
```

## Models

| Model | Generate | Edit | Variation |
| - | - | - | - |
| `openai/gpt-image-2.5-flare` (default) | ✅ | ✅ | ❌ |
| `openai/gpt-image-2.5-sunburst` | ✅ | ✅ | ❌ |
| `openai/gpt-image-2.6-flare` | ✅ | ✅ | ❌ |
| `openai/gpt-image-2.6-sunburst` | ✅ | ✅ | ❌ |
| `openai/dall-e-2` | — | — | ✅ (variations only) |

`gpt-image-2.6-*` models are rolling out and may return `403 model_not_found` on some projects. OpenAI retired `dall-e-2`/`dall-e-3` on 2026-05-12 and `gpt-image-1` on 2026-10-23; `dall-e-2` is kept only for `variation()`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.