How can I post file to gpt4o api

That code is not right. Not even in the ballpark.

This linked code below is, showing how to employ a file that has been uploaded to the files endpoint as a file id in a thread message in the Assistants endpoint.