googleapis/js-genai

TypeScript/JavaScript SDK for Gemini and Vertex AI.

What it solves

The Google Gen AI SDK provides a unified way for TypeScript and JavaScript developers to integrate Gemini models into their applications. It bridges the gap between your code and Google's AI services, handling the complexities of API communication, authentication, and data management.

How it works

The SDK uses a central GoogleGenAI class to manage connections to either the Gemini Developer API or the Gemini Enterprise Agent Platform. It organizes features into logical modules: models for generating content, chats for multi-turn conversations, files for managing large uploads, and interactions for complex, stateful tasks like research agents. It supports streaming responses, custom function calling to link AI with external systems, and experimental integration with the Model Context Protocol (MCP).

Who it’s for

This SDK is for developers building AI-powered applications in Node.js or browser environments who need to interact with Gemini models. It is suitable for both quick prototyping using simple API keys and enterprise-grade applications requiring Google Cloud authentication and regional endpoints.

Highlights

  • Unified interface for both Gemini Developer API and Gemini Enterprise Agent Platform.
  • Built-in support for streaming responses to improve application responsiveness.
  • Advanced tools for function calling, allowing models to interact with external systems.
  • Automatic continuation for long-form content generation.
  • Experimental support for the Model Context Protocol (MCP) to connect with external data sources.
  • Dedicated Interactions API for managing complex, stateful, and long-running AI tasks.

Related

  • Project
  • Project
  • Project
  • Project
  • Project