Image Generation
Last updated:2026-08-12· 15 min read
🚀 Quick access
- ChatGPT Domestic:Open entry↗
- Mirror site:Open mirror↗
- Official ChatGPT:chatgpt.com ↗

Last updated: 2026-08-12
Overview
The OpenAI Images API generates, edits, or varies images programmatically—for e-commerce assets, game concept art, marketing banners, in-app creation tools, and more. Unlike “chat to get an image” in ChatGPT, the API uses Platform keys with separate billing and content policies. Available models (e.g. dall-e-3, gpt-image-1), size enums, quality tiers, and per-image pricing follow Images docs and pricing—don’t rely on outdated blog prices.
Three endpoint families
| Family | Input | Output | Typical use |
|---|---|---|---|
| Generations | Text prompt | New image | Text-to-image, concept design |
| Edits | Source image + prompt (+ mask) | Modified image | Background swap, local repaint |
| Variations | Reference image | Composition variants | Legacy models only—check docs |
ChatGPT image features and Images API billing are separate; product integrations should use Platform API.
Minimal text-to-image request
curl https://api.openai.com/v1/images/generations \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "Flat illustration, white background, blue geometric icon, no text or watermark",
"size": "1024x1024",
"n": 1
}'
from openai import OpenAI
client = OpenAI()
result = client.images.generate(
model="dall-e-3", # verify current ID on Models page
prompt="studio product photo, ceramic teapot, soft shadow, no text",
size="1024x1024",
quality="standard",
)
url = result.data[0].url
Responses often include temporary URLs or base64 (response_format: b64_json). Production must immediately persist to your object store (S3, OSS, GCS)—don’t rely on expiring CDN links.
Prompt structure (developer-oriented)
| Module | What to write | Effect |
|---|---|---|
| Subject | Objects, count, action | Locks content |
| Medium | Photo / 3D / vector / watercolor | Sets texture |
| Lighting | Soft, backlight, studio | Depth and mood |
| Composition | Close-up, top-down, negative space | UI crop fit |
| Negative constraints | No text, no watermark, solid background | Less retouching |
Iteration rhythm: low-res composition trials → lock prompt template → batch or raise quality.
Key parameters and cost
| Parameter | Impact | Advice |
|---|---|---|
size | Pixels and unit price | Thumbnails need not be max size |
quality | standard / hd, etc. | hd costs more—use for finals |
n | Images per request | Pair with pick-one UI |
style | e.g. vivid / natural | DALL·E era docs |
Image API often bills per image or pixel tier, not tokens. Estimate daily volume × resolution before launch: openai.com/api/pricing.
Latency: often seconds to tens of seconds; UI needs loading, timeout, and retry only on 5xx / 429.
Product integration checklist
- Async queue: high concurrency via job workers, not blocking HTTP
- Moderation: user prompts and generated images
- Quotas: per-user daily limits, resolution caps, retry caps
- Storage: originals + thumbnails + prompt metadata for reproducibility
- ToS disclosure: generated content license; ban deepfakes and unauthorized IP
- Key security: server-side only—see API Developer Guide
Boundary with Vision
| Direction | API |
|---|---|
| Text → new image | Images API (this guide) |
| Image → OCR / understanding / Q&A | Vision guide |
| Generate → QA → regenerate | Chain both |
Frequently asked questions
Returned URL broken or expired?
Temporary URLs expire; download immediately and upload to your CDN.
Long prompt but unstable composition?
Split into subject + style + camera layers; reduce conflicting adjectives; use Edits for local fixes.
Commercial images with brand logos?
Trademark and content policy risks—legal review before commercial use.
Is “draw me a picture” in Chat the same as Images API?
Product paths differ from Images endpoints; developers should use Images API or doc-recommended multimodal routes.
Portrait generation compliance?
Follow OpenAI usage policy and local law; add age gates and human review for sensitive cases.
Official resources
Next reading
Action path
Today: Generate one image via Playground or curl; try URL and base64 paths. Tomorrow: Script generate → download → upload to S3/OSS. This week: Add moderation and user quotas; benchmark latency and unit cost at three sizes.
Related
OpenAI Dev Overview
2026 OpenAI developer map: how ChatGPT web, Platform console, and APIs divide work—and the reading order from first call to production.
OpenAI Platform Overview
platform.openai.com console, doc navigation, Playground, usage billing, and org management—how developers find API information efficiently.
OpenAI API Quickstart
From Platform account and API key to your first OpenAI call: Responses/Completions examples, billing, rate limits, and a security checklist (2026 hands-on).
ChatGPT API Developer Guide
Production OpenAI API integration: architecture, auth, streaming, tool use, rate-limit retries, and a launch checklist.