Skip to content

Latest commit

 

History

History

README.md

JavaScript/TypeScript Quickstarts

Welcome to the JavaScript/TypeScript section of the Gemini Cookbook!

This folder contains code samples and quickstart notebooks designed to help you get up and running with Gemini models using the JavaScript/TypeScript SDK.

While you can explore the code samples directly here, we highly recommend opening them in AI Studio for the best experience. AI Studio lets you experiment with the code interactively without any setup required.

About This Folder

This is a growing collection of fun and practical examples demonstrating how to interact with the Gemini API in JavaScript and TypeScript. We're starting with foundational examples, and more advanced and diverse use cases will be added soon, just like the existing Python examples in the quickstart and examples folders.

Stay tuned, more JavaScript notebooks are on the way!

Table of Contents

Cookbook Description Features Launch Code File
Get Started A comprehensive introduction to the Gemini JS/TS SDK, demonstrating features such as text and multimodal prompting, token counting, system instructions, safety filters, multi-turn chat, output control, function calling, content streaming, file uploads, and using URL or YouTube video context. Explore core Gemini capabilities in JS/TS Open in AI Studio JS Get_Started.js
Counting Tokens Learn how tokens work in Gemini, how to count them, and how context windows affect requests. Includes text, image, and audio tokenization. Token counting, context windows, multimodal tokens Open in AI Studio JS Counting_Tokens.js
Image Output Generate and iterate on images using Gemini’s multimodal capabilities. Learn to use text+image responses, edit images mid-conversation, and handle multiple image outputs with chat-style prompting. Image generation, multimodal output, image editing, iterative refinement Open in AI Studio JS ImageOutput.js
File API Learn how to upload, use, retrieve, and delete files (text, image, audio, code) with the Gemini File API for multimodal prompts. File upload, multimodal prompts, text/code/media files Open in AI Studio JS File_API.js
Audio Demonstrates how to use audio files with Gemini: upload, prompt, summarize, transcribe, and analyze audio and YouTube content. Audio file upload, inline audio, transcription, YouTube analysis Open in AI Studio JS Audio.js
Get Started LearnLM Explore LearnLM, an experimental model for AI tutoring, with examples of system instructions for test prep, concept teaching, learning activities, and homework help. AI tutoring, system instructions, adaptive learning, education Open in AI Studio JS Get_started_LearnLM.js