> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Gemini

> Use the Google Gemini LLM plugin in a Zero Runtime pipeline. Setup, options, and usage in Python and JavaScript.

Google Gemini is an **LLM** plugin. It takes the transcribed conversation and generates
the reply.

## Setup

Set your Google API key in the worker environment. Generate a key from the [Google AI Studio](https://aistudio.google.com/apikey):

```bash theme={null}
export GOOGLE_API_KEY=<key>
```

## Usage

Import the plugin and pass it to the pipeline's `llm` slot.

<CodeGroup>
  ```python Python theme={null}
  from zeroruntime.plugins import GoogleLLM

  llm = GoogleLLM(
      model="gemini-3.5-flash",
      thinking_budget=0,
      include_thoughts=False,
      max_output_tokens=8192,
  )

  # Pipeline(llm=llm, ...)
  ```

  ```typescript Node JS theme={null}
  import { GoogleLLM } from '@zeroruntime/js-sdk/plugins';

  const llm = GoogleLLM({
    model: 'gemini-3.5-flash',
    thinking_budget: 0,
    include_thoughts: false,
    max_output_tokens: 8192,
  });

  // Pipeline({ llm, ... })
  ```
</CodeGroup>

## Vertex AI

By default the plugin calls the public Gemini API with `GOOGLE_API_KEY`. To run Gemini
through **Vertex AI** instead, enable the Vertex backend and supply your Google Cloud
project and location. Authenticate with a service account. Set `GOOGLE_APPLICATION_CREDENTIALS`:

```bash theme={null}
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
```

<CodeGroup>
  ```python Python theme={null}
  from zeroruntime.plugins import GoogleLLM

  llm = GoogleLLM(
      model="gemini-3.5-flash",
      vertexai=True,
      project_id="your-gcp-project-id",
      location="us-central1",
  )

  # Pipeline(llm=llm, ...)
  ```

  ```typescript Node JS theme={null}
  import { GoogleLLM } from '@zeroruntime/js-sdk/plugins';

  const llm = GoogleLLM({
    model: 'gemini-3.5-flash',
    vertexai: true,
    vertexai_config: {
      project_id: 'your-gcp-project-id',
      location: 'us-central1',
    },
  });

  // Pipeline({ llm, ... })
  ```
</CodeGroup>

<Note>
  `location` defaults to `us-central1` in all SDKs. In Python, `project_id` is required when
  `vertexai=True` and must be passed explicitly. Node JS carries the same two settings inside
  `vertexai_config`.
</Note>

## Configuration Options

*Constructor parameters for `GoogleLLM`. The Python and Node JS SDKs share these field names.*

### Core

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `"gemini-3.5-flash-lite"` | Gemini model used to generate replies. |
| `api_key` | `str` | `None` | Google API key. Falls back to the `GOOGLE_API_KEY` environment variable when unset. |
| `temperature` | `float` | `0.7` | Sampling randomness; lower is more deterministic. |
| `max_output_tokens` | `int` | `8192` | Caps the length of each reply. |
| `top_p` | `float` | `None` | Nucleus-sampling probability cutoff. |
| `top_k` | `int` | `None` | Top-k sampling cutoff. |
| `presence_penalty` | `float` | `None` | Penalizes tokens already present, encouraging new topics. |
| `frequency_penalty` | `float` | `None` | Penalizes frequent tokens, reducing repetition. |

### Generation knobs

| Parameter | Type | Default | Description |
| - | - | - | - |
| `seed` | `int` | `None` | Seed for reproducible sampling. |

### Vertex AI

| Parameter | Type | Default | Description |
| - | - | - | - |
| `vertexai` | `bool` | `False` | Route requests through Vertex AI instead of the Gemini API. |
| `project_id` | `str` | `None` | Google Cloud project ID. Required when `vertexai` is enabled. |
| `location` | `str` | `"us-central1"` | Vertex AI regional endpoint used when `vertexai` is enabled. |
| `service_account_json` | `str \| dict` | `None` | Service-account credentials as a JSON string or dict, used for Vertex AI authentication. |
| `service_account_path` | `str` | `None` | Path to a service-account JSON key file. Falls back to the `GOOGLE_APPLICATION_CREDENTIALS` environment variable. |

### Safety

| Parameter | Type | Default | Description |
| - | - | - | - |
| `safety_settings` | `list` | `None` | Content-safety thresholds. |

### Extended thinking

| Parameter | Type | Default | Description |
| - | - | - | - |
| `thinking_budget` | `int` | `0` | Tokens the model may spend reasoning. `0` disables it for lower latency. |
| `include_thoughts` | `bool` | `False` | Include the model's reasoning in the output. |

<Tip>
  For voice, short replies feel best. A zero or small thinking budget and a concise system
  instruction keep latency down.
</Tip>

## Import paths

| SDK | Import | Constructor |
| - | - | - |
| Python | `from zeroruntime.plugins import GoogleLLM` | `GoogleLLM(...)` |
| Node JS | `import { GoogleLLM } from '@zeroruntime/js-sdk/plugins'` | `GoogleLLM({ ... })` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.