GPT-Image · Image

Text to Image

Generate an image from text.

💡 When to use:Use for GPT-Image style results.

This page uses the unified API: generate with POST /v1/images/generations (synchronous by default: it returns once the image is ready; add "async": true to get a task back immediately and poll GET /v1/images/generations/{id}), authenticate with Authorization: Bearer <key>; errors use the OpenAI format. General notes are in the Images guide. Images guide
Generate image
POST/ v1/ images/ generations
Query Result
GET/ v1/ images/ generations/ {id}
⏱ Recommended polling interval:Requests on this page must carry "async": true (or the Prefer: respond-async header): the call answers 202 with the task object right away (status: queued, Retry-After: 3); poll GET /v1/images/generations/{id} until status is completed or failed. A gpt-image request without async goes to the synchronous OpenAI Images route; see "Synchronous call".

Authorization

AuthorizationstringheaderRequired
API key, sent as a Bearer token in the Authorization header.

Request body

application/json
modelstringRequired
gpt-image-1 / gpt-image-1.5 / gpt-image-2 / gpt-image-2.5-flare / gpt-image-2.5-sunburst
promptstringRequired
Image description (1–4000 chars)
sizestring
Prefer official pixel sizes (default 1024x1024). Square 1024x1024 / 2048x2048(2K); landscape 1536x1024 / 1792x1024 / 1920x1080 / 2048x1152(2K) / 3840x2160(4K); portrait 1024x1536 / 1024x1792 / 1080x1920 / 2160x3840(4K). Ratio aliases 1:1 / 2:3 / 3:2 / 16:9 / 9:16 are legacy-only (not recommended); invalid/missing falls back to 1024x1024
qualitystring
`low` / `medium` / `high` / `auto`, passed to the GPT-Image channel as is.
asyncbooleanRequired
Must be `true` on this page (or the `Prefer: respond-async` header): answer 202 with the task object right away, then poll with GET. A gpt-image request without `async` goes to the synchronous OpenAI Images route.

model, prompt, n, size, aspect_ratio, resolution, images, output_format, negative_prompt, prompt_extend and async are the common fields; the server converts them to the channel fields. Other fields in the table are native to the channel: put them in the same body under their own names and they are passed through, and a native field wins over its unified synonym. images takes http(s) image URLs only (no base64). response_format can only be url.

Response fields

idstring
Task ID, starts with img_; used for polling.
objectstring
Always image.generation.
modelstring
The model from the request.
statusstring
queued, in_progress, completed or failed. A synchronous 200 is always completed.
createdinteger
Creation time (Unix seconds), as in OpenAI Images.
completed_atinteger | null
Completion time; null until completed.
errorobject | null
On failure {code, message}, with code image_generation_failed.
dataarray
When completed, [{ "url": "https://..." }], one element per image (several when n is above 1, or for the 4 Midjourney images); an empty array until then.