Unsupported content type: 'multipart/form-data'

For some reason from today, I have been getting this error quite frequently. Its not always, but very frequent even though there is no change in the code whatsoever.


Error code: 400 - {'error': {'message': "Unsupported content type: 'multipart/form-data'. This API method only accepts 'application/json' requests, but you specified the header 'Content-Type: multipart/form-data'. Please try again with a supported content type.", 'type': 'invalid_request_error', 'param': None, 'code': 'unsupported_content_type'}}

I use this to generate images always. But the current behavior is such that it works half of the times, and it does not work the other

    client = AsyncAzureOpenAI(
        azure_endpoint=endpoint,
        api_key=api_key,
        api_version="2025-04-01-preview",
        azure_deployment=deployment_name,
    )

    try:

        response = await client.images.edit(
            model="gpt-image-1",
            image=images,
            prompt=prompt,
            n=1,
            quality=quality,
            # input_fidelity="high",
        )

1 Like

OpenAI cannot fix Microsoft AI services.

1 Like