A Google key for video is a Gemini API key, made in Google AI Studio, the web workspace where Google keeps your keys, projects and billing. Your scripts send it with each request to Google's video model. The choices you make on the way decide who pays and what happens when the money runs out.
The example is a folder called veo-work in your home folder, used again in later lessons.
Make the key in AI Studio
Open aistudio.google.com/apikey and sign in with the Google account that should own the bill. If you are new to Google Cloud, accepting the terms creates a default Cloud project, the container every key belongs to, and a key inside it. Rename that project after the client.
If you already use Google Cloud, AI Studio creates nothing. Open Dashboard, then Projects, press Import projects and pick one. Then press Create API key on the API Keys page.
At the time of writing, every key made in AI Studio is an auth key, tied to a service account (an identity for software instead of a person) and limited to the Gemini API from the start. Google's key page says the API rejects unrestricted older keys. Delete any old key from a forgotten project or a tutorial and make a new one.
Turn on billing before you try video
At the time of writing, Google's pricing page lists its video model, Gemini Omni Flash, and its image models as not available on the free tier. So video through the API needs a project with billing. Press Set up billing next to the project, choose or create a Cloud Billing account, and prepay a small amount when asked.
Turn billing on for client work even when a free model would do. The pricing page marks free-tier prompts and outputs as used to improve Google's products, and paid-tier ones as not used. Prepaid credit also works as a hard stop. When the balance reaches zero, every key in every project on that billing account stops with an HTTP 402 error, after a lag Google puts at about ten minutes. Credits expire after twelve months and cannot be refunded, so buy small.
Set up the folder and store the key
Make a folder with its own private Python and install Google's library with python-dotenv, a small library that reads .env files. The current google-genai needs Python 3.11 or newer, which is why the block asks uv for 3.13.
Make a project folder with its own PythonTerminal # A folder for this work, with a private Python inside it (uv comes from the terminal lesson)mkdir -p ~/veo-workcd ~/veo-workuv venv --python 3.13source .venv/bin/activate# The Google SDK, plus the small library that reads .env filesuv pip install -U google-genai python-dotenv
Next, tell git to ignore the .env file before the key exists, then put the key in it. The nano editor runs inside Terminal and shows the key on screen as you paste it, so do this with nobody watching and no screen recording running.
Put the key in .env, never in the codeTerminal # Keep .env out of git before the key existsgit initecho ".env" >> .gitignore# Open .env in a plain text editor inside Terminalnano .env# Type one line, with your key after the = sign:# GEMINI_API_KEY=your-key-here# Control-O then Return saves. Control-X quits.
Check the key without spending anything
This short script lists the models your key can see. Listing makes nothing, so there is nothing to bill. Save it as check_key.py in the folder and run it with python check_key.py.
A script that lists your modelsPython # check_key.py: lists the models this key can see.# Listing generates nothing, so there is nothing to bill.from dotenv import load_dotenvfrom google import genai load_dotenv() # copies GEMINI_API_KEY from .env into the environmentclient = genai.Client() # the SDK finds GEMINI_API_KEY by itself for model in client.models.list(): print(model.name)
A working key prints a list of model names, each starting with models/. Listing does not prove that billing is on. The first real call does.
If the script seems to ignore your new key, look for GOOGLE_API_KEY. When it and GEMINI_API_KEY are both set, the library uses GOOGLE_API_KEY and says so in one warning line, so an old key under that name quietly wins. Rate limits, the caps on how many requests you can send, are counted per project and not per key, so extra keys buy no extra speed. Give each client its own project.
Choose the right door
Google offers two ways in. The Gemini Developer API uses an AI Studio key, and Google's own comparison page says most developers should use it. The other is Gemini Enterprise Agent Platform, the newer name for Vertex AI, which lives inside a full Google Cloud project, prefers service accounts over pasted keys and bills through ordinary Cloud billing.
At the time of writing, Veo 3.1 runs only through the Agent Platform, while the Developer API offers Gemini Omni Flash for video. Every script in this course uses the Developer API. Use the Agent Platform when a client's IT team insists on it. In Python the switch is one argument, vertexai=True, plus a project and a region.
The next lesson covers the keys for OpenAI, Hugging Face, Replicate and fal.