Skip to content

[Bug]: Azure Image Edit API with gpt-image-1 fails when using mask parameter #13528

@sahithi2105

Description

@sahithi2105

What happened?

Description:
When trying to use the /v1/images/edits endpoint with the mask parameter for Azure’s gpt-image-1 model, LiteLLM throws an AzureException APIError complaining about an unexpected _io.BytesIO type.

Error:
litellm.APIError: AzureException APIError - Invalid type for value. Expected primitive type, got <class '_io.BytesIO'>: <_io.BytesIO object at 0x7f953ddc1760>

Payload :
curl -X POST "http://localhost:4000/v1/images/edits"
-H "Authorization: Bearer your-api-key"
-F "model=gpt-image-1"
-F "image=@original_image.png"
-F "mask=@mask_image.png"
-F "prompt=Add a beautiful sunset in the background"
-F "n=1"
-F "size=1024x1024"
-F "response_format=url"

Relevant log output

Error:

litellm.APIError: AzureException APIError - Invalid type for value. Expected primitive type, got <class '_io.BytesIO'>: <_io.BytesIO object at 0x7f953ddc1760

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

v1.74.0-stable

Twitter / LinkedIn details

No response

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