Gemini API: Qwik Start

实验 15 分钟 universal_currency_alt 1 积分 show_chart 入门级
info 此实验可能会提供 AI 工具来支持您学习。
此内容尚未针对移动设备进行优化。
为获得最佳体验,请在桌面设备上访问通过电子邮件发送的链接。

GSP1308

Google Cloud self-paced labs logo

Overview

The Gemini API empowers developers and creators across various fields by providing advanced natural language processing and code generation capabilities. It enables the creation of intelligent chatbots, automated content generation tools, insightful data analysis platforms, and personalized learning experiences. Its versatility stems from its ability to understand context, generate creative text, analyze complex data, and adapt to diverse applications.

There are two Gemini models, Gemini Pro and Gemini Flash. In this lab, you will use the model.

Prerequisites

Before starting this lab, you should be familiar with:

  • Basic Python programming.
  • General API concepts.
  • Running Python code in a Jupyter notebook on Vertex AI Workbench.

Objectives

In this lab, you will learn how to:

  • Set up and authenticate the Gemini API.
  • Make basic API calls to interact with Gemini models.

Task 1. Set your API Key

  1. In the Jupyter Notebook, copy the below API key into API_KEY variable.
{{{project_0.startup_script.api_key|"API KEY"}}}

Task 2. Run through the notebook cells

  1. Once you have set your API_KEY variable, please replace the __GEMINI_FLASH_MODEL_ID__ placeholder in the notebook with and follow instructions directly in the Jupyter Notebook.
Note: API calls to Gemini require processing time. Please allow a moment for the response to appear after executing a notebook cell.

Click Check my progress to verify the objective. Generate Text from the Gemini API.

Click Check my progress to verify the objective. Multi-Turn Conversations.

Congratulations!

Congratulations! In this lab, you learned how to use the Gemini API and make basic API calls to interact with Gemini models.

Next steps / learn more

Check out the following resources to learn more about Gemini:

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated October 07, 2025

Lab Last Tested October 07, 2025

Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

准备工作

  1. 实验会创建一个 Google Cloud 项目和一些资源,供您使用限定的一段时间
  2. 实验有时间限制,并且没有暂停功能。如果您中途结束实验,则必须重新开始。
  3. 在屏幕左上角,点击开始实验即可开始

使用无痕浏览模式

  1. 复制系统为实验提供的用户名密码
  2. 在无痕浏览模式下,点击打开控制台

登录控制台

  1. 使用您的实验凭证登录。使用其他凭证可能会导致错误或产生费用。
  2. 接受条款,并跳过恢复资源页面
  3. 除非您已完成此实验或想要重新开始,否则请勿点击结束实验,因为点击后系统会清除您的工作并移除该项目

此内容目前不可用

一旦可用,我们会通过电子邮件告知您

太好了!

一旦可用,我们会通过电子邮件告知您

一次一个实验

确认结束所有现有实验并开始此实验

使用无痕浏览模式运行实验

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.