v1

latestOpenAPI 3.1.02026-07-224941145.6 KB

Generate Images

Generate images from text prompts using gpt-image-2-c, the cost-effective variant of GPT Image 2. Supports response_format. Does not support the n parameter (one image per request).

post/v1/images/generations

Request body

model'gpt-image-2-c' required

Model ID.

promptstring required

Text description of the desired image.

sizestring

Output image size in {width}x{height} format. Supports flexible resolutions — both edges must be multiples of 16, aspect ratio ≤ 3:1, total pixels between 655,360 and 8,294,400, max edge 3,840px.

quality'low' | 'medium' | 'high'

Image quality.

output_format'png' | 'jpeg'

Output image format.

moderation'auto' | 'low'

Content moderation level.

output_compressioninteger

Compression level for jpeg format (0-100%).

response_format'url' | 'b64_json'

Response format. Either url or b64_json.

Example request

{
  "model": "gpt-image-2-c",
  "prompt": "A futuristic city skyline at sunset with flying cars",
  "size": "1024x1024",
  "quality": "high",
  "output_format": "png",
  "moderation": "auto",
  "output_compression": 80,
  "response_format": "url"
}

Response

Images generated successfully.