npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-gemini

v1.0.3

Published

Node-RED nodes for Google Gemini AI integration including text generation, chat, vision, image generation, speech generation, and audio understanding capabilities

Downloads

239

Readme

node-red-contrib-gemini

A comprehensive Node-RED package providing nodes for Google's Gemini AI models, covering text generation, chat, vision, image generation, audio understanding, and speech synthesis.

Included Nodes

  • gemini-generate-content: Text generation, multi-turn chat, and vision analysis.
  • gemini-image-generate: Create and edit images (Imagen 3 / Gemini).
  • gemini-speech-generate: High-quality text-to-speech synthesis.
  • gemini-audio-understand: Transcription and analysis of audio files.
  • gemini-api-key: Secure API credential management.

Quick Start

  1. Install: Search for node-red-contrib-gemini in the Node-RED Palette Manager.
  2. Get Key: Obtain a an API key from Google AI Studio.
  3. Configure: Check the API Key configuration node and paste your key.
  4. Select Model: In any node, click the Fetch Models (refresh) button to load the latest available models directly from Google.

Key Features

  • Dynamic Model Fetching: Automatically access new models as they are released without package updates.
  • Multimodal Support: Seamlessly handle text, images, video, and audio.
  • Mustache Templating: Use {{msg.payload}} or {{msg.topic}} in prompts and text fields.
  • Advanced Options: Support for Google Search Grounding, Streaming responses, and JSON/Enum output.
  • Output Control: Send results to msg.payload, files, or custom properties.

Examples

[
    {
        "id": "e8a423a769b8dec0",
        "type": "gemini-generate-content",
        "z": "a6c480dcb27b87bd",
        "g": "7c41675671016995",
        "name": "",
        "apiKey": "fe0d58f14ac27f69",
        "modelSelection": "gemini-3-flash-preview",
        "customModel": "",
        "customModelType": "str",
        "mode": "single",
        "prompt": "Does the movie {{msg.payload.movie}} have an after credits scene? Answer as briefly as possible. ",
        "promptType": "str",
        "multimodalInputsData": "[]",
        "grounding": true,
        "temperature": "1",
        "temperatureType": "num",
        "topP": "0.95",
        "topPType": "num",
        "topK": "64",
        "topKType": "num",
        "maxOutputTokens": "8192",
        "maxOutputTokensType": "num",
        "safetyHarassment": "BLOCK_MEDIUM_AND_ABOVE",
        "safetyHateSpeech": "BLOCK_MEDIUM_AND_ABOVE",
        "safetySexuallyExplicit": "BLOCK_MEDIUM_AND_ABOVE",
        "safetyDangerousContent": "BLOCK_MEDIUM_AND_ABOVE",
        "thinkingBudget": "-1",
        "thinkingBudgetType": "num",
        "thinkingLevel": "",
        "thinkingLevelType": "str",
        "includeThoughts": false,
        "systemInstruction": "",
        "systemInstructionType": "str",
        "outputProperty": "msg.payload.details",
        "passthroughProperties": false,
        "responseFormat": "json",
        "schemaPropertiesData": "[{\"name\":\"afterCredits\",\"type\":\"BOOLEAN\",\"required\":true},{\"name\":\"details\",\"type\":\"STRING\",\"required\":true},{\"name\":\"sourceURL1\",\"type\":\"STRING\",\"required\":true},{\"name\":\"sourceURL2\",\"type\":\"STRING\",\"required\":false}]",
        "enumValues": "",
        "x": 650,
        "y": 500,
        "wires": [
            [
                "14a2617d6e1c1a49"
            ],
            [
                "14a2617d6e1c1a49"
            ]
        ]
    },
    {
        "id": "0553c65f94a35371",
        "type": "inject",
        "z": "a6c480dcb27b87bd",
        "g": "7c41675671016995",
        "name": "Send movie example (structured output + grounding)",
        "props": [
            {
                "p": "payload.movie",
                "v": "The Long Walk",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 310,
        "y": 500,
        "wires": [
            [
                "e8a423a769b8dec0"
            ]
        ]
    },
    {
        "id": "14a2617d6e1c1a49",
        "type": "debug",
        "z": "a6c480dcb27b87bd",
        "g": "7c41675671016995",
        "name": "Text generate (grounding + search) debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1020,
        "y": 500,
        "wires": []
    },
    {
        "id": "fe0d58f14ac27f69",
        "type": "gemini-api-key",
        "name": "node-red-free"
    },
    {
        "id": "90b01cfcf7ce8cba",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-contrib-gemini": "1.0.2"
        }
    }
]
[{"id":"be4d6ff6a36494ee","type":"group","z":"a6c480dcb27b87bd","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["6fc837881ae39da0","c48c713b1208e241","a7f861aa9e06a8bb","a773e54e40b4e08b","f877c30efdbbeeeb","18ea36bf88be42b6","ea909ae5b69bfe15"],"x":64,"y":739,"w":1562,"h":262},{"id":"6fc837881ae39da0","type":"gemini-image-generate","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"Generate Image","apiKey":"86f1d6e41a7140a9","modelSelection":"gemini-2.5-flash-image","customModel":"","customModelType":"str","prompt":"Generate an image of Scooby Doo having fun with his best friend, a green banana. They should be in a jurassic era volcanic setting with dinosaurs lurking","promptType":"str","numberOfImages":"1","numberOfImagesType":"num","aspectRatio":"1:1","outputFormat":"base64","saveDirectory":"","saveDirType":"str","mode":"generate","inputFile":"","inputFileType":"str","outputProperty":"msg.inputImages","systemInstruction":"","systemInstructionType":"str","responseModalities":"image","safetyHarassment":"BLOCK_MEDIUM_AND_ABOVE","safetyHateSpeech":"BLOCK_MEDIUM_AND_ABOVE","safetySexuallyExplicit":"BLOCK_MEDIUM_AND_ABOVE","safetyDangerousContent":"BLOCK_MEDIUM_AND_ABOVE","x":440,"y":800,"wires":[[["c48c713b1208e241","ea909ae5b69bfe15","a773e54e40b4e08b"],["ea909ae5b69bfe15"]]]},{"id":"c48c713b1208e241","type":"image viewer","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"","width":"580","data":"inputImages","dataType":"msg","active":true,"x":930,"y":780,"wires":[[]]},{"id":"a7f861aa9e06a8bb","type":"inject","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"Test image gen and edit","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":800,"wires":[["6fc837881ae39da0"]]},{"id":"a773e54e40b4e08b","type":"gemini-image-generate","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"Modify Image","apiKey":"86f1d6e41a7140a9","modelSelection":"gemini-2.5-flash-image","customModel":"","customModelType":"str","prompt":"Add a spooky jack o' lantern on top of scooby's head","promptType":"str","numberOfImages":"1","numberOfImagesType":"num","aspectRatio":"1:1","outputFormat":"base64","saveDirectory":"","saveDirType":"str","mode":"edit","inputFile":"","inputFileType":"str","outputProperty":"payload","systemInstruction":"","systemInstructionType":"str","responseModalities":"image","safetyHarassment":"BLOCK_MEDIUM_AND_ABOVE","safetyHateSpeech":"BLOCK_MEDIUM_AND_ABOVE","safetySexuallyExplicit":"BLOCK_MEDIUM_AND_ABOVE","safetyDangerousContent":"BLOCK_MEDIUM_AND_ABOVE","x":500,"y":960,"wires":[[["f877c30efdbbeeeb","18ea36bf88be42b6"],["f877c30efdbbeeeb"]]]},{"id":"f877c30efdbbeeeb","type":"debug","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"image 2 debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":860,"wires":[]},{"id":"18ea36bf88be42b6","type":"image viewer","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"","width":"580","data":"payload","dataType":"msg","active":true,"x":1530,"y":780,"wires":[[]]},{"id":"ea909ae5b69bfe15","type":"debug","z":"a6c480dcb27b87bd","g":"be4d6ff6a36494ee","name":"image 1 debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":820,"wires":[]},{"id":"86f1d6e41a7140a9","type":"gemini-api-key","name":"node-red-paid"}]
[
    {
        "id": "eba78a6484fd41a0",
        "type": "gemini-speech-generate",
        "z": "a6c480dcb27b87bd",
        "g": "e853ab82cdb9436c",
        "name": "",
        "apiKey": "fe0d58f14ac27f69",
        "model": "gemini-2.5-flash-preview-tts",
        "text": "james: Hello! I have no idea what I'm doing. blueman: This is a test of the multi-speaker generation with gemini in node-red",
        "textType": "str",
        "speakerMode": "multi",
        "voiceName": "",
        "speaker1Name": "james",
        "speaker1Voice": "Achernar",
        "speaker2Name": "blueman",
        "speaker2Voice": "Iapetus",
        "outputFormat": "buffer",
        "saveDirectory": "",
        "saveDirType": "str",
        "filename": "itsatest2",
        "filenameType": "str",
        "systemInstruction": "",
        "systemInstructionType": "str",
        "maxOutputTokens": "",
        "maxOutputTokensType": "num",
        "outputProperty": "msg.audioData",
        "passthroughProperties": false,
        "x": 590,
        "y": 660,
        "wires": [
            [
                "f06072a81460fba7",
                "7e5e2bc15661e2c7"
            ],
            [
                "f06072a81460fba7"
            ]
        ]
    },
    {
        "id": "ec11788db1f8ad68",
        "type": "inject",
        "z": "a6c480dcb27b87bd",
        "g": "e853ab82cdb9436c",
        "name": "Geenrate audio and then understand it example",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 660,
        "wires": [
            [
                "eba78a6484fd41a0"
            ]
        ]
    },
    {
        "id": "f06072a81460fba7",
        "type": "debug",
        "z": "a6c480dcb27b87bd",
        "g": "e853ab82cdb9436c",
        "name": "Speech generate debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 970,
        "y": 660,
        "wires": []
    },
    {
        "id": "7e5e2bc15661e2c7",
        "type": "gemini-audio-understand",
        "z": "a6c480dcb27b87bd",
        "g": "e853ab82cdb9436c",
        "name": "",
        "apiKey": "fe0d58f14ac27f69",
        "model": "gemini-2.5-flash",
        "prompt": "Transcribe this for me, identifying individual speakers",
        "promptType": "str",
        "audioFile": "",
        "audioFileType": "str",
        "systemInstruction": "",
        "systemInstructionType": "str",
        "temperature": "",
        "temperatureType": "num",
        "topP": "",
        "topPType": "num",
        "topK": "",
        "topKType": "num",
        "maxOutputTokens": "",
        "maxOutputTokensType": "num",
        "safetyHarassment": "BLOCK_MEDIUM_AND_ABOVE",
        "safetyHateSpeech": "BLOCK_MEDIUM_AND_ABOVE",
        "safetySexuallyExplicit": "BLOCK_MEDIUM_AND_ABOVE",
        "safetyDangerousContent": "BLOCK_MEDIUM_AND_ABOVE",
        "outputFormat": "text",
        "saveDirectory": "",
        "saveDirType": "str",
        "outputProperty": "payload",
        "passthroughProperties": false,
        "x": 890,
        "y": 600,
        "wires": [
            [
                "887cf6ec214ba54b"
            ],
            [
                "887cf6ec214ba54b"
            ]
        ]
    },
    {
        "id": "887cf6ec214ba54b",
        "type": "debug",
        "z": "a6c480dcb27b87bd",
        "g": "e853ab82cdb9436c",
        "name": "Audio understand debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1210,
        "y": 600,
        "wires": []
    },
    {
        "id": "fe0d58f14ac27f69",
        "type": "gemini-api-key",
        "name": "node-red-free"
    },
    {
        "id": "5033da0e83edc623",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-contrib-gemini": "1.0.2"
        }
    }
]

Disclaimer

This package was written with Claude Code. I'm not a developer by trade and am new to Git as a whole. This is also my first node-red package. I had a use for interfacing with Gemini in my node-red setup and wanted a better way of doing it. I tried to add features that I thought may be useful to a broader audience. I'll do my best to support this and keep it functional. I hope it's able to make your flows a little bit more robust :)

Instructions were given to stay within the confines of the Gemini API documentation https://ai.google.dev/gemini-api/docs as well as the Node.js SDK written by Google https://github.com/googleapis/js-genai. It was built against SDK version 1.27.0.

License

MIT License. Copyright (c) 2025.