Actions6
- Chat Actions
- Completion Actions
- Feedback Actions
Completion → Create Completion
AI-generatedOverview
The node integrates with the Dify AI platform to create text completions based on user-provided input variables. It supports sending multiple input key-value pairs, attaching files, and configuring how the response is handled (blocking or streaming). This node is useful for generating AI-driven text outputs such as content generation, summarization, or any scenario where dynamic text completion is needed.
Practical examples:
- Generating product descriptions by providing product attributes as inputs.
- Creating chatbot responses by feeding conversation context variables.
- Summarizing documents by uploading files and requesting a completion.
Properties
| Name | Meaning |
|---|---|
| Inputs | Input variables as key-value pairs defined in your Dify application; these are used to generate the completion. |
| Response Mode | How to handle the AI response: - Blocking: Wait for the full response before returning. - Streaming: Stream the response as it is generated via Server-Sent Events. |
| User ID | Unique identifier for the user, used for tracking and analytics purposes. |
| Files | Files to attach to the completion request. Each file requires: - Input Data Field Name: The binary property name containing the file. - File Type: The type of file being uploaded (Image, Document, Audio, Video). |
| Additional Options | Optional settings including: - Timeout (Seconds): Maximum wait time for API response (1-300 seconds). - Include Usage Stats: Whether to include token usage and cost info in the response. - Include Retriever Resources: Whether to include knowledge base retrieval information in the response. |
Output
The node outputs JSON data representing the AI-generated completion result. The structure typically includes the generated text and may optionally contain usage statistics and retriever resource details if those options are enabled.
If files are attached, the node handles them as part of the request but does not output binary data itself.
Dependencies
- Requires an API key credential for authenticating with the Dify AI platform.
- Needs the base URL of the Dify API configured in credentials.
- Supports streaming responses via Server-Sent Events when "Streaming" mode is selected.
Troubleshooting
- Timeouts: If the node times out, consider increasing the "Timeout (Seconds)" option.
- Invalid Inputs: Ensure that all required input keys and values are correctly set according to your Dify app configuration.
- File Upload Issues: Verify that the binary property names match the actual input data fields and that file types are correctly specified.
- Authentication Errors: Confirm that the API key and base URL credentials are valid and have proper permissions.
- Unsupported Operations: Using operations or resources other than "completion" with "create" will cause errors.
Common error messages:
"The operation "X" is not supported for resource "completion": Means an invalid operation was selected.- Authentication failures usually indicate missing or incorrect API credentials.
- Network or timeout errors suggest connectivity issues or insufficient timeout settings.
Links and References
- Dify AI Platform Documentation (for API details and input variable definitions)
- n8n Documentation (for general node usage and credential setup)