Skip to main content
Google AI for Developers
/
  • English
  • Deutsch
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Shqip
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
Sign in
Google AI for Developers
  • Gemini API
Gemini 2.5 Flash Image (aka Nano Banana) is now available in the Gemini API! Learn more
  • Home
  • Gemini API

Gemini API cookbook

A collection of guides and examples for the Gemini API. Explore more in the Gemini API Cookbook on GitHub.

Quickstart in Python

Audio Quickstart

How to prompt Gemini 1.5 Pro using an audio file.

Authentication

Authentication Quickstart

Create an API key and use it with the Python SDK or a command line tool like curl.

OAuth

OAuth Quickstart

A simplified approach to using OAuth for authentication.

Tokens

Tokens Quickstart

An interactive introduction to tokens and how they are used in the Gemini API.

Embeddings

Embeddings Quickstart

Quick code examples that show how to get started generating embeddings.

File API

File API Quickstart

Use the File API to upload a media file and include it in a GenerateContent call.

Function Calling

Function Calling

Code examples to help you get started with function calling.

Function Calling Config

Function Calling Config

A guide for those already familiar with function calling.

Prompting

Prompting Quickstart

How to write and run your first prompts with the Gemini API.

Safety

Safety Quickstart

How to use them the Gemini API adjustable safety settings.

Streaming

Streaming Quickstart

This notebook demonstrates streaming in the Python SDK.

System Instructions

System instructions

How to provide a system instruction when generating content.

System Instructions

Tuning Quickstart

How to get started with model tuning.

System Instructions

Prompting with Video

Quick example of how to prompt Gemini 1.5 Pro using a video file.

Quickstart in Rest

Embeddings

Embedding Quickstart

How to get started generating embeddings using curl.

Function Calling

Function calling

Quick code examples that show how to get started with function calling using curl.

JSON Mode

JSON Mode Quickstart

A code example that shows you how to get started with JSON mode using curl.

Prompting

Prompting Quickstart

Try out the Gemini API using curl commands to call the methods in the REST API.

Safety

Safety Quickstart

How to use adjustable safety settings with REST.

Streaming

Streaming Quickstart

This notebook demonstrates streaming in REST.

System Instructions

System instructions

How to get started with system instructions using curl.

Code examples

Anomaly Detection

Anomaly detection

Use the embeddings from the Gemini API to detect potential outliers in your dataset.

Text Classification

Classify text

Use embeddings to train a model to classify posts based on the topic.

Multi-Image Prompting

Guess the shape

How to use multiple images in the same prompt with the Gemini API.

Marketing Campaign Generation

Marketing campaign

Analyze a product sketch and create a marketing campaign & taglines in JSON format.

ReAct Model

Search Wikipedia using ReAct

Minimal implementation of ReAct: Synergizing Reasoning and Acting in Language Models

Search Re-ranking

Search re-ranking using Gemini embeddings

Use embeddings to re-rank search results.

Story Writing with Prompt Chaining

Generation for Story Writing

How to write a story using prompt chaining and iterative generation.

Document search with embeddings

Use the Gemini API to create embeddings so that you can perform document search.

  • Terms
  • Privacy
  • Manage cookies
  • English
  • Deutsch
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Polski
  • Português – Brasil
  • Shqip
  • Tiếng Việt
  • Türkçe
  • Русский
  • עברית
  • العربيّة
  • فارسی
  • हिंदी
  • বাংলা
  • ภาษาไทย
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어