GitHub
github.com › googleapis › js-genai
GitHub - googleapis/js-genai: TypeScript/JavaScript SDK for Gemini and Vertex AI. · GitHub
April 25, 2026 - TypeScript/JavaScript SDK for Gemini and Vertex AI. - googleapis/js-genai
Starred by 1.6K users
Forked by 251 users
Languages TypeScript 94.3% | JavaScript 5.1% | HTML 0.3% | Shell 0.2% | Starlark 0.1% | CSS 0.0%
Google
docs.cloud.google.com › gemini enterprise agent platform › google gen ai sdk
Google Gen AI SDK | Gemini Enterprise Agent Platform | Google Cloud Documentation
import ( "context" "fmt" "io" "google.golang.org/genai" ) // generateWithText shows how to generate text using a text prompt. func generateWithText(w io.Writer) error { ctx := context.Background() client, err := genai.NewClient(ctx, &genai.ClientConfig{ HTTPOptions: genai.HTTPOptions{APIVersion: "v1"}, }) if err != nil { return fmt.Errorf("failed to create genai client: %w", err) } resp, err := client.Models.GenerateContent(ctx, "gemini-2.5-flash", genai.Text("How does AI work?"), nil, ) if err != nil { return fmt.Errorf("failed to generate content: %w", err) } respText := resp.Text() fmt.Fprintln(w, respText) // Example response: // That's a great question! Understanding how AI works can feel like ... // ... // **1. The Foundation: Data and Algorithms** // ... return nil } The Google Gen AI SDK for TypeScript and JavaScript is available on npm and GitHub: @google/genai on npm ·
Videos
05:41
How to use Gemini Gen AI SDK using Typescript - YouTube
44:05
Gemini function calling using Google AI SDK in Typescript - YouTube
04:52
Getting started with the Google Gemini API in TypeScript - YouTube
56:02
Scripting with AI Support: GenAI TypeScript - YouTube
Apidog
apidog.com › blog › how-to-use-the-google-gen-ai
How to Use the Google Gen AI TypeScript/JavaScript SDK ...
January 30, 2026 - import { GoogleGenAI } from '@google/genai'; const GEMINI_API_KEY = process.env.GEMINI_API_KEY; // Or your actual API key const ai = new GoogleGenAI({ apiKey: GEMINI_API_KEY }); async function run() { // Example: Generate text content const model = ai.models.generateContent({ model: "gemini-pro", // Or a specific Gemini 2.5 model like "gemini-2.5-flash-001" contents: [{ role: "user", parts: [{ text: "Explain the significance of the Google Gen AI SDK."
npm
npmjs.com › package › @google › genai › v › 0.3.1
Google Gen AI SDK for TypeScript and JavaScript
March 11, 2025 - The Google Gen AI JavaScript SDK is an experimental SDK designed for TypeScript and JavaScript developers to build applications powered by Gemini.
» npm install @google/genai
Published Jun 03, 2026
Version 0.3.1
npm
npmjs.com › package › @google › genai
google/genai
1 week ago - Documentation: https://googleapis.github.io/js-genai/ The Google Gen AI JavaScript SDK is designed for TypeScript and JavaScript developers to build applications powered by Gemini.
» npm install @google/genai
Published Jun 24, 2026
Version 2.10.0
GitHub
github.com › mohitejaikumar › generative-ai-js
GitHub - mohitejaikumar/generative-ai-js: The official Node.js / Typescript library for the Google Gemini API · GitHub
The official Node.js / Typescript library for the Google Gemini API - mohitejaikumar/generative-ai-js
Author mohitejaikumar
Hugging Face
huggingface.co › blog › lynn-mikami › google-gen-ai-sdk
How to Use the Google Gen AI TypeScript/JavaScript SDK: A Comprehensive Guide
May 27, 2025 - import {GoogleGenAI} from '@google/genai'; // Ensure your API key is set as an environment variable const GEMINI_API_KEY = process.env.GEMINI_API_KEY; const ai = new GoogleGenAI({apiKey: GEMINI_API_KEY}); async function main() { try { const response = await ai.models.generateContent({ model: 'gemini-2.0-flash-001', // Or your desired model contents: 'Why is the sky blue?', }); // Assuming response.text is the correct way to access the text based on SDK structure // The actual response structure might be response.candidates[0].content.parts[0].text // For simplicity, we'll refer to a conceptual 'response.text' as per the README's quickstart.
DEV Community
dev.to › asross311 › taming-the-interactions-api-in-the-googlegenai-sdk-561b
Taming the Interactions API in the @google/genai SDK - DEV Community
December 25, 2025 - Google released beta support for a new Interactions API on 2025-12-11, described as "a unified interface for interacting with Gemini models and agents". The latest @google/genai SDK (v1.34.0 as of writing) surfaces this beta API, unlocking preview support for Deep Research tasks with background polling. There's just one problem: you can't use it safely or sanely in TypeScript.
npm
npmjs.com › package › @zdooon › google-genai
@zdooon/google-genai - npm
November 27, 2025 - The Google Gen AI JavaScript SDK is designed for TypeScript and JavaScript developers to build applications powered by Gemini. The SDK supports both the Gemini Developer API and Vertex AI.
» npm install @zdooon/google-genai
Published Nov 27, 2025
Version 1.30.0
GitHub
github.com › googleapis › js-genai › blob › main › codegen_instructions.md
js-genai/codegen_instructions.md at main · googleapis/js-genai
TypeScript/JavaScript SDK for Gemini and Vertex AI. - js-genai/codegen_instructions.md at main · googleapis/js-genai
Author googleapis
GitHub
github.com › smartground › google-genai-sdk-js
GitHub - smartground/google-genai-sdk-js: TypeScript/JavaScript SDK for Gemini and Vertex. [EXPERIMENTAL]
import {GoogleGenAI} from '@google/genai'; const GEMINI_API_KEY = process.env.GEMINI_API_KEY; const ai = new GoogleGenAI({apiKey: GEMINI_API_KEY}); async function main() { const response = await ai.models.generateContent({ model: 'gemini-2.0-flash-001', contents: 'Why is the sky blue?', }); console.log(response.text); } main();
Author smartground
Medium
medium.com › google-cloud › how-to-build-genai-apps-for-resilience-with-typescript-06908aca62c2
How to build GenAI apps for resilience with TypeScript | by Karl Weinmeister | Google Cloud - Community | Medium
March 2, 2026 - Here’s how you configure the SDK natively in TypeScript. First, initialize the client once outside the request handler so you can reuse connection pools: import { GoogleGenAI } from '@google/genai'; export const aiClient = new GoogleGenAI({ vertexai: true, project: process.env.GOOGLE_CLOUD_PROJECT_ID, location: 'global', httpOptions: { // Rely on the SDK's built-in retry logic retryOptions: { attempts: 5, }, timeout: 120 * 1000, }, });
Google
developers.google.com › solutions › getting started with the gemini api and web apps
Getting started with the Gemini API and Web apps | Solutions for Developers | Google for Developers
The Google Gen AI SDK for JavaScript and TypeScript enables you to build your generative AI integration with the Gemini Developer API.
Google Cloud
cloud.google.com › vertex ai › generative ai on vertex ai › typescript migration
Typescript migration | Generative AI on Vertex AI | Google Cloud Documentation
Translate JavaScript to TypeScript · You can query a model directly and test the results returned when using different parameter values with the Cloud console, or by calling the Vertex AI API directly. For an example of using the Vertex AI API, see Quickstart using the Vertex AI API.