GitHub - google-gemini/cookbook: Examples and guides for using the Gemini API

GitHub

5 min read Original article โ†—

Welcome to the Gemini API Cookbook

This cookbook provides a structured learning path for using the Gemini API, focusing on hands-on tutorials and practical examples.


Gemini 3.8 Flash: Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows. Get started with the Get Started Colab and the thinking Colab guides.

Omni Flash: The Nano Banana of video editing is here! Learn how to call the model using the interactions API, edit videos with natural language and more here Colab!

๐ŸŒ Nano-Banana 2: Go bananas with our latest image generation model: Nano-Banana 2. Get started here Colab with 512px, thinking, search and image grounding, and a ton of examples!

๐ŸŽถ Lyria 3.5: Channel your inner composer with Lyria 3.5. Get started here Colab with full song generation, image-to-music, and a ton of examples!

Agents API: Create and run your custom agents using the new Antigravity agent Colab!


Navigating the Cookbook

This cookbook is organized into two main categories:

  1. Quick Starts: Step-by-step guides covering both introductory topics ("Get Started Colab") and specific API features.
  2. Examples: Practical use cases demonstrating how to combine multiple features.

We also showcase Demos in separate repositories, illustrating end-to-end applications of the Gemini API.

What's New?

Here are the recent additions and updates to the Gemini API and the Cookbook:

  • Gemini 3.8 Flash: Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows. Learn how to build with the model in the Getting started cookbook Colab.
  • Gemini 3.5 Flash-Lite: The fastest, lowest-cost model in the 3.5 family. Outperforms prior Flash-Lite generations for high-throughput execution. Learn more in the Getting started cookbook Colab.
  • Omni Flash: Get started with conversational video generation and editing using Gemini Omni Flash and the Interactions API in the Omni Flash guide! Colab
  • Agents API: Create and run agents using the Antigravity agent Antigravity agent in a controlled environment.
  • Webhooks: Get real-time notifications for async operations like batch jobs and video generation with the Webhooks quickstart Colab.
  • Inference tiers: Learn how to use the Priority and Flex tiers in the Inference tiers guide Colab to help you balance speed, cost, and reliability.
  • ๐ŸŽถ Lyria 3.5: Convert your ideas into songs Colab with full control over the music structure and more!
  • ๐ŸŒ Nano-Banana 2 & Pro: Use Gemini's native image generation Colab capabilities to edit images with high consistency or generate visual stories. Experience Nano-Banana 2 for high speed or Nano-Banana Pro for 4K qualityโ€”both now with thinking and search grounding!
  • File Search: Discover how to ground generations in your own data in a hosted RAG system with the File Search quickstart Colab.
  • Grounding with Google Maps: Get started using factual geographical data from ๐Ÿ“ Google Maps in your apps! See the Google Maps section of the Grounding Guide Colab.
  • Gemini Robotics-ER 1.5: Learn about this new Gemini model specifically for spatial understanding and reasoning for robotics applications. Colab
  • Gemini Transcribe: Transcribe audio files and live audio streams with word-level timestamps, speaker diarization, custom vocabulary, and smart transcription in the Gemini Transcribe guide! Colab
  • Lyria and TTS: Get started with podcast and music generation with the TTS Colab and Lyria RealTime Colab models.
  • Live API & Live Translation: Get started with the multimodal Live API Colab for low-latency voice/video streaming, or the Live Translation API Colab to translate audio streams in real-time.
  • Recently Added Guides:

1. Quick Starts

The quickstarts section contains step-by-step tutorials to get you started with Gemini and learn about its specific features.

To begin, you'll need:

  1. A Google account.
  2. An API key (create one in Google AI Studio).

We recommend starting with the following:

  • Authentication Colab: Set up your API key for access.
  • Get Started Colab: Get started with Gemini models and the Gemini API, covering basic prompting and multimodal input.

Then, explore the other quickstarts tutorials to learn about individual features:

2. Examples (Practical Use Cases)

These examples demonstrate how to combine multiple Gemini API features or 3rd-party tools to build more complex applications.

3. Demos (End-to-End Applications)

These fully functional, end-to-end applications showcase the power of Gemini in real-world scenarios.

Official SDKs

The Gemini API is a REST API. You can call it directly using tools like curl (see REST examples or the great Postman workspace), or use one of our official SDKs:

Get Help

Ask a question on the Google AI Developer Forum.

The Gemini API on Google Cloud Vertex AI

For enterprise developers, the Gemini API is also available on Google Cloud Vertex AI. See this repo for examples.

Contributing

Contributions are welcome! See CONTRIBUTING.md for details.

Thank you for developing with the Gemini API! We're excited to see what you create.