Actions20
- Assistant Actions
- Embedding Actions
- File Actions
- Report Actions
- Text Actions
- Thread Actions
Overview
This node enables uploading files to the OpenAI platform using the OpenAI Analytics API or the standard OpenAI API. It is useful when you want to provide files for various purposes such as training, fine-tuning, or assisting AI models within your workflows. Typical scenarios include:
- Uploading datasets or documents to be used by an assistant.
- Providing input files for AI assistants to process.
- Uploading files for fine-tuning custom AI models.
For example, you might use this node to upload a CSV file containing customer data that an AI assistant will analyze or to upload training data for fine-tuning a language model.
Properties
Name | Meaning |
---|---|
Authentication | Choose between "OpenAI Analytics API" (dedicated credentials) or "OpenAI API" (existing credentials). |
Binary Property | The name of the binary property from the previous node that contains the file data to upload (e.g., "data"). This must contain the actual binary content of the file. |
File Purpose | The intended purpose of the uploaded file. Options are: - Assistants: Files for use with Assistant - Assistants Input: Files for input to Assistant - Fine-Tune: Files for fine-tuning models |
Output
The node outputs JSON data representing the response from the OpenAI API after uploading the file. This typically includes metadata about the uploaded file such as its ID, filename, purpose, size, and status. The output does not include binary data but provides information necessary to reference or manage the uploaded file in subsequent workflow steps.
Dependencies
- Requires valid API authentication credentials for either the OpenAI Analytics API or the standard OpenAI API.
- The node uses the official OpenAI SDK internally to perform the file upload operation.
- No additional environment variables are explicitly required beyond the API credentials configured in n8n.
Troubleshooting
Common Issues:
- Incorrect or missing API credentials can cause authentication failures.
- Specifying a binary property name that does not exist or does not contain valid file data will result in errors.
- Selecting an unsupported file purpose may cause the API to reject the upload.
Error Messages:
- "Error loading credentials" — Indicates failure to retrieve or validate the provided API credentials. Verify that the credentials are correctly set up in n8n.
- "Unsupported resource" — Occurs if the resource parameter is incorrect; ensure "file" is selected.
- API errors related to file size limits or invalid file formats should be resolved by checking the file content and size before upload.
Links and References
- OpenAI File Upload API Documentation
- OpenAI Official Node.js SDK
- n8n Documentation on Working with Binary Data