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 animage 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
imagefield → text-to-image generation - With
imagefield → image editing - With
image+mask→ inpainting (transparent mask areas are repainted)
{ "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
Available Endpoints
Explore the API Documentation
- Create Image Task — Async generate / edit / inpaint
- Get Task Result — Poll task status and get results
Looking for the synchronous OpenAI-compatible API? See OpenAI Compat to use the official
openai SDK.