GPT-4o Error: Image URLs in System Messages

Hi everyone,

I’m encountering an error when using GPT-4o that I haven’t run into with GPT-4-turbo. When I switched over, I got this error:

Error code: 400 - {‘error’: {‘message’: “Invalid ‘messages[4]’. Image URLs are only allowed for messages with role ‘user’, but this message with role ‘system’ contains an image URL.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘messages[4]’, ‘code’: ‘invalid_value’}}

Seems like GPT-4o doesn’t allow image URLs in system messages, while GPT-4-turbo doesn’t have a problem with it. Are there any workarounds for this, or plans to update GPT-4o to allow images in system messages?

Thanks for any help or info!

2 Likes

In the API reference, you can see what is allowed to be in a system role:

Untitled

This is the endpoint validation - content is a string, not an array of things. Keep on expanding “user” and you see the image format you can send.

https://platform.openai.com/docs/api-reference/chat/create#chat-create-messages

Thanks for pointing that out!

I’ll review the documentation further to ensure I’m following the correct format.