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

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

# Gemini Batch

> Process multiple Gemini requests in a batch.

## Overview

Gemini Batch uses the Google Gemini batchGenerateContent endpoint to process multiple content generation requests in a single synchronous API call. Unlike OpenAI and Anthropic batch APIs which are asynchronous, Gemini batch is synchronous — it sends all requests at once and receives all responses in a single response. Each input item becomes one request in the batch. Individual responses are matched back to their input items.

**Category:** AI  
**Tool Name:** `gemini_batch`  
**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 batch requests. 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 | — | System instructions applied to all batch requests. Supports expressions. |
| File URIs | `string` | No | — | Optional. fileUri value(s) from the Gemini File Upload tool, attached to every batch request. Pass a single URI or a JSON array. Per-item override: include a "fileUris" field on the input item. Gemini File API retains uploads for 48 hours. Supports expressions. |
| Options | `collection` | No | `{}` | Optional generation and output settings — add only the fields you need. |
| — Temperature | `number` | No | `1` | Sampling temperature (0-2). Lower values make output more focused. |
| — Max Output Tokens | `number` | No | `4096` | Maximum number of tokens per response. |
| — Response Field Name | `string` | No | `batch` | Field name in the output JSON where the extracted response text will be placed. Do not use "response" — the raw API response object is always written to that key and would overwrite the extracted text. |
| Include Input | `boolean` | No | `false` | Whether to include the original input item fields in the output. |
| Max Concurrency | `number` | No | `5` | Maximum number of items to process concurrently. |

## Output Data

Every input item becomes one request in a single batch call, and one output item comes back per input item. The generated text lands on the field named by **Response Field Name** (`batch` by default), with the raw API response and the item's position in the batch 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
{
  "batch": "The generated text for this item",
  "response": "the raw Gemini response object for this request",
  "model": "the model that produced the responses",
  "finishReason": "the API's reason for ending generation",
  "usage": { "promptTokenCount": 128, "candidatesTokenCount": 256 },
  "batchIndex": 0,
  "totalRequests": 25
}
```

- **Each item supplies its own prompt.** There is no user-message parameter on this node: the prompt is read from the item's `message`, `prompt` or `text` field, in that order. Put it there with an upstream **Edit Fields** node.
- An item carrying none of those three fields is still returned, with the response field set to `null`, `status: "skipped"` and a `reason` saying no message, prompt or text field was found. If no item in the run carries a prompt, every item comes back with `status: "empty"` instead.
- `response` always holds the raw Gemini response for that request, so do not set **Response Field Name** to `response` — the raw object would overwrite the extracted text.
- `batchIndex` is the item's position within the batch and `totalRequests` is how many requests were sent, which is what to log when reconciling a large run.
- `usage` is the per-request token accounting, present only when the API reported it.

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

## Usage Examples

- Process 100 prompts in a single Gemini batch call
- Translate multiple texts using Gemini batch
- Generate summaries for a dataset in one API call
- Bulk classify content using Gemini batch
- Run batch content generation with a system prompt

## Example Configuration

Summarize every incoming item — each item must carry its prompt on `message`, `prompt` or `text`:

```json
{
  "type": "gemini_batch",
  "parameters": {
    "systemPrompt": "Summarize the following text in 2-3 sentences.",
    "includeInput": true,
    "maxConcurrency": 10,
    "options": {
      "temperature": 0.4,
      "maxOutputTokens": 256,
      "responseFieldName": "summary"
    }
  }
}
```

High-throughput classification with deterministic output:

```json
{
  "type": "gemini_batch",
  "parameters": {
    "systemPrompt": "Classify the sentiment of the input as POSITIVE, NEGATIVE, or NEUTRAL. Reply with only the label.",
    "includeInput": false,
    "maxConcurrency": 20,
    "options": {
      "temperature": 0,
      "maxOutputTokens": 16,
      "responseFieldName": "sentiment"
    }
  }
}
```

Ask a batch of questions against one uploaded document:

```json
{
  "type": "gemini_batch",
  "parameters": {
    "systemPrompt": "Answer each question using only the attached document. Reply in one sentence.",
    "fileUris": "{{ $json.fileUri }}",
    "includeInput": true,
    "options": {
      "responseFieldName": "answer"
    }
  }
}
```

### 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 Batch sends multiple content generation requests to the Google Gemini batchGenerateContent endpoint in a single synchronous API call. Use it when you need to process a list of prompts or inputs together and want all results returned at once without managing asynchronous job polling. It produces matched response objects on the main output for each successful input item and routes failures to the error output.