/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.