Cannot send image_url to gpt-4o

The error message is misleading. It should state that the API body is malformed:

{'type': 'image_url', f'data:image/png;base64,{base64_image}'}

Should be:


{'type': 'image_url', 
 'image_url' : {
    'url' : f'data:image/png;base64,{base64_image}'
}}