<!-- BusyBot node reference — https://busybot.net/tools/gemini-chat/ -->

> Node: Gemini Chat (`gemini_chat`) · Action · v1
> Category: AI · Credentials: Google AI (`googleAi`)
> Updated: 2026-08-16

# Gemini Chat

> Chat with Google Gemini models using the generateContent API.

## Overview

Gemini Chat sends a user message to the Google Gemini generativeAI API (generateContent) and returns the model response. Supports model selection, system prompts, generation config (temperature, maxOutputTokens, topP, topK), and safety settings. Each input item is processed independently with configurable concurrency. The response includes the generated text, finish reason, and token usage metadata.

**Category:** AI  
**Tool Name:** `gemini_chat`  
**Version:** 1

**Appearance:** Icon: `gemini` | Color: `#ffffff`

## Node Type

**Action** — processes input items and produces output

## Input / Output

| Direction | Port(s) |
|-----------|--------|
| Input | `Input` |
| Output | `Output`, `Error` |

## Credentials

This tool requires **Google AI** credentials.
See the [Credentials Guide](https://busybot.net/credentials/google-ai/) for setup instructions.

### Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Model | `options` | No | (current default) | The Gemini model to use for generation. Pick a specific version — labels are pinned, not aliased to "latest". |
| | | | | Options: the Gemini chat models available to your workspace — pick one from the dropdown. |
| System Prompt | `string` | No | `You are a helpful assistant.` | System instruction that sets the behavior and persona of the model. Defaults to a generic helpful-assistant prompt — override per workflow as needed. Supports expressions. |
| User Message | `string` | Yes | — | The message to send to the Gemini model. Falls back to item.message or item.prompt if empty. Supports expressions like {{ $json.question }}. |
| File URIs | `string` | No | — | Optional. fileUri value(s) from the Gemini File Upload tool. Pass a single URI or a JSON array for multiple files. Files are sent as multimodal context alongside the message. Falls back to item.fileUris if empty. Gemini File API retains uploads for 48 hours. Supports expressions. |
| Options | `collection` | No | `{}` | Optional generation settings — add only the fields you need. |
| — Temperature | `number` | No | `1` | Controls randomness. Lower values are more deterministic, higher values are more creative. Range: 0-2. |
| — Max Output Tokens | `number` | No | `8192` | Maximum number of tokens in the generated response. |
| — Top P | `number` | No | — | Nucleus sampling threshold. Only tokens with cumulative probability up to topP are considered. |
| — Top K | `number` | No | — | Limits sampling to the top K most probable tokens. |
| — Response Field Name | `string` | No | `response` | The key name in the output JSON where the generated text will be stored. |
| Safety Settings | `fixedCollection` | No | `{ settings: [] }` | Configure safety filtering thresholds per harm category. Add one entry per category you want to change; categories you leave out keep the API's own default. |
| — Category | `options` | No | `HARM_CATEGORY_HARASSMENT` | The harm category to configure. |
| | | | | Options: `HARM_CATEGORY_HARASSMENT`, `HARM_CATEGORY_HATE_SPEECH`, `HARM_CATEGORY_SEXUALLY_EXPLICIT`, `HARM_CATEGORY_DANGEROUS_CONTENT` |
| — Threshold | `options` | No | `BLOCK_MEDIUM_AND_ABOVE` | The blocking threshold for this category. |
| | | | | Options: `BLOCK_NONE`, `BLOCK_LOW_AND_ABOVE`, `BLOCK_MEDIUM_AND_ABOVE`, `BLOCK_ONLY_HIGH` |
| Include Input | `boolean` | No | `false` | Whether to merge the input item JSON into the output item. |
| Max Concurrency | `number` | No | `10` | Maximum number of items to process concurrently. |

## Output Data

One request per input item, and one output item per input item. The reply text lands on the field named by **Response Field Name** (`response` by default), with `model`, `finishReason` and `usage` beside it. The rest of the input item JSON is dropped unless **Include Input** is on; binary data on the input item is forwarded unchanged.

```json
{
  "response": "The generated reply text",
  "model": "the model that produced the reply",
  "finishReason": "the API's reason for ending generation",
  "usage": { "promptTokenCount": 128, "candidatesTokenCount": 256 }
}
```

- `finishReason` is the API's own reason for ending generation — the field to check when a reply comes back cut off or empty, whether against the **Max Output Tokens** cap or a **Safety Settings** threshold that blocked the content.
- `usage` is the token accounting the API returned for that call.
- Turning on **Include Input** merges the original item fields into the same object, so make sure your response field name does not collide with an incoming field.

Reference the result downstream by expression, e.g. `{{ $json.response }}`.

## Usage Examples

- Send a question to Gemini and get a response
- Summarize text using a Gemini model with a system prompt
- Generate creative content with a system prompt and temperature control
- Process multiple items through Gemini with concurrency
- Use a more capable Gemini model for complex reasoning tasks

## Example Configuration

Ask a question with the default model and system prompt:

```json
{
  "type": "gemini_chat",
  "parameters": {
    "userMessage": "Explain what a vector database is in two sentences."
  }
}
```

Classify each item deterministically and keep the original fields:

```json
{
  "type": "gemini_chat",
  "parameters": {
    "systemPrompt": "Classify the sentiment of the text as POSITIVE, NEGATIVE, or NEUTRAL. Reply with one word only.",
    "userMessage": "{{ $json.review }}",
    "includeInput": true,
    "maxConcurrency": 20,
    "options": {
      "temperature": 0,
      "maxOutputTokens": 10,
      "responseFieldName": "sentiment"
    }
  }
}
```

Ask about a file uploaded by an upstream **Gemini File Upload** node, with one safety threshold relaxed. Each safety entry pairs a category with a threshold, so add an entry only for a category you actually want to change:

```json
{
  "type": "gemini_chat",
  "parameters": {
    "systemPrompt": "You are a legal analyst. Answer only from the attached document.",
    "userMessage": "What are the termination clauses in this contract?",
    "fileUris": "{{ $json.fileUri }}",
    "options": {
      "temperature": 0.2,
      "responseFieldName": "contractSummary"
    },
    "safetySettings": {
      "settings": [
        { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_ONLY_HIGH" }
      ]
    }
  }
}
```

### Error Handling

| Mode | Behavior |
|------|----------|
| **stop** | Halts workflow on first error |
| **continue** | Skips failed items, passes successful ones through |
| **errorPort** | Routes failed items to Error output port |

## Tips

Gemini Chat sends user messages to the Google Gemini generateContent API and returns model-generated responses, with model selection across the available Gemini chat models. Use it when your workflow requires Google Gemini inference with control over temperature, maxOutputTokens, topP, topK, system prompts, or safety settings. Each processed item produces an output containing the generated text, finish reason, and token usage metadata.