Actions20
- Assistant Actions
- Embedding Actions
- File Actions
- Report Actions
- Text Actions
- Thread Actions
Overview
This node integrates with the OpenAI Analytics API and the standard OpenAI API to provide a variety of AI-powered functionalities. It supports multiple resources such as assistants, embeddings, files, reports, text processing, and threads, enabling users to perform operations like creating and managing assistants, generating embeddings, uploading and downloading files, running conversational threads, parsing JSON, and generating HTML reports.
Common scenarios where this node is beneficial include:
- Automating interactions with AI assistants for customer support or content generation.
- Creating and using text embeddings for semantic search or classification.
- Managing files related to AI workflows, including uploads and downloads.
- Generating detailed HTML reports from textual data using AI.
- Running multi-message conversational threads with AI models.
- Parsing and fixing JSON strings using AI assistance.
Practical examples:
- A user can create an assistant configured with specific instructions and use it to generate responses.
- Generate embeddings for a batch of texts to enable similarity-based classification.
- Upload training files for fine-tuning AI models.
- Run a thread that sends multiple messages to an AI assistant and waits for the response.
- Parse a JSON string that may contain syntax errors by leveraging AI to fix it automatically.
- Generate a styled HTML report summarizing input text content.
Properties
Name | Meaning |
---|---|
Authentication | Choose between "OpenAI Analytics API" (dedicated analytics credentials) or "OpenAI API" (existing OpenAI credentials). |
Resource | Select the resource type to operate on: Assistant, Embedding, File, Report, Text, Thread. |
Operation | The action to perform, varies by resource. Examples: Get Assistants, Create Thread, Upload File, Generate HTML Report, Parse JSON, etc. |
Initial Message (Thread - Create) | Optional initial message to start a new thread. |
Thread ID (Thread - various) | Identifier of the thread to operate on (add message, run, check status, list messages). |
Message Role (Thread - Add Message) | Role of the message author, e.g., User. |
Message Content (Thread - Add Message) | Content of the message to add to the thread. |
File IDs (Thread - Add Message) | Comma-separated file IDs to attach to the message. |
Thread Assistant Selection | How to select the assistant for a thread run: from list or by ID. |
Thread Assistant ID | The assistant's ID selected either from list or entered manually. |
Wait for Completion (Thread) | Whether to wait for the thread run to complete before returning results. |
Maximum Poll Time (Thread) | Max seconds to wait for thread run completion when waiting. |
Instructions (Thread) | Override default system instructions for the assistant in the thread run. |
Simplify Output (Thread) | Return simplified response format for easier consumption. |
Message Input Method (Thread - Create and Run) | Choose single or multiple messages input method. |
Messages (Thread - Create and Run) | List of messages with roles and content to add to the thread. |
File Attachment Method (Thread - Create and Run) | How to attach files: existing IDs, upload new, both, or none. |
Binary Property (Thread - Create and Run) | Name of binary property containing file data from previous node for upload. |
File Purpose (Thread - Create and Run) | Purpose category for uploaded files (e.g., assistants, assistants_input). |
Enable File Attachments (Thread - Create and Run) | Whether to attach existing uploaded files. |
File IDs (Thread - Create and Run / Run Existing Thread) | File IDs to attach to the thread. |
Prompt (Report - Generate HTML Report) | Text prompt describing the desired report output. |
Input Text (Report - Generate HTML Report) | Text data to analyze and generate the report from. |
OpenAI Model (Report) | OpenAI model used for report generation. |
Include Default Libraries (Report) | Whether to include built-in UI libraries in the generated report. |
Advanced Settings (Report) | Enable advanced generation parameters like temperature, max tokens, top P. |
Temperature (Report) | Controls randomness of AI output (0 deterministic, 2 very random). |
Max Tokens (Report) | Maximum tokens allowed in the generated output. |
Top P (Report) | Nucleus sampling parameter controlling diversity of output. |
Additional CSS/JS Libraries (Report) | URLs of extra CSS or JavaScript libraries to include in the report. |
Binary Property (Report) | Property name to store generated HTML report as binary data. |
File Selection Method (File - Download) | Choose to specify file by ID or select from list. |
Model (Embedding) | Embedding model to use for creating embeddings or classification. |
Input Type (Embedding - Create) | Type of input: single text, multiple texts, or JSON array of texts. |
Text(s) (Embedding - Create) | Text input(s) to embed, depending on input type. |
Options (Embedding - Create) | Additional embedding options like dimensions, encoding format, user identifier. |
Target Text (Embedding Based Classify) | Text to classify using embedding similarity. |
Categories Mode (Embedding Based Classify) | Use new categories or saved category embeddings. |
Categories (Embedding Based Classify) | List of categories with optional pre-generated embeddings. |
Similarity Threshold (Embedding Based Classify) | Minimum similarity score for classification (0-1). |
Classification Type (Embedding Based Classify) | Single best match or multiple matches above threshold. |
Use Branch Outputs (Embedding Based Classify & LLM Based Classify) | Enable branching based on classification result. |
Target Text (LLM Based Classify) | Text to classify using large language model. |
Categories (LLM Based Classify) | Categories to classify into using LLM. |
Response Format (LLM Based Classify) | Text or structured JSON response format. |
JSON Input (Text / Embedding - Parse JSON) | JSON string to parse into object. |
Use AI Fix (Text / Embedding - Parse JSON) | Use AI to fix JSON syntax errors automatically. |
Fix Model (Text / Embedding - Parse JSON) | OpenAI model to use for fixing JSON syntax errors. |
Assistant Name (Assistant - Create) | Name of the assistant to create. |
Description (Assistant - Create) | Description of the assistant. |
System Instructions (Assistant - Create) | System instructions used by the assistant. |
Model (Assistant - Create) | AI model used by the assistant. |
Use Code Interpreter (Assistant - Create) | Enable code interpreter capability. |
Use Retrieval (Assistant - Create) | Enable file retrieval/search capability. |
Use Function Calling (Assistant - Create) | Enable function calling capability. |
Function Definitions (Assistant - Create) | JSON array defining functions for the assistant. |
Response Format Type (Assistant - Create) | Preferred response format: auto, text, or JSON object. |
Use Advanced Settings (Assistant - Create) | Enable advanced generation parameters. |
Temperature, Top P, Metadata (Assistant - Create) | Advanced generation parameters and metadata. |
Use File Attachments (Assistant - Create) | Attach files to the assistant. |
Assistant File IDs (Assistant - Create) | File IDs to attach to the assistant. |
Output
The node outputs an array of items corresponding to each input item processed. Each output item contains a json
field with the result of the requested operation. The structure of the json
output depends on the resource and operation performed:
- For assistants, outputs include lists of assistants or details of created assistants.
- For threads, outputs include thread creation results, added messages, run statuses, or retrieved messages.
- For files, outputs include lists of files, file metadata, or downloaded file content.
- For embeddings, outputs include generated embedding vectors or classification results.
- For text operations, outputs include parsed JSON objects or fixed JSON.
- For reports, outputs include generated HTML report content, which can also be stored as binary data under a specified property.
If the node handles binary data (e.g., uploading or downloading files, storing generated HTML reports), the binary data is attached to the output item under the specified binary property name.
In case of errors during processing, if "Continue On Fail" is enabled, the output will contain an error message in the json.error
field for the respective item.
Dependencies
- Requires valid API credentials for either the OpenAI Analytics API or the standard OpenAI API.
- Uses the official OpenAI Node.js client library.
- Relies on n8n credential management to securely store and access API keys and optional organization IDs.
- Network access to OpenAI endpoints (default base URL: https://api.openai.com/v1).
- No additional external dependencies beyond those bundled.
Troubleshooting
Common Issues
- Credential loading errors: If credentials are missing, invalid, or misconfigured, the node will fail to authenticate with OpenAI APIs.
- Unsupported resource or operation: Selecting a resource or operation not supported by the node will throw an error.
- Timeouts waiting for thread runs: When waiting for thread completion, if the maximum poll time is too short, the node might return incomplete results.
- Invalid JSON input: Parsing JSON strings may fail if the input is malformed; enabling AI fix can help resolve syntax errors.
- File attachment issues: Incorrect file IDs or missing binary data properties can cause failures when attaching files to threads or assistants.
Error Messages and Resolutions
"Error loading credentials"
: Check that the correct API key credential is selected and properly configured."Unsupported resource: <resource>"
: Verify that the resource name is valid and supported."Category text is empty"
(translated): Ensure that category names for embedding classification are provided and non-empty."JSON parsing failed"
: Validate JSON input or enable AI fix option to attempt automatic correction."File not found"
or similar: Confirm that file IDs exist and are accessible with the provided credentials.
Links and References
- OpenAI API Documentation
- OpenAI Embeddings Guide
- OpenAI Chat Completion API
- n8n Documentation
- OpenAI Analytics API (if publicly documented) (Note: link subject to availability)