Upload image to assistant via API

What code would enable me to upload an image to a custom assistant via API? The vision Python script here is hard to modify to do so… Vision - OpenAI API

The linked “vision” guide is not applicable for Assistants, where you:

  • upload to file storage with purpose “vision”, receive ID
  • create a user message with the file ID as part of the message content
  • then manage and maintain the link from file to chat so your platform can clean up after itself after chat deletion or expiration.