The Google GenAI SDK.

Provides access to the GenAI features through either the Gemini API or the Vertex AI API.

The GoogleGenAIOptions.vertexai value determines which of the API services to use.

When using the Gemini API, a GoogleGenAIOptions.apiKey must also be set, when using Vertex AI GoogleGenAIOptions.project and GoogleGenAIOptions.location must also be set.

Initializing the SDK for using the Gemini API:

import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({apiKey: 'GEMINI_API_KEY'});

Initializing the SDK for using the Vertex AI API:

import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({
vertexai: true,
project: 'PROJECT_ID',
location: 'PROJECT_LOCATION'
});

Constructors

Properties

caches: Caches
chats: Chats
files: Files
live: Live
models: Models
vertexai: boolean
MMNEPVFCICPMFPCPTTAAATR