Skip to main content

Google Gemini LLM

GoogleLLM plugs Google Gemini chat models into Patter’s pipeline mode via the Generative Language API. Streams normalise to Patter’s unified {type: "text" | "tool_call" | "done"} chunk protocol, and Gemini function_call parts map directly onto Patter tools.
This page covers Google Gemini in chat-completions mode for the pipeline (STT → LLM → TTS). For Gemini’s bidirectional speech-to-speech engine, see the separate gemini-live adapter under Engines.

Install

Usage

The namespaced import (import * as google from "getpatter/llm/google" / from getpatter.llm import google) auto-resolves the API key from GEMINI_API_KEY first, then GOOGLE_API_KEY for parity with other SDKs, and exposes a uniform LLM class.
Plug it into an agent:

Supported models

Pricing in USD per 1M tokens. For the speech-to-speech variant gemini-live-2.5-flash-native-audio (input 0.30/output0.30 / output 2.50), see the Engines page — it is a separate Realtime adapter, not a chat-completions model.

Environment variables

Options

Vertex AI is currently only exposed in the Python SDK (vertexai=True, project=..., location=...). The TypeScript adapter targets the Developer API; Vertex AI parity is on the roadmap.

Function calling

Gemini’s function_call parts map directly onto Patter tools — define a tool once and it works on every LLM provider. Patter assigns a monotonically increasing index per function_call part since Gemini does not provide a stable per-call index across stream chunks. Token usage is collected from usage_metadata (cumulative on each chunk; only the last value is yielded as a usage event to avoid double-counting).