Claude Opus 5.5 is live on SeedRouter

GPT Image 2 API parameters: size, resolution, aspect ratio and quality

The GPT Image 2 API parameters that shape the image: model name, size and resolution, aspect ratios, 4K limits, quality, formats and the errors they return.

Read as Markdown

The GPT Image 2 API takes the model name in model, the output dimensions in size as WIDTHxHEIGHT pixels, and the quality in quality (low, medium, high or auto). There is no resolution or aspect_ratio field. To get a 16:9 image at 4K you send "size": "3840x2160". Sizes must use multiples of 16, keep both edges at or under 3840 pixels, stay between 1:3 and 3:1, and fall between 655,360 and 8,294,400 pixels.

This guide covers each parameter that changes the picture, with the exact value to send and the error a wrong value returns. Every error below was checked against the live API.

What is the GPT Image 2 model name in the API?

Use gpt-image-2 or gpt-image-2-official. Both are the same model with the same fields; gpt-image-2 charges one flat price per delivered image, and gpt-image-2-official bills the tokens each render reports.

Names from headlines do not work as model IDs. gpt-image-2.0, GPT Image 2 or chatgpt-images-2 all return HTTP 400 with error code 20002.

How do you set the resolution and aspect ratio?

With size, in pixels. Pick the aspect ratio and the pixel budget you want, then send the resulting width and height:

Aspect ratioAbout 1KAbout 2K4K
1:11024x10242048x20482880x2880
3:21248x8322496x16643504x2336
2:3832x12481664x24962336x3504
4:31152x8642304x17283264x2448
3:4864x11521728x23042448x3264
16:91280x7202560x14403840x2160
9:16720x12801440x25602160x3840
21:91456x6243024x12963808x1632
3:11728x5763504x11683840x1280

These are the same conversions the Playground uses when you choose a ratio and a 1K, 2K or 4K preset. Square 4K stops at 2880x2880 because a 3840-pixel square would exceed the total pixel limit.

size: "auto" leaves the dimensions to the model. It is the default, and convenient, but set an explicit size when outputs need to match a layout or each other.

OpenAI describes output above 2560×1440 as experimental. It is accepted within the limits here, but a larger canvas is not a promise of more detail.

Which size values are rejected?

Value sentWhy it failsResponse
"size": "16:9"Ratios are not sizes400 20001, message names size
"size": "4096x2304"Edge above 3840400 20001, message names size
"size": "1000x1000"Not a multiple of 16400 20001, message names size
"size": "3840x1024"Wider than 3:1400 20001, message names size
"resolution": "4k"Unknown field400 20001, no field named
"aspect_ratio": "16:9"Unknown field400 20001, no field named

Note the last two rows. An unknown field is rejected, but the error does not name it. If you get 20001 with the general message "Check the parameters against the API documentation", look for a field the API does not accept, such as resolution, aspect_ratio or response_format.

Which quality should you choose?

quality accepts low, medium, high and auto. Higher steps take longer and hold finer detail. xhigh and max belong to GPT Image 2.5 only; sending them to GPT Image 2 returns 20001 with a message that names quality.

A practical routine: draft at low while the composition is still changing, check texture and small text at medium, and produce finals at high. On gpt-image-2 the price is the same at every step. On gpt-image-2-official higher steps report more output tokens, so they cost more. The pricing guide shows the numbers.

auto lets the model choose the step. Set an explicit value when you compare runs, or two "identical" requests may render at different steps.

What controls format and background?

  • output_format: png (default) or jpeg. WebP output is not offered; webp returns 20001 with a message that names output_format.
  • output_compression: 0 to 100, only with jpeg.
  • background: auto, opaque or transparent. Transparency needs png; transparent with jpeg returns 20001 with a message that names background.
  • n: 1 to 10 images per request. You are billed for the images delivered.
  • moderation: auto or low.

How are reference images and masks passed?

As URLs, never as files or base64. images takes 1 to 16 objects shaped {"image_url": "https://..."}, and sending it turns the request into an edit. mask takes one object of the same shape: a PNG the size of the first reference image, where the transparent area marks what to change. The reference lists the file limits.

Frequently asked questions

Does GPT Image 2 support 4K?

Yes, within the limits above. 3840x2160 for 16:9 and 2160x3840 for 9:16 are the largest frames, and 2880x2880 is the largest square.

Can I send an aspect ratio instead of pixels?

Not to the API. Convert the ratio to a WIDTHxHEIGHT size first, using the table above or the Playground, which shows the exact size before it submits.

What is the default size and quality?

Both default to auto, which leaves the choice to the model. Send explicit values when you need predictable output.

Send pixels, set the quality, read the error message

Almost every parameter problem is one of three things: a ratio sent as a size, a field the API does not accept, or a value outside the limits. The error message names the field for the first and third; a general message that names no field points at the second. Keep this page next to the GPT Image 2 API reference while you integrate.

Related guides