88API88API
User GuideAI ApplicationsAPI ReferenceHelp & Support
Image

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:

PurposeMethodEndpoint
Text-to-imagePOST/v1/images/generations
Image editingPOST/v1/images/edits

Models and capabilities

ModelResolutionReference imagesImages per requestBilling
gpt-image-21K (default) / 2K / 4K
size in pixels
up to 4 (local file)always 1per image
gpt-image-2.5-flare1K (default) / 2K / 4K
size in pixels
up to 10 (local file)always 1per image
gpt-image-2.5-sunburst1K (default) / 2K / 4K
size in pixels
up to 10 (local file)always 1per image
az-gpt-image-21K (default) / 2K / 4K
size in pixels
up to 10 (local file / data URI / public URL)up to 10per token
az-gpt-image-2.5-flare1K (default) / 2K / 4K
size in pixels
up to 10 (local file / data URI / public URL)up to 10per token
az-gpt-image-2.5-sunburst1K (default) / 2K / 4K
size in pixels
up to 10 (local file / data URI / public URL)up to 10per 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

Modelqualitybackgroundoutput_formatresponse_format
gpt-image-2low / medium / highNot supportedNot supportedb64_json / url
gpt-image-2.5-flarelow / medium / highNot supportedNot supportedb64_json / url
gpt-image-2.5-sunburstlow / medium / highNot supportedNot supportedb64_json / url
az-gpt-image-2low / medium / high / autotransparent / opaque / autopng / webp / jpegb64_json / url
az-gpt-image-2.5-flarelow / medium / high / xhigh / max / autotransparent / opaque / autopng / webp / jpegb64_json / url
az-gpt-image-2.5-sunburstlow / medium / high / xhigh / max / autotransparent / opaque / autopng / webp / jpegb64_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. Support size and quality, 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 transparent background, output_format, multiple images per request with n (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/json

Sizes

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:

Ratio1K2K4K
1:11024x10242048x20482880x2880
3:21536x10242400x16003504x2336
2:31024x15361600x24002336x3504
4:31152x8642048x15363264x2448
3:4864x11521536x20482448x3264
16:91280x7202560x14403840x2160
9:16720x12801440x25602160x3840
21:91344x5763024x12963840x1648
2:11408x7042880x14403840x1920
1:2704x14081440x28801920x3840

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

ParameterTypeRequiredDescription
modelstringyesImage model name, for example gpt-image-2.
promptstringyesDescription of the image. Be clear about the subject, composition, style, lighting and aspect ratio.
sizestringnoSize in pixels; see "Sizes" above for the rules.
qualitystringnogpt-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.
nintegernoNumber 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_formatstringnob64_json (default) or url. With url, an 88API image link is returned.
backgroundstringnoaz-gpt-image-* only: transparent, opaque, auto.
output_formatstringnoaz-gpt-image-* only: png (default), webp, jpeg.
output_compressionintegernoaz-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"
  }'
  • jpeg does not support transparency; combined with transparent, it returns an opaque image.
  • Passing transparent in an edit request removes the background; if the reference image is already transparent, the output keeps the transparency.
  • opaque does 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 than az-gpt-image-2 (high on 2.5 is roughly equal to medium on 2).
  • Failed requests are not charged.

Important limitations

  • Do not send requests for these models to /v1/responses or /v1/chat/completions.
  • mask inpainting 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_fidelity parameter 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 max level of az-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 ..., check size against the rules in "Sizes" above.
  • If you get This model does not support image generation. or image_model_wrong_endpoint, the request was sent to the wrong endpoint.