Skip to main content
POST
Text to Image

Overview

Generate high-quality images from text prompts using OpenAI’s GPT Image 2 model. Supports multiple resolutions up to 4K, four quality tiers, and PNG / JPEG / WebP output — with up to 4 images per request.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
prompt
string
required

Text prompt to guide image generation.

Minimum string length: 1
quality
enum<string>
default:high

Image quality level.

Available options:
high,
medium,
low,
auto
size
enum<string>
default:auto

Output image resolution.

Available options:
1024x1024,
1536x1024,
1024x1536,
2048x2048,
2048x1152,
3840x2160,
2160x3840,
auto
n
integer
default:1

Number of images to generate.

Required range: 1 <= x <= 4
format
enum<string>
default:png

Output image format.

Available options:
png,
jpeg,
webp

Response

202 - application/json

Accepted - Task created successfully

task_info
object