Getting Started
Getting Started on Google Cloud is the foundation for moving from a Google Cloud project to working generative AI calls on Vertex AI and Agent Platform: authentication, client setup, model selection, request configuration, response inspection, and cleanup. It spans Gemini text, multimodal, tool use, audio, embeddings, RAG, Vector Search, batch inference, Live API, and related SDK and REST entry points.
Synthesized across 53 notebooks. See the source pages under Notebooks below for line-level grounding.
Most getting-started notebooks follow the same operational spine: create or select a Google Cloud project, enable the required APIs, authenticate, set PROJECT_ID and LOCATION, install the right SDK versions, and initialize a client before making the smallest useful request.
From there, the notebooks branch by workload. Core Gemini examples use the Google Gen AI SDK, REST or cURL, OpenAI-compatible Chat Completions, LangChain, or WebSockets; specialized paths cover image generation, TTS, transcription, embeddings, Vector Search, RAG Engine, batch inference, data analytics agents, Live API audio, logging, evaluation, prompt optimization, and model routing.
The recurring engineering pattern is to make configuration explicit, inspect structured response metadata, handle long-running and streaming operations deliberately, preserve state correctly across turns, and clean up billable resources after tutorials.
Canonical workflow
- Create or select a Google Cloud project, confirm billing where required, and enable the specific APIs used by the notebook, such as Vertex AI, Agent Platform, Text-to-Speech, Speech-to-Text, BigQuery, Cloud Storage, Vector Search, Dataform, or Gemini Data Analytics.
- Authenticate for the runtime: use Colab authentication in notebooks, Application Default Credentials for local development, or project-based Vertex AI authentication; then set PROJECT_ID and LOCATION with environment-variable fallbacks.
- Install or upgrade the required SDKs, such as google-genai, google-cloud-aiplatform, google-cloud-texttospeech, Speech-to-Text clients, LangChain integrations, or OpenAI-compatible libraries, matching notebook version requirements.
- Initialize the appropriate client or endpoint, choosing global or regional locations intentionally based on the feature, model, endpoint, or data residency constraint.
- Start with a minimal text or chat request, then add system instructions, safety settings, generation parameters, structured output schemas, tools, response modalities, media parts, retrieval tools, or audio streaming configuration as needed.
- Inspect the response shape before consuming it: check finish_reason, safety_ratings, usage_metadata, response parts, parsed structured output, grounding metadata, artifacts, task state, or audio/image inline data.
- For stateful, tool, batch, indexing, or live workflows, preserve the required state and lifecycle: chat history, thought signatures, function responses, IAM policy bindings, operation polling, cancellation, backoff, and streaming turn completion.
- Store outputs only when needed and clean up billable resources such as batch jobs, indexes, endpoints, buckets, collections, logging configs, and tutorial data after validation.
Best practices
See Getting Started - Best Practices for the full distilled guide.
- Use a real Google Cloud project with the required APIs enabled before running examples; set PROJECT_ID and LOCATION explicitly or through GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_REGION fallbacks.
- Prefer the Google Gen AI SDK unified interface for Vertex AI projects, and use REST, cURL, OpenAI-compatible Chat Completions, LangChain, or WebSockets when the notebook’s integration path requires that level of control.
- Keep GenerateContentConfig or equivalent request configuration explicit: system_instruction, safety_settings, generation parameters, thinking configuration, response_modalities, response_mime_type, response_schema, tools, and media_resolution should be deliberate.
- Use concise, specific prompts that ask one task at a time; add representative zero-shot, one-shot, or few-shot examples when needed, and state when provided context is the only source of truth.
- Use system instructions to steer behavior, formatting, persona, and task boundaries, but keep persona constraints controlled because they can override other instructions.
- Use streaming for user-facing latency, async calls for higher-throughput applications, batch inference for large non-latency-sensitive workloads, and Live API or WebSockets for bidirectional audio, video, or native audio interaction.
Key models & APIs
- Google Gen AI SDK for Python, google-genai, Vertex AI API and Agent Platform API, including GenerateContent, chat, streaming, count_tokens, compute_tokens, tools, safety settings, and structured output, Gemini API on Vertex AI through REST, cURL, OpenAI-compatible Chat Completions, LangChain, and WebSocket interfaces, gemini-3.5-flash, gemini-3.1-pro-preview, gemini-3.1-flash-lite, gemini-3-flash-preview, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro, gemini-2.5-flash-image, gemini-3.1-flash-image, gemini-3-pro-image, gemini-live-2.5-flash-native-audio and Gemini Live API, gemini-3.1-flash-tts-preview, gemini-2.5-flash-tts, Chirp 3 HD voices, and Cloud Text-to-Speech API, chirp_3 and Speech-to-Text V2, gemini-embedding-001, text-embedding-004, text-embedding-005, Vertex AI Vector Search, Vector Search 2.0, and Vertex AI RAG Engine, Cloud Storage, BigQuery, Dataform, Gemini Data Analytics DataA2AService, and data agent APIs, Vertex AI EvalTask, Prompt Optimizer, Model Optimizer, request-response logging, and Skill Registry
Notebooks (53)
Agents & ADK (4)
- Customizing Memory Topics — Customizes Vertex AI Memory Bank topics for a financial advisor assistant and compares default vs custom extraction.
- Gemini Data Analytics: A2A HTTP API Sample — Calls Gemini Data Analytics DataA2AService over HTTP for agent cards, messages, artifacts, and cancellation.
- Intro to Gemini Data Analytics — Shows REST-based Gemini Data Analytics agents over BigQuery, Looker, or Looker Studio data.
- Intro to Skill Registry — Introduces Skill Registry for creating, ingesting, registering, and semantically retrieving agent skills.
Audio (5)
- Lyria 3 Music Generation — Generates Lyria 3 music tracks, clips, lyrics, and streams with the Google Gen AI SDK.
- Gemini 3.1 Flash Text-to-Speech Generation — Shows Gemini 3.1 Flash TTS generation with voices, languages, speakers, and audio tags.
- Get started with Chirp 3 HD voices using Text-to-Speech — Synthesizes Chirp 3 HD Text-to-Speech audio with online and streaming requests.
- Get started with Chirp 3 Transcription — Uses Chirp 3 with Speech-to-Text V2 for sync, language-auto, diarized batch, and streaming transcription.
- Get started with Gemini-TTS voices using Text-to-Speech — Synthesizes Gemini-TTS speech with Cloud Text-to-Speech and Agent Platform APIs.
Embeddings & Vector Search (2)
- Getting Started with Text Embeddings + Agent Platform Vector Search — Builds text embeddings from Stack Overflow titles and serves semantic search with Vector Search.
- Vector Search 2.0 Public Preview Quickstart — Creates a Vector Search 2.0 movie collection with CRUD, filters, semantic search, and ANN indexes.
Gemini (32)
- Intro to Batch Inference with the Gemini API — Runs Gemini batch inference jobs using Cloud Storage and BigQuery inputs and outputs.
- Using OpenAI libraries with Gemini on Vertex AI — Calls Gemini on Vertex AI through OpenAI Chat Completions with streaming, tools, schemas, caching, and safety.
- Intro to Generating and Executing Python Code with Gemini 3 — Uses Gemini 3.5 Flash code execution to generate, run, inspect, and stream Python results via Vertex AI.
- Intro to Structured Output with the Gemini API — Shows how to make Gemini 2.5 Flash return JSON, enums, and schema-constrained multimodal outputs.
- Migrate from PaLM to Gemini model — Compares PaLM text-bison and gemini-2.5-flash with Vertex AI EvalTask for summarization migration.
- Intro to Function Calling with the Gemini API & Python SDK — Introduces Gemini function calling in Vertex AI with chat tools, mock API responses, and live geocoding.
- Intro to Gemini 2.5 Flash — Introduces Gemini 2.5 Flash on Vertex AI with text, thinking, multimodal, tools, and structured output.
- Intro to Gemini 2.5 Flash-Lite — Introduces Gemini 2.5 Flash-Lite on Vertex AI with prompting, thinking, structured output, search, and code tools.
- Gemini 2.5 Flash Image (Nano Banana 🍌) Generation — Generates and edits images with Gemini 2.5 Flash Image using the Google Gen AI SDK on Agent Platform.
- Intro to Gemini 2.5 Pro — Introduces Gemini 2.5 Pro on Vertex AI using the Google Gen AI SDK for text, multimodal, tools, and reasoning.
- Gemini 3.1 Flash Image (Nano Banana 2 🍌) Generation — Shows Gemini 3.1 Flash Image generation, grounding, video input, and image editing with Google Gen AI SDK.
- Intro to Gemini 3.1 Flash-Lite — Quickstart for Gemini 3.1 Flash-Lite with Google Gen AI SDK on Google Cloud.
- Intro to Gemini 3.1 Pro — Quickstart for Gemini 3.1 Pro on Vertex AI with Google Gen AI SDK API features.
- Intro to Gemini 3.5 Flash — Quickstart for Gemini 3.5 Flash generation, multimodal inputs, tools, grounding, and safety with Google GenAI SDK.
- Intro to Gemini 3 Flash (Preview) — Quickstart for Gemini 3 Flash Preview on Vertex AI with Gen AI SDK features and multimodal/tool examples.
- Gemini 3 Pro Image (Nano Banana Pro 🍌) Generation — Shows how to generate and edit images with Gemini 3 Pro Image using the Google GenAI SDK.
- Getting Started with Chat with Gemini — Shows stateful Gemini chat with Google GenAI SDK and LangChain on Vertex AI.
- REST API — Uses cURL to call Gemini 3.5 Flash on Vertex AI for text, chat, tools, multimodal, and JSON output.
- Getting started with Gemini using Vertex AI in Express Mode — Introduces Gemini on Vertex AI Express Mode using the Google Gen AI SDK.
- Intro to Request and Response Logging with Gemini — Shows how to enable Gemini request-response logging to BigQuery, query logs, and disable logging.
- Introduction to Long Context Window with Gemini on Vertex AI — Demonstrates Gemini long-context text, video, and audio prompts on Vertex AI with token counting.
- Getting Started with Model Optimizer — Introduces Vertex AI Model Optimizer routing with Google Gen AI SDK prompts and function calls.
- Getting Started with the Live API Native Audio — Connects to Gemini Live API native audio with proactive chime-in and affective dialog examples.
- Getting Started with Gemini Live API using WebSocket — Uses Gemini Live API over WebSocket for text, audio, video, tools, and native audio features.
- Gemini Live API Quickstart — Connects to Gemini Live API for bidirectional audio streaming with Gen AI SDK and raw WebSockets.
- Getting Started with LangChain 🦜️🔗 + Gemini API in Vertex AI — Introduces LangChain with Gemini on Vertex AI for prompts, embeddings, retrieval, memory, and chains.
- Prompt Design - Best Practices — Demonstrates prompt design best practices for Gemini on Vertex AI with google-genai.
- Get Started with Vertex AI Prompt Optimizer — Shows zero-shot and data-driven prompt optimization with Vertex AI Prompt Optimizer.
- Intro to Building a Scalable and Modular RAG System with RAG Engine in Vertex AI — Builds a Vertex AI RAG Engine corpus, imports files, retrieves context, and grounds Gemini or Llama responses.
- Responsible AI with Gemini API in Vertex AI: Safety ratings and thresholds — Shows how to inspect Gemini safety ratings and set stricter safety thresholds in Vertex AI.
- Intro to thought signatures with REST API — Shows how to pass Gemini thought signatures through REST function-calling turns.
- Intro to Url Context — Shows how to use Gemini URL context to summarize, compare, and analyze web pages with optional Google Search grounding.
Open Models (1)
- Import, Deploy, and Serve custom open models on Vertex AI using Vertex AI Model Garden SDK. — Imports Hugging Face open-model weights to GCS, deploys them on Vertex AI, and serves predictions.
SDK (2)
- Getting started with Google Generative AI using the Gen AI SDK — Introduces Google Gen AI SDK on Vertex AI for Gemini prompts, tools, caching, batches, and embeddings.
- Configuring Retries in the Gen AI SDK — Configures Google Gen AI SDK HTTP retries for Gemini calls at client and request level.
Vertex AI Search (2)
- Intro to Gemini Enterprise — Shows how to call Gemini Enterprise search and answer APIs with the Discovery Engine Python SDK.
- Ingestion of Unstructured Documents with Metadata in Vertex AI Search — Ingests PDFs with metadata into Vertex AI Search and queries results with metadata filters.
Translation (1)
- Getting Started with Translation — Translates English text to Spanish with Cloud Translation API and a Cloud Storage-backed glossary.
Vision (4)
- Imagen 3 Image Editing — Edits images with Imagen 3 using inpainting, background swap, outpainting, and mask-free prompts.
- Imagen 4 Image Upscale — Shows how to upscale generated, local, and Cloud Storage images with Imagen 4 using google-genai.
- Veo 3.1 Reference to Video — Generates Veo 3.1 videos from reference images using the Google Gen AI SDK.
- Virtual Try-On: Image Generation — Uses Google Gen AI SDK to generate virtual try-on images from local and Cloud Storage clothing images.
Related concepts
- Gemini Capabilities · Function Calling & Tools · Audio & Speech · RAG & Grounding · Image & Video Generation · Applied Use Cases · Prompt Engineering · Embeddings & Vector Search
Part of the Generative AI Google Brain · Getting Started - Best Practices