Recently, OpenAI changes some preview version of models behavior, causing error when the messages contain images even if the images is generated by the assistant.
The solution for this is change your models to stable version, like gpt-3.5-turbo, etc.
related questions: Gpt-4-turbo-2024-04-09 not accepting images in thread history - Bugs - OpenAI Developer Forum