# Google AI studio: prototyping prompts
Google AI Studio is the free playground where you test prompts, tune model settings, and walk away with the exact code to run them in production. It is the fastest path from "I have an idea" to "I have a working snippet." This lesson takes you through that path end to end: building a prompt, tuning the knobs that actually matter, and exporting clean code you can drop into a project.
You already know the Gemini app and Gems. Those are for consuming and lightly customizing. Studio is for *engineering*. It exposes the raw parameters the app hides: model selection, temperature, tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.View full definition → limits, structured output schemas, safety settings, and system instructions. Critically, every prompt you build maps directly to a Gemini API call you can copy out.
The mental model: Studio is the IDE for . The Gemini app is the finished product.
Open aistudio.google.com and sign in with a Google account. You land in Chat by default, which is a single multi-turn conversation against a model you pick in the right-hand panel.
Start with the model selector. In 2025-2026 you choose between Gemini Pro tiers (deeper reasoning, slower, pricier per tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.View full definition →) and Gemini Flash tiers (fast, cheap, excellent for high-volume tasks). For prototyping, start on a Flash model. It is responsive and cheap, and you can promote to Pro later if quality demands it.
Now write a real prompt. Say you are building a feature that turns messy customer feedback into structured tickets:
Read the customer message below and extract the issue.
Message: "hey so the export button on the reports page does nothing
when I click it on Safari, works fine in Chrome though. kind of urgent
we have a board meeting friday"Run it. You get prose back. Useful, but not something a downstream system can parse. This is where Studio earns its keep.
Above the prompt box there is a System instructions field. This is where you put the persistent role and rules that apply to every turn, separate from the user's message. It is the single highest-leverage control in Studio.
Add this:
You are a support triage assistant. For every message, identify the
affected feature, the browser or platform, a severity (low, medium,
high), and a one-line summary. Be terse. Never invent details that
are not in the message.Re-run. The output is now disciplined and consistent. Notice you did not touch the user prompt: the system instruction reshaped behavior globally. This separation is exactly how you will structure the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → call later, so building it here keeps your prototype faithful to production.
The Run settings panel on the right is where prototyping gets real. Three controls do most of the work.
Temperature governs randomness. Low values (near 0) make the model deterministic and repeatable; high values (toward 2) make it creative and varied.
For extraction, classification, and anything where you want the same input to yield the same output, push temperature low. For brainstorming or copywriting, raise it. Set it to 0 for our triage task and run a few times: the structure should now barely change between runs.
This caps the response in tokenstokensA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.View full definition →. Set it deliberately. A triage summary does not need a 2,000-tokentokenA token is the basic unit of text that language models process, often a word fragment, whole word, or punctuation mark rather than a single character.View full definition → budget, and a low cap both saves money and discourages the model from rambling.
This is the feature that turns a demo into a real integration. Toggle Structured output on, and Studio lets you define a JSON schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition → the model must conform to. Instead of hoping the model returns clean JSON, you *constrain* it to.
Define a schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition → for our ticket:
{
"type": "object",
"properties": {
"feature": { "type": "string" },
"platform": { "type": "string" },
"severity": { "type": "string", "enum": ["low", "medium", "high"] },
"summary": { "type": "string" }
},
"required": ["feature", "platform", "severity", "summary"]
}Run again. Now you get back valid, parseable JSON every time, with severity guaranteed to be one of your three allowed values. No regex, no cleanup, no "sometimes it adds a markdown fence." This is the difference between a prompt that works in a demo and one you can pipepipeAll active sales opportunities across the stages of the sales process, together with their combined potential value and probability of closing.View full definition → into a database.
Your triage task works on text you provide, so it needs no outside knowledge. But many prototypes do. When a prompt asks about current events, recent releases, or anything past the model's training cutoff, flip on Grounding with Google Search in the run settings.
With grounding enabled, Gemini issues real searches, pulls live results, and cites its sources in the response. This is the same grounding capability exposed in the APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition →, so testing it in Studio tells you exactly how it will behave in code. Toggle it on, ask "what changed in the latest Gemini Flash release," and watch the citations appear. Toggle it off and you get a confident, possibly stale answer. Prototyping both side by side is the point.
Gemini is natively multimodal, and Studio lets you exercise that directly. Click the + in the prompt area to attach an image, a PDF, audio, or even video. Combined with long context, you can drop a 40-page PDF spec and a screenshot into one prompt and ask the model to reconcile them.
For our triage example, imagine the customer attaches a screenshot of the broken page. Add the image, keep the same system instruction, and the model now grounds its feature and platform fields in what it actually sees. You just prototyped a multimodal pipelinepipelineAll active sales opportunities across the stages of the sales process, together with their combined potential value and probability of closing.View full definition → without writing a line of code.
Knowledge check
1. According to the lesson, what is the key advantage of using Google AI Studio over the Gemini app for prompt engineering?
2. For prototyping a new feature, which model tier does the lesson recommend starting with and why?
3. When you build and tune a prompt in Google AI Studio, what can you export to use in your own project?
4. Select ALL correct answers about the raw parameters Google AI Studio exposes for prompt engineering.
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers that accurately describe the distinction the lesson draws between the Gemini app and Google AI Studio.
Sélectionnez toutes les réponses correctes.
Here is the payoff. Everything you tuned (model, system instruction, temperature, output length, schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition →, grounding) is captured in the prompt. Click Get code (the < > button, usually top right).
Studio generates a ready-to-run snippet in your language of choice: Python, JavaScript, Go, REST, and more. It uses the official Google GenAI SDK and reflects your exact settings. Choose Python and you get something close to this:
from google import genai
from google.genai import types
client = genai.Client(api_key="YOUR_API_KEY")
response = client.models.generate_content(
model="gemini-flash-latest",
contents="Message: the export button does nothing on Safari, urgent",
config=types.GenerateContentConfig(
system_instruction=(
"You are a support triage assistant. Identify the affected "
"feature, the platform, a severity (low, medium, high), and a "
"one-line summary. Be terse. Never invent details."
),
temperature=0,
response_mime_type="application/json",
response_schema={
"type": "object",
"properties": {
"feature": {"type": "string"},
"platform": {"type": "string"},
"severity": {
"type": "string",
"enum": ["low", "medium", "high"],
},
"summary": {"type": "string"},
},
"required": ["feature", "platform", "severity", "summary"],
},
),
)
print(response.text)Notice how cleanly the prototype maps to the call. The system instruction, temperature, and schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition → you set with toggles became system_instruction, temperature, and response_schema. There is no translation gap. What you tested is what you ship.
The snippet needs an APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → key. Studio has an API key option in its menu that creates one tied to a Google Cloud project. Never paste it into client-side code or commit it to a repo. Load it from an environment variable instead:
export GEMINI_API_KEY="your-key-here"Then read it with os.environ["GEMINI_API_KEY"] rather than hardcoding. The SDK also picks up GEMINI_API_KEY automatically if you construct the client with no arguments.
Every prompt in Studio can be saved to your Drive and shared by link, so a teammate can open the exact prompt with all your settings intact. This makes Studio a shared design surface, not just a personal scratchpad. When you hand a prompt to an engineer, send the Studio link *and* the exported code: the link lets them tune, the code lets them ship.
Studio and the Gemini APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → are built for fast iteration and individual or small-team projects. When you need enterprise controls (private networking, data residency, IAM, MLOpsMLOpsMachine Learning Operations: combining ML and DevOps practices to industrialise, deploy, monitor, and retrain models reliably in production.View full definition → tooling, higher quota guarantees), the same models are available through Vertex AI on Google Cloud. The prompt designprompt designPrompt engineering is the practice of designing and refining text inputs to guide large language models toward accurate, relevant, and reliable outputs. you do in Studio transfers: the request shape is nearly identical, so prototyping here is never wasted even if you later move to Vertex for production. Treat that as a deployment decision, not a reason to prototype anywhere else.
Put it together and your workflow looks like this:
1. Draft the user prompt in Chat.
2. Move the persistent rules into System instructions.
3. Set temperature for your task (low for structured, high for creative).
4. Cap output length.
5. Add a JSON schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition → if a system will consume the output.
6. Toggle grounding if the task needs fresh facts.
7. Attach images, PDFs, or audio to test multimodal paths.
8. Click Get code, wire in an environment-variable key, run it.
Each step you do in Studio is a parameter you would otherwise guess at in code. Tuning visually first means your first run in a real project usually just works.