DALL-E 3 and gpt-image-1 — OpenAI's Visual Layer
DALL-E 3 is legacy — it no longer appears in OpenAI's active API documentation. gpt-image-1 is the current production model, with gpt-image-2 as the latest. Understanding why DALL-E 3 was different (prompt rewriting, style parameter) explains the design choices that gpt-image-1 deliberately avoided.
OpenAI's current image generation API centers on the gpt-image line — gpt-image-1 is the established production model, and gpt-image-2 is the latest as of mid-2026. DALL-E 3, the predecessor, no longer appears in OpenAI's active API documentation. It is absent from the current image generation guide and model list.
This lesson covers the transition: what DALL-E 3 did differently (and why those behaviors mattered), how gpt-image-1 corrected the key pain points, and how the fallback chain uses gpt-image-1 today. Understanding DALL-E 3's design helps explain why gpt-image-1 was built the way it was — and why the two are not interchangeable even if both respond to the /v1/images endpoint.
Before You Start — Environment Setup
This is the first code-first lesson in the track, and everything from here through the production pipeline lesson assumes a working Python 3.10+ environment. Two minutes of setup:
# Install the packages used across the API lessons
pip install openai httpx
# Set your API key as an environment variable — never hard-code it
export OPENAI_API_KEY="<your-openai-api-key>"
Create the key at platform.openai.com under API keys. Each subsequent provider lesson adds its own key the same way (LEONARDO_API_KEY for Leonardo, GOOGLE_AI_KEY for Gemini) — always as environment variables read with os.getenv(), never as literals in code. If pip, virtual environments, or environment variables are unfamiliar, work through a Python basics primer before continuing — the code in these lessons assumes that fluency.
DALL-E 3 — The Prompt Rewriting Model (Legacy)
DALL-E 3 was released in late 2023 and integrated into ChatGPT as the default image generation path. It has since been superseded by the gpt-image line and no longer appears in OpenAI's active API documentation. Its defining behavior (documented here for historical understanding): it rewrites your prompt before generation.
The rewriting is not random. DALL-E 3 adds safety guardrails, expands ambiguous descriptions, adjusts phrasing to improve generation quality, and applies OpenAI's content policy interpretation. The resulting prompt is often significantly different from what you wrote.
The API response includes a revised_prompt field that shows you what the model actually used. In a pipeline context, this is valuable for debugging. In a quality control context, it is a signal that your output may not match your intent.
API Integration Pattern
import openai
client = openai.OpenAI()
response = client.images.generate(
model="dall-e-3",
prompt="A senior executive reviewing quarterly reports, cinematic, dramatic side lighting",
size="1792x1024",
quality="hd",
style="natural",
n=1,
)
image_url = response.data[0].url
revised = response.data[0].revised_prompt # What the model actually used
DALL-E 3 Parameters
size: 1024x1024, 1792x1024 (landscape), 1024x1792 (portrait). Only these three options.
quality: standard ($0.04/image) vs hd ($0.08/image). HD uses more compute passes for finer detail.
style: vivid produces saturated, dramatic imagery. natural produces more photorealistic, subdued output. For production content pipelines, natural is usually the correct default.
response_format: url (temporary URL, expires in 60 minutes) or b64_json (base64 encoded, no expiry). For pipelines, always use b64_json and store the image yourself — do not store the URL and assume it will resolve later.
Content Policy Traps
DALL-E 3 has the most aggressively enforced content policy in the API provider market. Prompts that involve real people (by name), violence, political content, or certain creative scenarios will return content policy errors (HTTP 400) rather than images.
For production pipelines: do not retry content policy errors with the same prompt. Redesign the prompt or route to a different provider. Retrying will not help.
gpt-image-1 — The Pipeline Model
gpt-image-1 is the newer model, released in 2025, and it behaves fundamentally differently from DALL-E 3. It does not rewrite prompts. It executes them as written. It also supports native image editing — sending a reference image with masked regions for targeted regeneration.
For production pipelines where you have invested time in prompt engineering and need the model to execute precisely, gpt-image-1 is the correct OpenAI choice.
API Integration Pattern
response = client.images.generate(
model="gpt-image-1",
prompt="A lone astronaut on a red Martian cliff, cinematic photography, golden hour backlighting, wide establishing shot, atmosphere of quiet solitude",
size="1536x1024",
quality="high",
n=1,
)
# gpt-image-1 always returns b64_json
import base64
image_data = base64.b64decode(response.data[0].b64_json)
gpt-image-1 Parameters
size: 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), auto (model chooses based on prompt).
quality: low, medium, high. Cost scales with quality tier. For production content, medium balances quality and cost effectively.
n: Number of images to generate. Unlike DALL-E 3 which is limited to n=1, gpt-image-1 supports multiple generations per request.
Image Editing — The Inpainting Endpoint
gpt-image-1 supports image editing via the /v1/images/edits endpoint. You provide the original image, a mask (PNG with transparent regions indicating where to modify), and a prompt describing the replacement content.
response = client.images.edit(
model="gpt-image-1",
image=open("original.png", "rb"),
mask=open("mask.png", "rb"),
prompt="Replace the background with a modern city skyline at dusk",
size="1024x1024",
)
This is the programmatic equivalent of Midjourney's Vary (Region) tool — and it is available in code, making it suitable for automated editing workflows.
Cost Structure and Volume Planning
At the volume typical for content pipelines (10–50 images per day), OpenAI image generation costs are manageable. At higher volumes (500+ images per day), the cost structure changes the math significantly.
A blog autopilot generating one hero image per article at $0.04 per image costs $1.20 per month if you publish daily. Acceptable.
A social media pipeline generating 20 images per day at $0.04 each costs $24 per month. Still manageable.
The same pipeline at $0.08 (HD quality) costs $48 per month. At that volume, Leonardo AI at roughly $0.02 per image with Alchemy enabled (about $0.008 without it) costs $12 per month or less. The fallback chain architecture makes sense not just for reliability but for cost optimization: keep expensive providers in fallback position, not primary.
Integrating Both into the Fallback Chain
In the production chain covered in the “Building a Production Image Pipeline” lesson, gpt-image-1 occupies fallback #2 — the position of reliable last resort. It fires when Gemini hits a rate limit and Leonardo fails.
The integration pattern:
- Catch HTTP 429 from Gemini → proceed to Leonardo
- Catch HTTP 4xx/5xx from Leonardo → proceed to gpt-image-1
- gpt-image-1 failure → return error with context, alert pipeline
Do not retry the same provider on a content policy rejection (400). Retry once on network failures (5xx). Proceed to fallback immediately on rate limit (429).
Lesson Drill
Build two image generation functions against the current OpenAI line: one wrapping gpt-image-1, one wrapping gpt-image-2. Send the same prompt to both, then compare prompt adherence — does the output reflect exactly what you wrote, with no silent rewriting? Next, exercise the /v1/images/edits endpoint: take one generated image, supply a mask with a transparent region and an edit prompt, and verify the background swaps cleanly. Run the same prompt five times on each model and document which produces more consistent output for your use case. (If DALL-E 3 is still reachable in your account, optionally send it the same prompt and log its revised_prompt to see the rewriting behavior this lesson described — but build your pipeline on the gpt-image line.)
Bottom Line
DALL-E 3 is legacy — it no longer appears in OpenAI's current API documentation. The production path is gpt-image-1 (established, widely supported) and gpt-image-2 (latest, verify the model ID at platform.openai.com/docs). gpt-image-1 executes prompts as written and supports native editing — use it for production pipelines where exact control matters. It lives in fallback position #2 in the chain. Neither gpt-image-1 nor gpt-image-2 is your primary provider when cost and rate limits are in the equation — Gemini Imagen handles that.