OpenAI Image Model API
Endpoints, sizes, quality levels, reference images and transparent backgrounds for the gpt-image-2, gpt-image-2.5 and az-gpt-image image model families.
Scope
This page covers the image endpoints for OpenAI image models (gpt-image-* and az-gpt-image-*). For Gemini image models, see Gemini Image Model API; for Grok image models, see Grok Image Model API.
Official Documentation
Choosing an endpoint
OpenAI image models use only the image endpoints. Do not use /v1/chat/completions or /v1/responses instead:
| Purpose | Method | Endpoint |
|---|---|---|
| Text-to-image | POST | /v1/images/generations |
| Image editing | POST | /v1/images/edits |
Models and capabilities
| Model | Resolution | Reference images | Images per request | Billing |
|---|---|---|---|---|
gpt-image-2 | 1K (default) / 2K / 4Ksize in pixels | up to 4 (local file) | always 1 | per image |
gpt-image-2.5-flare | 1K (default) / 2K / 4Ksize in pixels | up to 10 (local file) | always 1 | per image |
gpt-image-2.5-sunburst | 1K (default) / 2K / 4Ksize in pixels | up to 10 (local file) | always 1 | per image |
az-gpt-image-2 | 1K (default) / 2K / 4Ksize in pixels | up to 10 (local file / data URI / public URL) | up to 10 | per token |
az-gpt-image-2.5-flare | 1K (default) / 2K / 4Ksize in pixels | up to 10 (local file / data URI / public URL) | up to 10 | per token |
az-gpt-image-2.5-sunburst | 1K (default) / 2K / 4Ksize in pixels | up to 10 (local file / data URI / public URL) | up to 10 | per token |
Supported aspect ratios: 1:1 (default) / 3:2 / 2:3 / 4:3 / 3:4 / 16:9 / 9:16 / 21:9 / 2:1 / 1:2
| Model | quality | background | output_format | response_format |
|---|---|---|---|---|
gpt-image-2 | low / medium / high | Not supported | Not supported | b64_json / url |
gpt-image-2.5-flare | low / medium / high | Not supported | Not supported | b64_json / url |
gpt-image-2.5-sunburst | low / medium / high | Not supported | Not supported | b64_json / url |
az-gpt-image-2 | low / medium / high / auto | transparent / opaque / auto | png / webp / jpeg | b64_json / url |
az-gpt-image-2.5-flare | low / medium / high / xhigh / max / auto | transparent / opaque / auto | png / webp / jpeg | b64_json / url |
az-gpt-image-2.5-sunburst | low / medium / high / xhigh / max / auto | transparent / opaque / auto | png / webp / jpeg | b64_json / url |
Both model groups are called the same way; they differ in the parameters available and in how they are billed:
gpt-image-2,gpt-image-2.5-flare,gpt-image-2.5-sunburst: billed per image, with the same price regardless of size or quality level. Supportsizeandquality, and return 1 image per request.az-gpt-image-2,az-gpt-image-2.5-flare,az-gpt-image-2.5-sunburst: support the full set of OpenAI Images parameters, including transparentbackground,output_format, multiple images per request withn(up to 10), streaming previews, and JSON edit requests. Billed by tokens, so the cost varies with size and quality level.
The model list returned in the console is the authoritative list of available models.
Authentication
Every request must include your 88API access token:
Authorization: Bearer $API_KEY
Content-Type: application/jsonSizes
size must be given in pixels as WIDTHxHEIGHT; strings such as 1K, 2K or 4K are not accepted. A valid size must meet all of the following:
- Width and height are both multiples of 16;
- The longest side is at most 3840;
- The ratio of the long side to the short side is at most 3:1;
- The total pixel count is between 655,360 (about 816×816) and 8,294,400 (3840×2160).
The table below lists the recommended sizes for each level. They apply to all models:
| Ratio | 1K | 2K | 4K |
|---|---|---|---|
| 1:1 | 1024x1024 | 2048x2048 | 2880x2880 |
| 3:2 | 1536x1024 | 2400x1600 | 3504x2336 |
| 2:3 | 1024x1536 | 1600x2400 | 2336x3504 |
| 4:3 | 1152x864 | 2048x1536 | 3264x2448 |
| 3:4 | 864x1152 | 1536x2048 | 2448x3264 |
| 16:9 | 1280x720 | 2560x1440 | 3840x2160 |
| 9:16 | 720x1280 | 1440x2560 | 2160x3840 |
| 21:9 | 1344x576 | 3024x1296 | 3840x1648 |
| 2:1 | 1408x704 | 2880x1440 | 3840x1920 |
| 1:2 | 704x1408 | 1440x2880 | 1920x3840 |
If you omit size or pass auto, the model chooses the size itself. Sizes that do not follow the rules above may be rejected or adjusted automatically, so validate them before sending the request.
Text-to-image
Request
curl https://api.88api.ai/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "An orange cat sitting by a window, natural afternoon light, realistic photography style",
"size": "2048x2048",
"quality": "medium"
}'Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | Image model name, for example gpt-image-2. |
prompt | string | yes | Description of the image. Be clear about the subject, composition, style, lighting and aspect ratio. |
size | string | no | Size in pixels; see "Sizes" above for the rules. |
quality | string | no | gpt-image-* supports low, medium, high. az-gpt-image-2 supports low, medium, high, auto; az-gpt-image-2.5-* also supports xhigh and max. Defaults to low when omitted. |
n | integer | no | Number of images. az-gpt-image-* supports 1 to 10; gpt-image-* returns 1 image per request, so send several requests if you need more. |
response_format | string | no | b64_json (default) or url. With url, an 88API image link is returned. |
background | string | no | az-gpt-image-* only: transparent, opaque, auto. |
output_format | string | no | az-gpt-image-* only: png (default), webp, jpeg. |
output_compression | integer | no | az-gpt-image-* only, 0 to 100; applies to jpeg and webp only. |
Response example
{
"created": 1760000000,
"data": [
{
"b64_json": "iVBORw0KGgo..."
}
]
}By default the response contains data[].b64_json; if you set "response_format": "url" in the request, it contains data[].url instead.
Image editing
Image editing uses /v1/images/edits. To upload local images, use multipart/form-data and repeat image[] for each reference image. Up to 10 images are allowed (up to 4 for gpt-image-2), in PNG, JPEG or WebP format.
curl https://api.88api.ai/v1/images/edits \
-H "Authorization: Bearer $API_KEY" \
-F "model=gpt-image-2" \
-F "image[]=@person.png" \
-F "image[]=@product.png" \
-F "prompt=Have the person in the first image hold the product from the second image, keeping both the person and the product unchanged" \
-F "size=1536x1024"Reference images are numbered in upload order, so your prompt can refer to them as "the first image", "the second image" and so on.
JSON edit request (az-gpt-image-* only)
az-gpt-image-* also accepts edit requests in JSON format. Reference images can be Data URIs or public URLs:
curl https://api.88api.ai/v1/images/edits \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "az-gpt-image-2.5-flare",
"prompt": "Replace the background with a light blue photo studio",
"images": [
{ "image_url": "data:image/png;base64,..." },
{ "image_url": "https://example.com/reference.png" }
],
"size": "1024x1024"
}'For gpt-image-*, use multipart uploads.
Transparent background (az-gpt-image-* only)
For stickers, icons or cutouts that need a transparent background, set background to transparent and use png or webp output:
curl https://api.88api.ai/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "az-gpt-image-2",
"prompt": "A sticker of a panda holding a \"Go for it\" sign, with a clean outline",
"size": "1024x1024",
"background": "transparent",
"output_format": "png"
}'jpegdoes not support transparency; combined withtransparent, it returns an opaque image.- Passing
transparentin an edit request removes the background; if the reference image is already transparent, the output keeps the transparency. opaquedoes not fully guarantee an opaque result: if the prompt explicitly asks for a "sticker" or "no background", a transparent image may still be returned.
Streaming previews (az-gpt-image-* only)
Set "stream": true and "partial_images" to a value from 1 to 3. The endpoint then returns intermediate image_generation.partial_image previews over SSE, and the final image_generation.completed event carries the finished image and usage. For edit requests, the events are named image_edit.*.
Billing
gpt-image-*is billed by the number of images successfully returned, regardless of size or quality level.az-gpt-image-*is billed by tokens: text input, image input (reference images) and image output are priced separately. Output tokens depend only on size and quality level, and higher levels cost more. At the same level name,az-gpt-image-2.5-*uses fewer tokens thanaz-gpt-image-2(highon 2.5 is roughly equal tomediumon 2).- Failed requests are not charged.
Important limitations
- Do not send requests for these models to
/v1/responsesor/v1/chat/completions. maskinpainting is not supported: a mask you pass will not restrict edits to that region. To change part of an image, describe the location in your prompt.- The
input_fidelityparameter is not supported. - GIF reference images are not recommended; convert them to PNG first.
- High quality levels and 4K sizes can take 1 to 2 minutes, and the
maxlevel ofaz-gpt-image-2.5-*can take up to about 2.5 minutes. Set your client timeout to at least 5 minutes. - If you get
Invalid size ..., checksizeagainst the rules in "Sizes" above. - If you get
This model does not support image generation.orimage_model_wrong_endpoint, the request was sent to the wrong endpoint.
DeepSeek Web Search
Let DeepSeek V4.1 Flash search the web for real-time information and cite its sources, using the web_search tool of the Responses API.
Gemini Image Model API
Request formats for Gemini 3.1 Flash Image, Nano Banana 2.1 and Gemini 3 Pro Image over the OpenAI-compatible and Gemini native protocols, plus aspect ratios, resolutions and reference images.