Skip to content

client.images.edit() method failed to pass image_url as image input #3256

Description

@zh0903

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

client.images.edit() method failed to pass image_url as image input.

As indicated in following doc, /images/edits supports image_url as input (JSON).
But when passing url to client.images.edit(), rather than file object, API throws 400 error.

I am afraid /images/edits doesn't support image_url as image input. Doc is wrong.

https://developers.openai.com/api/reference/resources/images/methods/edit#(resource)%20images%20%3E%20(method)%20edit%20%3E%20(params)%200.non_streaming%20%3E%20(param)%20images%20%3E%20(schema)

To Reproduce

result = client.images.edit(
model="gpt-image-1.5",
images={
image_url: "https://yavuzceliker.github.io/sample-images/image-1021.jpg"},
prompt=prompt
)

Code snippets

OS

Windows 11

Python version

v3.11.4

Library version

2.26.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions