Overview
This node integrates with Google Gemini AI to perform three main operations: generating text, uploading files, and analyzing uploaded files. For the Generate Text operation, it sends a text prompt (optionally with system instructions) to a selected Gemini model and returns AI-generated text or JSON responses. This is useful for tasks like content creation, summarization, chatbots, or any scenario requiring AI text generation.
Practical examples:
- Generate creative writing or marketing copy based on a prompt.
- Create conversational AI responses with system-level guidance.
- Obtain structured JSON data from AI for further processing.
Properties
Name | Meaning |
---|---|
Model | The Gemini AI model to use. Options: "Gemini 2.5 Flash (Preview)", "Gemini 1.5 Flash", "Gemini 1.5 Pro" |
Prompt | The main text prompt sent to Gemini for text generation (required). |
System Prompt | Optional system instructions to guide the AI's behavior or style. |
Response Format | Format of the response: either plain text ("Text") or JSON formatted ("JSON"). |
Temperature | Controls randomness in the generated output; range 0 (deterministic) to 2 (very random). |
Max Output Tokens | Maximum number of tokens the AI can generate in the response (1 to 8192). |
Output
The node outputs a JSON object containing:
response
: The generated text or JSON content returned by Gemini AI.model
: The name of the Gemini model used.prompt
: The original prompt sent to the AI.- Any additional input JSON fields passed through from the input item.
If the user selects JSON as the response format, the response
field contains the AI output in JSON structure; otherwise, it is plain text.
No binary data is output for this operation.
Dependencies
- Requires an API key credential for authenticating requests to the Google Gemini AI service.
- The node makes HTTP POST requests to the Gemini API endpoints.
- Proper n8n credential setup for the Gemini API is necessary.
Troubleshooting
- No valid response received from Gemini API: Indicates the AI did not return usable content. Check prompt validity and model selection.
- Gemini API Error: Generic error from the API call, possibly due to network issues, invalid credentials, or exceeding rate limits.
- Required prompt missing: The prompt property must be provided; otherwise, the node will fail.
- Ensure the temperature value is within the allowed range (0-2).
- If using JSON response format, verify downstream nodes can handle JSON structures.
Links and References
- Google Gemini AI Documentation (for API details)
- n8n Documentation (for general node usage and credential setup)