pipedog is an unofficial community port of Pipecat, not affiliated with Daily.
pipedog
LLM

Google Vertex AI

Gemini models on Vertex AI with GoogleVertexLLMService, authenticated with a service account or Application Default Credentials.

Overview

GoogleVertexLLMService runs Gemini models through Vertex AI instead of the Gemini API. It extends GoogleLLMService, so streaming, tools, thinking, safety settings and grounding work the same way. Only authentication and the endpoint differ.

  • GoogleVertexLLMService: Gemini on Vertex AI, with a Google Cloud project, a location and service account credentials or Application Default Credentials (ADC).

Installation

bun add @pipedog/google
import { GoogleVertexLLMService } from "@pipedog/google/vertex/llm";

Prerequisites

  • A Google Cloud project with the Vertex AI API enabled.
  • A service account with access to Vertex AI, as a key file or a JSON string, or ADC (gcloud auth application-default login, or the attached service account on GCP).
  • The examples read GOOGLE_CLOUD_PROJECT_ID, and GOOGLE_APPLICATION_CREDENTIALS (a key file path) or GOOGLE_CREDENTIALS_JSON (the key itself).

GoogleVertexLLMService

Configuration

Prop

Type

Settings

GoogleVertexLLMService.Settings has the same fields and defaults as GoogleLLMService.Settings: the default model is "gemini-3.6-flash", maxTokens is 4096, and the other settings start as null.

Usage

vertex.ts
import { GoogleVertexLLMService } from "@pipedog/google/vertex/llm";

const llm = new GoogleVertexLLMService({
  credentialsPath: process.env.GOOGLE_APPLICATION_CREDENTIALS ?? "",
  projectId: process.env.GOOGLE_CLOUD_PROJECT_ID ?? "",
  settings: new GoogleVertexLLMService.Settings({
    model: "gemini-3.6-flash",
    systemInstruction: "You are a helpful voice assistant.",
  }),
});

With the service account key as a JSON string:

// A service account key as a JSON string, e.g. from a secret store.
const fromJson = new GoogleVertexLLMService({
  credentials: process.env.GOOGLE_CREDENTIALS_JSON ?? "",
  projectId: process.env.GOOGLE_CLOUD_PROJECT_ID ?? "",
});

With Application Default Credentials and a regional endpoint:

// No credentials option: Application Default Credentials, resolved on the
// first request. Gemini 2.5 models are served from regional endpoints.
const regional = new GoogleVertexLLMService({
  projectId: process.env.GOOGLE_CLOUD_PROJECT_ID ?? "",
  location: "us-east4",
  settings: new GoogleVertexLLMService.Settings({ model: "gemini-2.5-flash" }),
});

Authentication

The service picks credentials in this order:

  1. credentials: a service account key as a JSON string. It is parsed in the constructor.
  2. credentialsPath: the path to a key file, read by the client.
  3. Neither: Application Default Credentials.

All three go to @google/genai as googleAuthOptions with the cloud-platform scope, and google-auth-library inside the SDK loads the key file, finds ADC and refreshes the access token as it expires.

Upstream loads the credentials and refreshes a token in the constructor, so missing ADC fails there with "No valid credentials provided.". Here loading a file, finding ADC and refreshing a token are asynchronous, so they happen on the first request, and missing credentials surface as an error from that request.

Event handlers

The same as GoogleLLMService.

Notes

  • Passing apiKey throws: Vertex AI takes credentials, credentialsPath or ADC.
  • projectId is required. location defaults to "global", the only location that serves the Gemini 3 series. Regional endpoints ("us-east4", "us-central1", ...) serve the Gemini 2.5 series.
  • The Vertex adapter also accepts gs:// file URLs in the context: Vertex reads them through its own IAM.

Runtime notes

RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

Generated from pipecat.runtimes and pipecat.compat in packages/google/package.json: ✅ means the compat smoke test passes on that runtime.

Authentication goes through google-auth-library, which only the Node build of @google/genai supports. GoogleVertexLLMService runs on Bun, Node and Deno, not on Cloudflare Workers. On Workers, use GoogleLLMService with a Gemini API key.

The deprecated upstream model, params and systemInstruction constructor options are not ported; use settings.

pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.

Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).

On this page