Skip to content

Image Generation

Last updated:2026-08-12· 15 min read

🚀 Quick access

  • ChatGPT Domestic:Open entry↗
  • Mirror site:Open mirror↗
  • Official ChatGPT:chatgpt.com ↗

Image Generation

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

FamilyInputOutputTypical use
GenerationsText promptNew imageText-to-image, concept design
EditsSource image + prompt (+ mask)Modified imageBackground swap, local repaint
VariationsReference imageComposition variantsLegacy 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)

ModuleWhat to writeEffect
SubjectObjects, count, actionLocks content
MediumPhoto / 3D / vector / watercolorSets texture
LightingSoft, backlight, studioDepth and mood
CompositionClose-up, top-down, negative spaceUI crop fit
Negative constraintsNo text, no watermark, solid backgroundLess retouching

Iteration rhythm: low-res composition trials → lock prompt template → batch or raise quality.

Key parameters and cost

ParameterImpactAdvice
sizePixels and unit priceThumbnails need not be max size
qualitystandard / hd, etc.hd costs more—use for finals
nImages per requestPair with pick-one UI
stylee.g. vivid / naturalDALL·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

DirectionAPI
Text → new imageImages API (this guide)
Image → OCR / understanding / Q&AVision guide
Generate → QA → regenerateChain 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