Upload Images/Documents to OpenAI API (vision and assistants)


Whats the best way to interact with OpenAI Visiion via n8n? How can i upload images?

The same for documents and the Assistant API, how to upload documents?

Will there be updates to the openai node to better integrate with the OpenAI API?

Hi @Nikto655, when asking questions about functionality not supported by n8n it would be tremendously helpful if you could include links to the respective API reference.

In general, you can call more or less any REST API from within n8n using the HTTP Request node. Uploading files to n8n works using the https://api.openai.com/v1/files endpoint documented by OpenAI here. In a workflow you can call this endpoint like so using the HTTP Request node:

Creating a chat completion using an image will also work through the HTTP Request node, using the respective endpoint provided by OpenAI. If you don’t have a public URL for your image you’d need to first convert it into a base64 string before making the request. Here’s an example workflow:

Result (using this image):

Hope this helps!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.