/v1/images/edits rejects gpt-image-2 — hardcoded to dall-e-2 only

The /v1/images/edits endpoint rejects gpt-image-2 with a 400 error.

Error returned:
{
“error”: {
“message”: “Invalid value: ‘gpt-image-2’. Value must be ‘dall-e-2’.”,
“type”: “invalid_request_error”,
“param”: “model”,
“code”: “invalid_value”
}
}

Tested models — ALL rejected:

  • gpt-image-2 – primary concern
  • gpt-image-1
  • gpt-image-1-mini
  • chatgpt-image-latest
  • image-latest

Only dall-e-2 is accepted, which is the oldest and lowest-quality model.

This means gpt-image-2, your most capable image model, cannot accept
image input at all. The /v1/images/generations endpoint (text-only) accepts
gpt-image-2 fine, but /v1/images/edits does not. There is no way to feed
a reference image into gpt-image-2 through any available endpoint.

Request format tested: multipart/form-data with binary image bytes,
proper Content-Type and filename headers — same format that works with dall-e-2.

So you are trying to create a scene using mutiple gpt-image-2 generated objects as inputs?

Hi and welcome to the community!

This is likely caused by the documentation. The docs mix several image surfaces and model families, so it is easy to combine parameters from different paths.

For gpt-image-2 image input, use:

curl https://api.openai.com/v1/images/edits \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F "model=gpt-image-2" \
  -F "image[]=@input.png" \
  -F "prompt=Edit this image by ..."

Or with the Python SDK:

from openai import OpenAI

client = OpenAI()

result = client.images.edit(
    model="gpt-image-2",
    image=open("input.png", "rb"),
    prompt="Edit this image by ..."
)

Please note:

  • /v1/images/edits is the correct endpoint for GPT Image with reference-image or edit workflows.
  • /v1/images/variations is DALL-E 2 only. It does not support gpt-image-2.
  • response_format is a DALL-E-era parameter. GPT Image models return base64 image data and use GPT-image-specific parameters like output_format, output_compression, quality, etc.

It works now, thank you very much!