Overview
This node integrates with the Google Gemini AI service, providing three main operations: generating text, uploading files for processing, and analyzing uploaded files with a text prompt. The Upload File operation allows users to upload binary files (such as audio, image, video, or documents) to Gemini for later analysis or processing.
Typical use cases include:
- Uploading media files (audio, images, videos) to Gemini to prepare them for AI-driven analysis.
- Storing files in Gemini's system to enable subsequent operations like transcription, description, or other AI-powered insights.
- Automating workflows where files from previous nodes are sent to Gemini without manual intervention.
For example, you might have an audio recording from a previous node that you want to upload to Gemini so it can be transcribed or analyzed later.
Properties
Name | Meaning |
---|---|
Binary Property | The name of the binary property in the input data that contains the file to upload. |
Display Name | A custom name for the uploaded file. If left empty, the original filename (without extension) is used. |
Output
The output JSON object after a successful file upload includes:
fileUri
: The URI identifier of the uploaded file in Gemini.fileName
: The internal filename assigned by Gemini.displayName
: The display name of the file (custom or derived).mimeType
: The MIME type of the uploaded file.sizeBytes
: The size of the file in bytes.createTime
: Timestamp when the file was created/uploaded.originalFileName
: The original filename from the binary data.originalMimeType
: The original MIME type detected or inferred.- Plus any additional fields from the input item's JSON.
The node does not output binary data itself but processes binary input for upload.
Dependencies
- Requires an API key credential for authenticating requests to the Google Gemini AI API.
- The node uses n8n's helper methods to perform authenticated HTTP requests.
- The environment must allow outbound HTTPS requests to
https://generativelanguage.googleapis.com
.
Troubleshooting
- No binary data found in property 'X': Ensure the specified binary property exists and contains valid binary data from a previous node.
- Binary data does not contain valid data: The binary data must be base64 encoded; verify the source node outputs correct binary format.
- Failed to get upload URL from Gemini API: Check API credentials and network connectivity; the API may reject unauthorized or malformed requests.
- Failed to upload file to Gemini API: Could indicate issues with the file content or API limits; verify file size and format compatibility.
- File upload error: [message]: General catch-all for upload failures; review the detailed message for specifics.
- If the node throws errors related to authentication, ensure the API key credential is correctly configured and has necessary permissions.