The package you want is @google/genai
The official TypeScript/JavaScript SDK is @google/genai (note the slash — npm scoped package). It replaces @google/generative-ai, which reached EOL in August 2025. Requires Node.js ≥ 20.
One class to construct
The entry point is GoogleGenAI. Three construction patterns mirror the Python SDK:
new GoogleGenAI({ apiKey: '...' })— explicit key.new GoogleGenAI({})— readsGOOGLE_API_KEYfrom env (Node.js).new GoogleGenAI({ vertexai: true, project: '...', location: '...' })— Vertex AI.
Submodules
The constructed ai object exposes the same surfaces as the Python client:
ai.models— generate, stream, count tokens.ai.chats— multi-turn chat.ai.files— File API uploads.ai.caches— context caching.ai.live— live multimodal sessions.
Helper imports you'll use a lot
The package also exports schema helpers and content factories:
Type— schema type enum (Type.STRING,Type.OBJECT, etc.).createUserContent,createPartFromUri— multimodal content builders.FunctionCallingConfigMode—AUTO,ANY,NONE.ApiError— the exception class.