Skip to main content

OpenAI Async Image API

One endpoint for text-to-image and edit. The path is chosen from whether image is present.

Models

How It Works

1

Create a task

POST /openai/images:
  • No image → generate
  • With image → edit
  • With image + mask → inpaint
Returns { "taskId": "..." }.
2

Poll

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

Read the result

result follows response_format: default url (our S3). Set b64_json for base64. Only one field is returned.
image and mask must be http(s):// URLs. Base64 / data URL is rejected here — use Compat generate or Compat edit.

Quick Examples

Parameters

Size

Presets: auto 1024x1024 1536x1024 1024x1536 2048x2048 2048x1152 3840x2160 2160x3840 Custom WxH (e.g. 1280x960) must satisfy all:
  1. Each side ≤ 3840 px
  2. Width and height are multiples of 16
  3. Long : short ≤ 3:1
  4. Total pixels ∈ [655360, 8294400]
Invalid custom size, or a channel that does not support custom size, is rejected.

Task Status

Terminal results include elapsedMs.
Poll every 2–5 seconds. Typical 10–60 seconds depending on quality and size.

Endpoints

Sync official SDK? See OpenAI Compat.