> ## 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.

# OpenAI Images

> Generate and edit images with OpenAI's GPT image models

Generate and edit images with OpenAI's GPT image models — `gpt-image-2.5-flare` (the default) and `gpt-image-2.5-sunburst`. `gpt-image-2.6-flare` and `gpt-image-2.6-sunburst` are launching but may not be available on every project yet (`403 model_not_found`).

## Generate

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

agent = ImageAgent()  # defaults to gpt-image-2.5-flare
result = agent.generate("A sunset over mountains")
print(result.data[0].b64_json[:40], "...")
```

GPT image models always return the image as base64.

## With Options

```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 whenever you set it, for any model. GPT image accepts `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`, `"auto"`. Images 2.5/2.6 params such as `frame_count`, `frame_duration_ms`, `complexity`, and `output_format` pass through unchanged.

> [!NOTE]
>
> `style` is only supported by the retired `dall-e-3`. `ImageAgent` only sends `style` when you set it explicitly, and drops it automatically on GPT image models — put style cues in the prompt instead.

Reference: [PR #6262](https://github.com/MervinPraison/PraisonAI/pull/6262), fixes [#6259](https://github.com/MervinPraison/PraisonAI/issues/6259). Earlier: [PR #6077](https://github.com/MervinPraison/PraisonAI/pull/6077), [PR #6097](https://github.com/MervinPraison/PraisonAI/pull/6097).

## Edit

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

agent = ImageAgent()
result = agent.edit("photo.png", "Make the cup blue", mask="mask.png")
```

> [!WARNING]
>
> `ImageAgent.edit(..., markup=...)` raises `ValueError` — LiteLLM does not upload `markup` as a file, so it would be silently ignored. Use `mask=` instead, or call the OpenAI SDK's `images.edit` directly.

## Response Format

GPT image models always return base64 and reject `response_format`. Leave it unset — `ImageAgent` does not send its default `"url"`, so no extra configuration is needed.

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

agent = ImageAgent()
agent.generate("A red circle icon").save("circle.png")
```

## Models

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph TB
    Start[📝 Image task] --> Q1{Need<br/>variations?}
    Q1 -->|Yes| D2[openai/dall-e-2]
    Q1 -->|No| Q2{Generate or edit}
    Q2 --> GPT[openai/gpt-image-2.5-flare<br/>or -sunburst]

    classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
    classDef decision fill:#F59E0B,stroke:#7C90A0,color:#fff
    classDef model fill:#10B981,stroke:#7C90A0,color:#fff

    class Start input
    class Q1,Q2 decision
    class D2,GPT model
```

| Model | Generate | Edit | Variation |
| - | - | - | - |
| `openai/gpt-image-2.5-flare` (default) | ✅ | ✅ (`mask=`, not `markup=`) | ❌ |
| `openai/gpt-image-2.5-sunburst` | ✅ | ✅ (`mask=`, not `markup=`) | ❌ |
| `openai/gpt-image-2.6-flare` / `-sunburst` | ✅ (rolling out) | ✅ (rolling out) | ❌ |
| `openai/dall-e-2` | — | — | ✅ (only variations endpoint) |

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.