Large language models (LLMs) are the fancy-schmancy AI technology that has been making all the waves in the AI world in recent years. Products like:
... are all powered by LLMs. For the purposes of this course, you can think of an LLM as a smart text generator. It works just like ChatGPT: you give it a prompt, and it gives you back some text that it believes answers your prompt. We're going to use Google's Gemini API to power our agent in this course. It's reasonably smart, but more importantly for us, it has a free tier.
Again, the free-tier rate limits on the Gemini API have been drastically reduced as of December 2025. We recommend using a paid account if possible to avoid running into these limits. The total cost incurred during this course should be minimal (~$1–2).
Be aware that all API calls, including those made during testing, will add to your usage of model requests and tokens. If you stay on the free tier and exhaust your quota, you'll need to wait for it to reset (typically 24 hours) before continuing. Regenerating your API key will not reset your quota.
You can think of tokens as the currency of LLMs. They're the way that LLMs measure how much text they have to process. Tokens are roughly 4 characters for most models. It's important when working with LLM APIs to understand how many tokens you're using.
Our usage will be quite modest – hopefully within the free-tier limits of the Gemini API – but we'll still monitor how many tokens are consumed during our requests.
If you already have a GCP account and a project, you can create the API key in that project. Otherwise, AI Studio will walk you through creating a new project before generating the key.
GEMINI_API_KEY='your_api_key_here'
We never want to commit API keys, passwords, or other sensitive information to Git.
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.environ.get("GEMINI_API_KEY")
from google import genai
client = genai.Client(api_key=api_key)
model: The model name, gemini-2.5-flash (this one is still available on the free tier, albeit with increasingly strict limits)contents: The prompt to send to the model (a string). For now, hard-code this prompt exactly:
"Why is Boot.dev such a great place to learn backend development? Use one paragraph maximum."
If everything is working as intended, you should be able to run your code and see the model's response in your terminal!
Submit the CLI tests.