> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-docsdy-1782656769-5d7a089.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google integrations

> Integrate with Google using LangChain JavaScript.

LangChain provides integrations with [Google AI Studio](https://aistudio.google.com/) and [Google Cloud Vertex AI](https://cloud.google.com/vertex-ai) through the `@langchain/google` package.

<Info>
  Looking for the older `@langchain/google-genai` or `@langchain/google-vertexai` packages? They are maintained under [long-term support](#legacy-packages) but are no longer recommended for new projects.
</Info>

## Chat models

The [`ChatGoogle`](/oss/javascript/integrations/chat/google) class is the recommended way to access Gemini models (such as `gemini-2.5-pro`, `gemini-2.5-flash`, and `gemini-3.1-pro-preview`) and open models like Gemma. It supports both Google AI Studio and Vertex AI in a single interface

<Tip>
  See [this section for general instructions on installing LangChain packages](/oss/javascript/langchain/install).
</Tip>

<CodeGroup>
  ```bash npm theme={null}
  npm install @langchain/google @langchain/core
  ```

  ```bash yarn theme={null}
  yarn add @langchain/google @langchain/core
  ```

  ```bash pnpm theme={null}
  pnpm add @langchain/google @langchain/core
  ```
</CodeGroup>

Configure your API key:

```bash theme={null}
export GOOGLE_API_KEY=your-api-key
```

```typescript theme={null}
import { ChatGoogle } from "@langchain/google";

const model = new ChatGoogle("gemini-2.5-flash");

const res = await model.invoke([
  ["human", "What would be a good company name for a company that makes colorful socks?"],
]);
```

`ChatGoogle` supports tool calling, structured output, multimodal inputs (images, audio, video), reasoning/thinking, image generation, text-to-speech, and Gemini-specific native tools like Google Search grounding and code execution.

<CardGroup cols={2}>
  <Card title="ChatGoogle" icon="message-chatbot" href="/oss/javascript/integrations/chat/google">
    Full chat model documentation, including setup, invocation, streaming, structured output, and more.
  </Card>

  <Card title="Gemini native tools" icon="tool" href="/oss/javascript/integrations/tools/google">
    Google Search, Code Execution, URL Context, Google Maps, File Search, Computer Use, and MCP servers.
  </Card>
</CardGroup>

### Third-party models on Vertex AI

[Anthropic](/oss/javascript/integrations/chat/anthropic) Claude models are also available through
the [Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude)
platform. See [using Claude on Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude)
for more information about enabling access to the models and the model names to use.

### Postgres vector store (Cloud SQL)

The [PostgresVectorStore](/oss/javascript/integrations/vectorstores/google_cloudsql_pg) module from the
[`@langchain/google-cloud-sql-pg`](https://www.npmjs.com/package/@langchain/google-cloud-sql-pg) package provides a way to use CloudSQL for PostgreSQL to store
vector embeddings.

```bash theme={null}
npm install @langchain/google-cloud-sql-pg @langchain/core
```

## Legacy packages

The following packages are maintained under long-term support for existing users. New projects should use `@langchain/google` instead.

### `@langchain/google-genai`

The `@langchain/google-genai` package provides [`ChatGoogleGenerativeAI`](/oss/javascript/integrations/chat/google_generative_ai) and [`GoogleGenerativeAIEmbeddings`](/oss/javascript/integrations/embeddings/google_generative_ai) for accessing Gemini models through Google AI Studio. This package is built on a deprecated Google SDK and will not receive new features.

```bash theme={null}
npm install @langchain/google-genai @langchain/core
```

### `@langchain/google-vertexai`

The `@langchain/google-vertexai` package provides [`ChatVertexAI`](/oss/javascript/integrations/chat/google_vertex_ai), [`VertexAIEmbeddings`](/oss/javascript/integrations/embeddings/google_vertex_ai), and [`VertexAI`](/oss/javascript/integrations/llms/google_vertex_ai) for Vertex AI on Node.js. It depends on [`@langchain/google-gauth`](#%40langchain%2Fgoogle-gauth) for authentication. This package is superseded by the Vertex AI support built into `@langchain/google` for chat.

```bash theme={null}
npm install @langchain/google-vertexai @langchain/core
```

### `@langchain/google-vertexai-web`

The `@langchain/google-vertexai-web` package provides the same Vertex AI chat, embedding, and LLM classes for browser and Edge runtimes. Install this package (not `@langchain/google-vertexai`) when running in web environments. It depends on [`@langchain/google-webauth`](#%40langchain%2Fgoogle-webauth).

```bash theme={null}
npm install @langchain/google-vertexai-web @langchain/core
```

See the [Vertex AI chat](/oss/javascript/integrations/chat/google_vertex_ai) page for `GOOGLE_WEB_CREDENTIALS` and web import paths.

### `@langchain/google-webauth`

The [`@langchain/google-webauth`](https://github.com/langchain-ai/langchainjs/tree/main/libs/providers/langchain-google-webauth) package provides browser and Edge authentication for legacy Vertex AI integrations. It is installed automatically with `@langchain/google-vertexai-web`—do not install it alongside `@langchain/google-gauth`.

Set service account JSON in `GOOGLE_WEB_CREDENTIALS` (or the deprecated `GOOGLE_VERTEX_AI_WEB_CREDENTIALS`). You can also pass `apiKey` or `authOptions` to the model constructor, or set the `API_KEY` environment variable.

### `@langchain/google-gauth`

The [`@langchain/google-gauth`](https://github.com/langchain-ai/langchainjs/tree/main/libs/providers/langchain-google-gauth) package provides Node.js authentication for legacy Google integrations built on [`@langchain/google-common`](#%40langchain%2Fgoogle-common). It is installed automatically when you add `@langchain/google-vertexai`—you typically do **not** install or import `@langchain/google-gauth` directly.

On Node.js, credentials are resolved in this order:

1. `apiKey` passed to the model constructor
2. `authOptions` passed to the model constructor
3. The `API_KEY` environment variable
4. Service account JSON at the path in `GOOGLE_APPLICATION_CREDENTIALS`
5. Application Default Credentials (for example after `gcloud auth application-default login`, or on Google Cloud)

Do not use `@langchain/google-gauth` and `@langchain/google-webauth` in the same project.

The unified [`@langchain/google`](/oss/javascript/integrations/chat/google) package uses `google-auth-library` directly and does not require `@langchain/google-gauth` or `@langchain/google-webauth`.

### `@langchain/google-cloud-sql-pg`

The [`@langchain/google-cloud-sql-pg`](https://www.npmjs.com/package/@langchain/google-cloud-sql-pg) package provides [`PostgresVectorStore`](/oss/javascript/integrations/vectorstores/google_cloudsql_pg) and [`PostgresLoader`](/oss/javascript/integrations/document_loaders/web_loaders/google_cloudsql_pg) for Cloud SQL for PostgreSQL. It is separate from the Gemini chat packages above.

### `@langchain/google-common`

The [`@langchain/google-common`](https://github.com/langchain-ai/langchainjs/tree/main/libs/providers/langchain-google-common) package provides shared Gemini client abstractions for legacy integrations such as [`@langchain/google-vertexai`](/oss/javascript/integrations/chat/google_vertex_ai). It does not include authorization code and is **not** a stand-alone package—do not install or import it directly.

<Tip>
  To migrate from `@langchain/google-genai` or `@langchain/google-vertexai` to `@langchain/google`, see the [ChatGoogle](/oss/javascript/integrations/chat/google) page for setup instructions. The `ChatGoogle` class provides equivalent functionality with unified access to both Google AI Studio and Vertex AI.
</Tip>

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/providers/google.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
