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}'
}}