Replit Agent
Collaboration
Deployments
App Builder
Website Builder
Game Builder
Dashboard Builder
Chatbot Builder
Product Managers
Designers
Operations
Software Engineers
IT
SMB Owners
DevRel
Founders
TeamsPricingBlogCareers
Contact salesLog inSign up
  • Teams
  • Pricing
  • Blog
  • Careers
Contact salesLog in
Start building
GuidesQuickstart guidesGemini 1.5 Flash Quickstart Guide

Gemini 1.5 Flash Quickstart Guide

A guide by
Image of The Replit TeamThe Replit Team
Get a demo
Try for free
Table of ContentsIntroductionGetting startedSet up a Google API KeyCall Gemini 1.5 FlashExplaining the codeImporting the packagesImport the API keyGenerate content using the modelPrint the responseWhat's next
Recent Posts
Slackbot Quickstart Guide
Create a virtual whiteboard with Roboflow vision models
How to Build Your Own Simple Poll Slack App
AI Support Specialist With Groq - Part I

Introduction #

On May 30th, Google released Gemini 1.5 Pro and Gemini 1.5 Flash. Flash is a particularly fast and cost-efficient model in the Gemini series. Today, we will show you how to query Gemini 1.5 Flash.

Getting started #

Start by opening the Replit tutorial this Replit template. Click “Use template."

Set up a Google API Key #

You'll need an API key. Head over to Google AI Studio and follow the instructions there.

Next, head over to Replit "Secrets" by typing "Secrets" in the search on the left. Add your key to the GOOGLE_API_KEY secret and save it.

Replit secrets are encrypted and a secure place to store your application credentials.

Call Gemini 1.5 Flash #

Replit takes care of all of the setup for you, so at this point, you can click "Run." You will see a response in the Replit Console. The response should be describing the image that lives in the Repl, image.png.

Congratulations, you have officially used a Google model! 🎉

Explaining the code #

Importing the packages #

The project starts by importing libraries. Libraries are the building blocks of software. In this case, we are using:

  • os: This module provides a way to use operating system dependent functionality like reading environment variables.
  • google.generativeai: This is the library from Google for interacting with their generative AI models.
  • PIL.Image: This is part of the Python Imaging Library (PIL) which provides the ability to create, modify, and save image files.

Import the API key #

This line retrieves the API key stored in the environment variable GOOGLE_API_KEY. API keys are used to authenticate and bill your account. If your API key is exposed, anyone could use it, and you would be billed. The keys are highly sensitive, so we store them in Replit Secrets.

Generate content using the model #

This portion initialized the GenerativeModel, and them makes a request for the model to generate a response based on the question (What's in this photo?") and the image provided (image.png)

Print the response #

Finally, we print the response in the console, so we can see what the model responded with.

What's next #

Now that you have tested your first Google LLM, we recommend you try building this barista bot.

If you would like to try other projects, check out the remainder of our guides.

Replit

  • Mobile App
  • Desktop App
  • Blog
  • Careers
  • About
  • Pricing
  • Guides

Features

  • Replit Agent
  • Collaboration
  • Deployments
  • Teams

Legal

  • Terms of service
  • Teams agreement
  • Privacy
  • Subprocessors
  • DPA
  • Report abuse

Connect

  • X / Twitter
  • Tiktok
  • Facebook
  • Instagram
  • Linkedin

Languages

  • Python
  • Javascript
  • TypeScript
  • Node.js
  • Nix
  • HTML, CSS, JS
  • C++
  • Golang

Handy Links

  • Vibe Coding 101
  • Languages
  • Docs
  • Help
  • Status
  • Import from Glitch
  • Import from Heroku
  • Copilot alternative
  • Brand kit
  • Partnerships
All rights reserved. Copyright © 2025 Replit, Inc.