Thread Assistant Message Create with image_file returning 400 invalid value 'image_file'

Hello,

I am creating my chat bot with Typescript and openai v4.52.7.
Since the Assistant API doesn’t support base64 image_url, I am trying the upload file approach with reference to file_id.

When I create the thread message with type image_file I get the error
“OpenAI Error: Error: 400 Invalid value: 'image_file '. Supported values are: ‘text’, ‘image_url’, and ‘image_file’.”
Which is very ambiguous image_file is one of the supported value…

Here is the code:

const threadRun = await openAI.beta.threads.runs.create(         
openAIthread.id,   {
    "role": "user",
    "content": [
        {
            "type": "text",
            "text": "Can you tell me what you see in the image with file id file-pDaHoQnwiL8n8Ucd10VMmRy9"
  },
        {
            "type": "image_file ",
            "image_file": {
                "file_id": "file-pDaHoQnwiL8n8Ucd10VMmRy9"
            }
        }
    ]
}
);

Does anyone have a fix for this?

I’m facing a similar problem, and don’t have a solution yet, but I noticed that you have a space behind image_file, so maybe that’s the issue in your case.