Generate image with GPT-Image-2
OpenAI GPT-Image-2 — next-generation image model with significantly improved text rendering. Text-to-image and image editing with up to 9 reference images, 1K/2K/4K output, and three quality levels. Billing: per image, resolution × quality — medium quality bills 60/120/180 credits at 1K/2K/4K, low bills half that (30/60/90), high bills 250/500/750.
Asynchronous. Returns a job id (the image is not in this response). Poll GET /v1/images/{id} until status is succeeded — the generated image URLs are in that response’s images array (each { url, position }).
Authorizations
API key as a bearer token: Authorization: Bearer bpx_live_xxx
Body
Text description of the image to generate.
Output aspect ratio.
1:1, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 3:2, 2:3, 21:9, 9:21, 2:1, 1:2 Number of images to generate.
1 <= x <= 4Output image format.
png, jpeg Rendering quality. Multiplies the resolution price: low = 0.5x, medium = 1x, high ≈ 4.17x (e.g. at 1K: low 30, medium 60, high 250 credits).
low, medium, high Optional reference images (up to 9) for image editing and composition. Each item is a public image URL, a data URI, raw base64, or an uploaded-file URL from POST /v1/uploads. Omit for text-to-image.
9Output resolution tier. Bills 60/120/180 credits per image (medium quality) at 1K/2K/4K.
1K, 2K, 4K