PACKAGE · API

@google/genai

[![NPM Downloads](https://img.shields.io/npm/dw/%40google%2Fgenai)](https://www.npmjs.com/package/@google/genai) [![Node Current](https://img.shields.io/node/v/%40google%2Fgenai)](https://www.npmjs.com/package/@google/genai)

WEEKLY DOWNLOADS 34.6M
STARS 1.7K
FORKS 300
OPEN ISSUES 188
GZIP SIZE 88.4 kB
UNPACKED SIZE 13.5 MB
DEPENDENCIES 3
LAST UPDATED 7mo ago
DOWNLOAD TRENDS

@google/genai downloads · last 12 months

Download trends for @google/genai1 download series from Nov 2025 to Oct 2026. Use left and right arrow keys to inspect monthly values.028.2M56.3M84.5M112.6MNov 2025FebMayAugOct 2026
@google/genai
ABOUT @GOOGLE/GENAI

The @google/genai package is Google’s JavaScript and TypeScript SDK for accessing Gemini models through the Gemini API. It gives applications a client interface for sending model requests and receiving generated results, so developers can integrate Gemini capabilities without constructing the service’s HTTP requests and response handling themselves.

The SDK is designed for developers building Google AI features into JavaScript or TypeScript applications. Its purpose is to provide a package-level interface to the Gemini API; it is not a model runtime or a replacement for choosing, configuring, and operating an application’s own backend and user experience.

A typical integration creates a Google Gen AI client and uses its model-generation methods to submit prompts and process responses. Keep credentials on a trusted server rather than exposing them in browser code, and check the package’s current documentation for exact method names, supported options, and model capabilities, which can change as the API evolves.

The npm package can fit into Node.js services and other JavaScript or TypeScript workflows that need to call Gemini. Integrations can sit behind an application’s own API routes or service layer, where developers can control authentication, input validation, error handling, and how generated content reaches a user interface.

The supplied package information lists version 3.6.1, an Apache-2.0 license, a gzip bundle size of 88.4 kB, and an unpacked size of 13.5 MB. Those figures offer a useful distribution reference, but the actual impact in an application depends on how the SDK is used and packaged; verify the current Node.js compatibility information before deployment.

The package listing also reports 201 open issues and a last-updated date of 2026-11-18, so check release notes and issue status when selecting a version or investigating behavior. Treat model availability, request limits, and API-specific behavior as service concerns, and design callers to handle failures rather than assuming every generation request succeeds.

WHEN TO USE
  • When a Node.js or TypeScript service needs to send prompts to Gemini through Google’s JavaScript SDK; create the Gen AI client in a server-side service layer.
  • When adding Gemini-generated text to an application; route model-generation requests through the SDK and handle returned content in your own application logic.
  • When centralizing Gemini access behind application API routes; keep credentials and request validation on the server while using @google/genai for API calls.
  • When integrating model requests into an existing JavaScript or TypeScript workflow; use the package as the client boundary between application code and the Gemini API.
  • When evaluating a Google AI integration with known package metadata; use the listed 3.6.1 version, Apache-2.0 license, and 88.4 kB gzip bundle figure as reference points, then verify current release details.
WHEN NOT TO USE
  • If the application must run model inference locally without calling Google’s Gemini API, use a local inference runtime or another service designed for that requirement; this SDK is for API access.
  • If browser code would need to contain a confidential API credential, do not call the SDK from that browser context; put requests behind a trusted server-side endpoint.
  • If the project targets a runtime that does not meet the package’s current Node.js requirements, choose a compatible client or runtime and verify compatibility before installing this version.
  • If the application requires a model provider other than Gemini, use that provider’s API client or a provider-neutral integration layer instead of coupling requests to @google/genai.
  • If the required model capability or request option is not documented for the SDK version being used, verify the current API and package documentation first; use a supported endpoint or an explicitly maintained HTTP integration if needed.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 5
@google/genai vs graphql ★ 20.3K · 73.2M/wk @google/genai vs @trpc/server ★ 40.9K · 8.3M/wk @google/genai vs msw ★ 18.4K · 35.5M/wk @google/genai vs googleapis ★ 12.3K · 13.1M/wk @google/genai vs openapi-typescript ★ 8.4K · 17.9M/wk