/v1/images/generations for production image generation.
202 response does not wait for image generation to finish, so continue
polling poll_url until the task reaches a terminal state. The periodic task
worker remains a recovery mechanism for pending tasks.
Prompt safety
Prompts that clearly combine a minor with exposure or emphasis of sensitive body areas, or with explicit sexual or nudity content, return HTTP400 with
code content_policy. Validation runs before task creation and credit
reservation, so no credits are charged. Revise the prompt to use an adult
subject (18+), remove sensitive-body close-ups, and keep the subject fully
clothed. Ordinary child-safe family, classroom, sports, and art scenes are not
blocked by this targeted rule.
GPT-Image 2 size and quality
Forgpt-image-2, send a native pixel size or auto:
auto or one of seven official popular sizes: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160, and 2160x3840. APIAny also accepts any positive integer WIDTHxHEIGHT as a target and maps it to the nearest popular size while preserving square, landscape, or portrait orientation. For example, 1280x720 maps to 1536x1024, 1920x1080 maps to 2048x1152, and 1440x2560 maps to 2160x3840.
quality accepts auto, low, medium, or high; the default is auto. n accepts 1–10 and credits are charged for each generated image. Ratio shorthand such as size: "4:3" can be combined with the compatibility resolution values "1K", "2K", or "4K"; APIAny first derives a target and then applies the same nearest-popular-size mapping. Legacy requests that only send aspect_ratio, resolution, or img_size remain accepted. New integrations should prefer auto or one of the seven official popular sizes for predictable output and billing.
Sync variant
/v1/images/generations/sync creates a task and waits up to the configured maximum wait time.
Use it for compatibility and demos. Use the async endpoint for production workloads.
Image edits
/v1/images/edits supports OpenAI-style image editing workflows where the selected model supports reference images.
GPT Image 2.5 tiers and supported controls
gpt-image-2.5 is a stable alias for Flare; use gpt-image-2.5-sunburst explicitly for precision-focused work. quality and resolution are independent: quality accepts auto, low, medium, high, xhigh, or max, while resolution accepts 1K, 2K, or 4K. A valid explicit pixel size is preserved and must match the selected resolution tier. Request fields must be supported by the selected model; unsupported fields are not silently dropped.
background, output_format, and output_compression only with models that support those controls.
GPT Image 2.6
gpt-image-2.6 supports PNG and animated GIF requests on the existing image endpoints; there is no separate GIF API. Each successful request costs 30 credits and returns one result. Confirm availability in GET /v1/models before calling.
Use output_format: "png" (default) or "gif", quality: "auto", resolution: "1K", and n: 1. size accepts auto, 1:1, 3:2, 2:3, 1024x1024, 1536x1024, or 1024x1536. At most one reference image is accepted. The same limits apply to aliases and model_params; conflicting values return HTTP 400.
SVG, JPEG, WebP, 2K/4K, masks, compression, frame_count and frame_duration_ms are not supported. GIF dimensions, frame count and timing are not configurable. background may be omitted; only auto is accepted. SVG requests return HTTP 400, not a PNG result.
PNG with synchronous waiting
GIF with one reference image
The edit endpoint accepts JSON with oneimage_urls entry or a multipart image file. Do not add a mask. The result format is selected with output_format; GIF editing still returns one animated file.
200 with data[0].url when complete, or HTTP 202 with task_id and poll_url while pending. Poll /v1/tasks/{task_id} until completed or failed; while pending or processing, keep the same task ID. Async generation uses /v1/images/generations and returns the completed file at result.data[0].url. Invalid or static GIF results fail and follow the normal failed-task credit refund policy.
Full parameters, asynchronous PNG/GIF examples and polling responses