Skip to main content

OpenAI Async Image API

A single unified endpoint for both text-to-image generation and image editing. The operation type is auto-detected based on whether you provide an image field in the request body.

Supported Model

How It Works

1

Create a task

Call POST /openai/images with your prompt. The endpoint auto-detects the operation:
  • No image field → text-to-image generation
  • With image field → image editing
  • With image + mask → inpainting (transparent mask areas are repainted)
Returns { "taskId": "..." }.
2

Poll for results

Call GET /openai/tasks?taskId=<taskId> until status is completed or failed.
3

Use the result

The task result field contains the generated image (base64 encoded by default for gpt-image-2).

Quick Examples

Parameters

Task Status

Poll every 2-5 seconds. Tasks typically complete in 10-60 seconds depending on quality and size.

Available Endpoints


Explore the API Documentation

Looking for the synchronous OpenAI-compatible API? See OpenAI Compat to use the official openai SDK.