blackdark
ToolsGoogle AI StudioGemini APIGeminiAPI keyfree tiertutorial

Google AI Studio and the Gemini API: A Hands-On Guide From Scratch (2026)

Step-by-step Google AI Studio tutorial: what it is, how to test Gemini models, grab your free API key, take a prompt to the API with code, free tier limits, and how it differs from Vertex AI.

By BlackdarkUpdated on 8 min read

There's a pattern that repeats with every new Google model: you read that Gemini does wonders, you open ChatGPT out of habit to ask how to use it, and you end up lost among three products that are named almost the same. AI Studio, the Gemini API, Vertex AI. They sound like the same thing and they're not.

Google AI Studio is the right door to start through, and almost nobody explains it clearly. It's free, it's web-based, and in ten minutes you go from "I've never touched a Gemini model in my life" to having an API call working in your code. Let's walk exactly that path, no detours.

Note

This tutorial uses the current model names and SDK (2026). The exact free-tier limits and prices are published by Google and change every few months, so the specific numbers are best checked in their docs; here we show you the mechanism, which doesn't change.

What Google AI Studio Is and What It's For

Google AI Studio (you'll find it at aistudio.google.com) is the free playground for Gemini models. It's a website where you type prompts, see how the model responds, tweak parameters, and compare versions, all without writing a single line of code. Think of it as the workbench: here you test the part before mounting it on the machine.

What makes it genuinely useful is what happens after you test. When you have a prompt that works, AI Studio gives you two things with one click: generating the API key to use that same model from your application, and copying the ready-made code (Python, JavaScript, etc.) with your prompt inside. That bridge between "playing in the browser" and "having it in production" is Studio's reason to exist.

Under the hood, AI Studio isn't a model: it's a showcase of the Gemini family. The Flash models are the fast, cheap ones, built for volume and everyday tasks; the Pro ones are the powerful ones, for complex reasoning. You pick which to use at any moment from a dropdown, with nothing to install.

A distinction that saves headaches: AI Studio is always free. What has paid plans is the Gemini API living underneath. In other words, playing in the web never costs you anything; what gets metered and billed (when you grow) are the API calls from your code.

Getting Started: API Key and First Prompt

Getting started has no mystery. You go to aistudio.google.com, sign in with any Google account —no special access or waitlist needed— and you're in. The first thing you see is a chat: pick a Flash model from the dropdown, type something, and hit send. That's already testing Gemini.

The right-hand side panel is where the meat is. There you tweak the temperature (how much the model takes risks: low = precise and boring, high = creative and chaotic), the system prompt (the background instructions that set the tone and role), and the maximum number of output tokens. Messing with this in the browser is free and is the best way to understand how a model behaves before paying for it in production.

When the prompt convinces you, it's time to grab the key. Click "Get API Key", usually top-left or in the menu. It'll ask you to create a key inside a Google Cloud project: you can use one you already have or let it create a new one automatically. Copy the key —it's a long string starting with AIza...— and store it like you'd store a password.

Heads up

The API key gives access to your quota (and your bill if you enable billing). Never paste it into code you push to GitHub or into a website's frontend. It always goes in a server-side environment variable (like GEMINI_API_KEY). If it leaks, revoke it from AI Studio and create another.

Taking the Prompt to the API With Code

This is where Studio proves its worth: the jump from browser to your application is almost instant. The official SDK is called google-genai and exists for Python, JavaScript/TypeScript, Go, and Java, with the same logic across all of them.

First, save the key in an environment variable so you don't write it into the code:

Save the API key as an environment variable
# Linux / macOS (terminal)
export GEMINI_API_KEY="AIza...your_key"

# Python: install the SDK
pip install -U google-genai

# JavaScript / Node: install the SDK
npm install @google/genai

With the key out of the code, the first API call is three lines. The SDK reads the GEMINI_API_KEY variable on its own, so you don't mention it in the code:

First Gemini call in Python
from google import genai

client = genai.Client()  # reads GEMINI_API_KEY from the environment

response = client.models.generate_content(
  model="gemini-2.5-flash",
  contents="Summarize what Google AI Studio is in 3 sentences.",
)

print(response.text)

And exactly the same in JavaScript. Notice that the method (generateContent), the model name, and the structure are identical: only the language syntax changes.

The same call in JavaScript / Node
import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({}); // reads GEMINI_API_KEY from the environment

const response = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: "Summarize what Google AI Studio is in 3 sentences.",
});

console.log(response.text);

See the trick? The prompt you dialed in the browser (contents), the model you picked in the dropdown (model), and the parameters you tweaked in the panel are the same fields you fill in the code. Studio isn't a separate toy: it's the same API with a visual interface. That's why the whole flow snaps together like Lego pieces.

The flow from AI Studio to production

  1. Test in AI Studio

    You dial in the prompt, model, and parameters in the browser. Free and unlimited.

  2. Get the API key

    One click on 'Get API Key', stored in a server-side environment variable.

  3. Integrate with the SDK

    You copy the prompt into the code with google-genai. Same fields as the UI.

  4. Scale

    You move to a paid tier or to Vertex AI when the free-tier limits fall short.

Free Tier Limits and Pricing

This is the part that confuses people most, so let's go slow. When you generate a key from AI Studio, you automatically start on the Gemini API free tier. Free, no card, ready to prototype. But "free" has borders, and there are three at once:

  • RPM — requests per minute. How many calls you can fire in 60 seconds.
  • TPM — tokens per minute. How much total text (input + output) you process per minute.
  • RPD — requests per day. The daily call ceiling.

These three limits vary by model. The Flash models are the ones with the roomiest free tier —built precisely for volume— while the Pro ones are more restrictive or outright require enabling billing. As a rule of thumb: if your project lives on the free tier, it lives on Flash.

When you run out of limits, you enable billing and move to the paid tier, where you're charged by tokens (a price per million input tokens and another for output, cheaper on Flash than on Pro). There the limits rise a lot and, key detail, your data stops being used to train Google's models.

Tip

Don't memorize limit or price figures: Google tweaks them every few months and any number you write down today expires. What doesn't change is the limits panel inside AI Studio, which shows you the current quota for your project in real time. Always look there.

A privacy nuance worth being clear on from day one: on the free tier, Google may use your prompts and responses to improve its models. For tinkering and prototyping it doesn't matter. For client data or sensitive information, it does: that's where paid or Vertex come in.

AI Studio vs Vertex AI vs OpenRouter

Three options circling the same territory that you shouldn't mix up.

AI Studio (the developer API) is the entry door: simple API key, free tier with no card, ideal for prototypes, side projects, and learning. Its downside is that it shares data on the free plan and that its limits won't hold an app with serious traffic.

Vertex AI is the same Gemini family but entering through Google Cloud. Different authentication (service accounts instead of a loose key), much higher limits, it doesn't use your data for training, and it adds enterprise firepower: grounding, fine-tuning, data residency, SLAs. It's where you migrate when the Studio prototype becomes a product.

OpenRouter plays in another league: it's not Google's, it's an aggregator that gives you one API and one bill to access Gemini and GPT, Claude, Llama, and dozens more. If you want to avoid marrying one provider and be able to switch models with one line, it's the option we cover in its own guide.

Pros

  • Starting in minutes: Google account, one click, and you have an API key.
  • Testing models in the browser with no code and spending nothing.
  • A real free tier with no card, enough to actually prototype.
  • Same SDK and same fields from browser to code: zero friction integrating.

Cons

  • On the free plan, Google may use your data to train its models.
  • The free-tier limits won't hold an app with real traffic.
  • It ties you to the Gemini ecosystem; for multi-model you need an aggregator.
  • For enterprise features (grounding, data residency) you have to jump to Vertex.

Who Is Google AI Studio For?

It's not a "better or worse" decision, but a question of what phase you're in.

It fits you if: you're starting out with the Gemini API, you want to test prompts and models without spending, you're building a prototype or a side project, or you're a developer who needs a call to a good model working today without fighting the Google Cloud console. Also if you want to understand how Gemini behaves before committing budget: the free testbed has no rival for that.

You'll fall short if: you're going to handle sensitive or client data (there, paid or Vertex), you need high limits for an app with traffic, or you want to avoid depending on a single provider and hop between models per task (there, an aggregator like OpenRouter).

The healthy way to see it: Google AI Studio is where almost every Gemini project starts, and from there you migrate —to the paid API, to Vertex, or to an aggregator— when the project asks for it. Starting here isn't a beginner's patch: it's the path also walked by those who later end up in production. All you need today is a Google account and ten minutes.

FAQ

It's Google's free web tool (aistudio.google.com) for testing Gemini models without writing code: you type prompts, tweak parameters like temperature, compare models, and once it's dialed in, you generate an API key to integrate it into your app. It's the fastest entry point into the Gemini ecosystem.

You go to aistudio.google.com with any Google account, click 'Get API Key', create or pick a Google Cloud project, and copy the key. No card is needed for the free tier and the key is ready to use instantly with the SDK or a plain HTTP call.

There are three limits to watch: requests per minute (RPM), tokens per minute (TPM), and requests per day (RPD). They vary by model and the Flash models have the most generous free-tier limits. Google publishes the current figures and you should check them there because they change: on the free tier, Google may use your inputs and outputs to improve its models.

They're two doors to the same Gemini model with different authentication, URLs, and limits. AI Studio (the developer API) is for starting fast and prototyping, with a simple API key. Vertex AI is Google Cloud's enterprise platform: higher limits, it doesn't use your data for training, and it adds features like grounding, fine-tuning, and data residency.

Yes, the free tier allows commercial use, but with the fine print that Google may use your prompts and responses to improve its models. If data privacy is critical for your product, move to the paid API tier or use Vertex AI, where your content isn't used for training.

Keep digging into the same topic.

Share
Newsletter

Get the next guides in your inbox

AI and marketing ideas and resources, no filler. What works and how to apply it.

Ideas and resources, no spam. Unsubscribe anytime.

Finding this guide useful?

Subscribe