The 1.88.0 version of OpenAI suddenly reported an error, but I still haven't encountered this error when using it yesterday

The 1.88.0 version of OpenAI suddenly reported an error, but I still haven’t encountered this error when using it yesterday,The error is as follows,The call is to the “client. images. edit” interface. Previously, it was possible to transfer multiple images, but today it reported that it is not working

{
“error”: “Error code: 400 - {‘error’: {‘message’: “Unknown parameter: ‘image[0]’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘image[0]’, ‘code’: ‘unknown_parameter’}}”,
“status”: “failed”
}

Are you using the model gpt-image-1?

If using dall-e 2, only a single image and an optional single mask image is allowed.

I report continued success with this simple code (and we’re up to 1.100 now), synthesizing two images.

from pathlib import Path
from openai import OpenAI

prompt = """
That's me in the yellow top.
Create image: Show me if I was wearing the pink dress in the park.
Composition: zoom out, full body length
"""
input_paths = [
    "images/my_picture.png",
    "images/dress.jpg",
    #"another_dir/yet_another_file.png"
]
output_file = "new_image_edit.png"

output_path = Path(output_file)
output_path.parent.mkdir(parents=True, exist_ok=True)
open_files = [p.open("rb") for p in [Path(p) for p in input_paths]]

client = OpenAI()
resp = client.images.edit(
    model="gpt-image-1",
    image=open_files,
    prompt=prompt.strip(),  # strip() removes leading and trailing whitespace
    quality="medium",       # of high, medium and low
    size="1024x1024",       # also "1536x1024" or "1024x1536", also "auto"
    output_format="png",    # also "jpg" or "webp"
    background="opaque",    # or you can use "transparent", but not with jpg
    #input_fidelity="high", # - additional $0.04 or $0.06 for better copying
)
import base64
with output_path.open("wb") as f:
    f.write(base64.b64decode(resp.data[0].b64_json))
print("done")

You can verify the environment isn’t employing even an older SDK:

import openai
print(openai.__version__)

Adapt to your unmentioned programming language.

I am facing this error also

Yes, I am using gpt-image-1

Why is there a sudden error? It has been working normally for the past month, and the input list contains multiple images

Have you found the reason?

I was able to call it normally yesterday, but the same code doesn’t work today

Absolutely changing nothing? As in you want the same input image count and ask the same thing again.

What image count?
I’ve picked low quality, high quality and high fidelity (about $0.35), even six input images, all successful.

If you want the full API parameters currently supported by the image edits endpoint, such as input_fidelity, you will need:

pip install --upgrade "openai>=1.97.2"
Even the mentioned Python 1.88.0 cannot send the expected output_format parameter.

It is possible that there are other issues in backwards support by the API with some server changes, such as old SDK not constructing the multipart request with the correct field labels now or such.

I just upgraded OpenAI to Version 1.100.1, but it still reports the same error; The online code also reports the same error, but I haven’t updated the online code in the past two days; There are no changes to the local code, it’s the same as yesterday!

Here’s a no-SDK version, making direct streaming calls with the httpx library, written for the forum just days ago:

Drop that in somewhere and run with your own images and prompt edited in - completely eliminate the SDK, pin it down to something about your organization and the API server.

You can create a new project to “re-deploy” models and attempt that new API key.

Now it’s all right. Thanks for your help