Skip to main content
GPT Image 2 is OpenAI’s next-generation image generation model, available through the Starrise AI API. Built on an autoregressive + reasoning hybrid architecture, it supports native 2K resolution, near-perfect text rendering (~99% character-level accuracy across 12+ languages), and excellent multi-object scene composition.

Key Capabilities

  • Text-to-image — Generate images from natural language descriptions
  • Image editing — Edit existing images using text prompts via /v1/images/edits
  • Flexible resolution — Supports arbitrary custom dimensions up to 4K (3840px), sides must be multiples of 16
  • Precise text rendering — ~99% character-level accuracy across 12+ languages
  • Multi-object composition — Complex scenes without occlusion or misalignment
  • Multi-style — Photorealistic, illustration, anime, vector, 3D, data visualization
For both /v1/images/generations and /v1/images/edits, n supports 1–10, default 1. Requires selecting the Direct group in the console.

Output Specs

PropertyValues
SizeFlexible resolution (e.g., 1024x1024, 2048x2048, 3840x2160)
Size constraintsSides: multiples of 16; aspect ratio ≤ 3:1; total pixels 655,360–8,294,400
Qualitylow, medium, high
Output formatpng, jpeg
Input format (edit endpoint)png, jpeg

Quick Example

curl https://ai.alad.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A futuristic city skyline at sunset with flying cars in the sky",
    "size": "2048x2048",
    "quality": "high"
  }'

Parameters

ParameterTypeRequiredDescription
modelstringYesMust be gpt-image-2
promptstringYesImage description text
nintegerNoNumber of images to generate (1–10), default 1. Requires selecting the Direct group in the console.
sizestringNo{width}x{height} format; sides must be multiples of 16; aspect ratio ≤ 3:1; total pixels 655,360–8,294,400; max single side 3,840px. Default 1024x1024
qualitystringNolow, medium, high, default medium
output_formatstringNopng, jpeg, default png
moderationstringNoauto or low, default auto
output_compressionintegerNoCompression level for jpeg format (0–100)

Image Editing

Edit existing images via POST /v1/images/edits. Request body uses multipart/form-data; images are uploaded as files. Up to 16 input images per request (image[]).

Input Image Formats

Supported formats: PNG, JPEG. Images must be submitted via multipart/form-data file upload. Two available model IDs:
  • gpt-image-2 — Official model
  • gpt-image-2-c — Cost-effective version (supports response_format)
Note: When using gpt-image-2-c, selecting higher quality may affect stable output for n images. For stable multi-image generation, lower quality is recommended.
curl https://ai.alad.com/v1/images/edits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=@/path/to/source.jpeg" \
  -F model="gpt-image-2" \
  -F prompt="Replace the background with an ocean sunset" \
  -F n=1 \
  -F size="1024x1024"

Edit Endpoint Parameters

ParameterTypeRequiredDescription
imagefileYesSingle source image (PNG or JPEG, multipart upload)
image[]file arrayYes*Multiple source images, up to 16 (PNG or JPEG). Use instead of image for multiple images
maskfileNoMask image with Alpha channel, same format and dimensions as source (< 50MB). When using multiple images, the mask applies to the first image. Requires selecting the Direct group in the console.
modelstringYesgpt-image-2 or gpt-image-2-c
promptstringYesEdit instruction text
nintegerNoNumber of images to return (1–10), default 1. Requires selecting the Direct group in the console.
sizestringNo{width}x{height}, default 1024x1024
output_formatstringNopng, jpeg, default png
output_compressionintegerNoCompression level for jpeg format (0–100)
response_formatstringNourl. Only supported by gpt-image-2-c. Default url
image and image[] are mutually exclusive and cannot be used together.

Mask Editing

Provide a mask image with an Alpha channel to control which regions of the source image are edited. Pixels where Alpha is white (opaque) are preserved; pixels where Alpha is black (transparent) will be edited. Requirements:
  • Mask must contain an Alpha channel
  • Must match the source image in format and dimensions exactly
  • File size limit: < 50MB
Mask editing and the n parameter both require selecting the Direct group in the console.
cURL
curl https://ai.alad.com/v1/images/edits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F image=@/path/to/source.jpeg \
  -F mask=@/path/to/mask.png \
  -F model="gpt-image-2" \
  -F prompt="Replace the background with a futuristic cityscape" \
  -F n=1 \
  -F size="2048x2048"
If the mask is a black-and-white image without an Alpha channel, convert it first:
Python
from PIL import Image
import numpy as np

img = Image.open("bw_mask.png").convert("L")
alpha = np.array(img)
rgba = np.zeros((*alpha.shape, 4), dtype=np.uint8)
rgba[alpha > 0] = [255, 255, 255, 255]
Image.fromarray(rgba).save("mask.png")

Generation API Reference

Interactive Playground for POST /v1/images/generations.

Edit API Reference

Interactive Playground for POST /v1/images/edits.