Overview
This node provides an interface to interact with AI language models from two different providers: Gemini and OpenAI. It allows users to select a provider and then choose a specific model by name or ID. The node sends input data to the selected AI model and returns the generated text or response.
Common scenarios for this node include:
- Generating text completions or chat responses using AI models.
- Integrating AI-powered content generation into workflows.
- Using different AI providers/models dynamically based on user choice.
Practical examples:
- Automatically generating email replies or summaries.
- Creating chatbot responses in customer support automation.
- Producing creative writing or code snippets via AI assistance.
Properties
| Name | Meaning |
|---|---|
| Provider | Selects the AI service provider. Options: "Gemini", "OpenAi". |
| Model Name or ID | Specifies the AI model to use. Can be chosen from a dynamically loaded list depending on the selected provider, or set via expression as a custom model ID. |
Output
The node outputs JSON data containing the AI model's response. The exact structure depends on the provider and model used but generally includes fields such as:
json: The main output field containing the AI-generated text or completion result.- If binary data is supported (e.g., images or audio), it would be included in the binary output field, but this node primarily deals with textual AI models.
Dependencies
- Requires API credentials for the selected AI provider (Gemini or OpenAI).
- Needs proper configuration of API keys or authentication tokens within n8n credentials.
- Uses external libraries for HTTP requests and AI SDKs (implied by imports like
jx,j3,s5,H3,M3,P5which correspond to API clients or utilities). - Supports dynamic loading of available models per provider.
Troubleshooting
Common Issues
- Invalid or missing API key: The node requires valid API credentials for the chosen provider. Ensure that the API key is correctly configured in n8n.
- Model not found: Selecting a model name or ID that does not exist or is not accessible with the provided credentials will cause errors.
- Timeouts or network errors: Network issues or slow responses from the AI provider can lead to timeouts.
- Unsupported provider or model: Using a provider or model not supported by the node will fail.
Error Messages and Resolutions
- Authentication failed: Check that the API key credential is valid and has necessary permissions.
- Model not found: Verify the model name/ID is correct and available for the selected provider.
- Request timed out: Increase timeout settings or check network connectivity.
- Unexpected response format: Ensure the provider's API has not changed; update the node or dependencies if needed.
Links and References
- n8n Expressions Documentation
- OpenAI API documentation (for reference): https://platform.openai.com/docs/api-reference
- Gemini AI provider documentation (if publicly available)
Note: The source code was heavily obfuscated, so the above summary is based on static analysis of property definitions, naming conventions, and typical usage patterns of AI integration nodes in n8n.