Google AI Studio: Complete Gemini API & Prompting Guide
Google AI Studio is Google's rapid experimentation environment for developers building with Gemini. It lets you test prompts, system instructions, models, multimodal inputs, structured output and tools before moving a working idea into application code with the Gemini API. This developer-focused guide forms part of our wider Google playbook. For the broader Gemini product and ecosystem rather than API prototyping, see our planned Google Gemini guide.
What Is Google AI Studio?
AI Studio is primarily a prototyping environment. It helps developers work out how a Gemini-powered experience should behave before implementing that behaviour in production code.
Experiment With Prompts
Try instructions, examples, conversation structures, multimodal inputs and output requirements interactively before committing the behaviour to an application.
Test Gemini Capabilities
Experiment with supported tools such as structured output, function calling, code execution and grounding in a developer-oriented environment.
Move the Prototype Into Code
When the prompt and configuration behave as expected, AI Studio can help developers move from interactive experimentation towards Gemini API code.
AI Studio vs Gemini vs Google Cloud Console
These products are related but solve different problems. Keeping their search intent separate also prevents our Google knowledge cluster from cannibalising itself.
Google AI Studio
Use AI Studio when you want to prototype and develop an application using Gemini models.
- Prompt testing
- System instructions
- Model experiments
- Multimodal inputs
- Tools
- Structured output
- Gemini API development
Google Gemini
Gemini is the wider Google AI model and product ecosystem, including consumer-facing AI experiences and integrations across Google products.
- Everyday AI assistance
- Gemini applications
- Google integrations
- Consumer experience
- Broader model ecosystem
Continue later with Google Gemini.
Google Cloud Console
Cloud Console manages the infrastructure layer behind many developer workflows.
- Cloud projects
- APIs
- Credentials
- IAM
- Billing
- Quotas
See our Google Cloud Console guide.
The Google AI Studio → Gemini API Workflow
The main value of AI Studio is shortening the distance between an AI idea and a configuration that is ready to be implemented programmatically.
Choose the Task
Define what the application actually needs the model to do.
Select a Model
Choose a model suited to capability, speed, cost and modality.
Design the Prompt
Add system instructions, user input, examples and output requirements.
Enable Tools
Add Search, URL Context, functions, code or File Search where required.
Test & Validate
Try normal, difficult and failure cases before trusting the configuration.
Move Into Code
Use the Gemini API and production infrastructure once the prototype is sound.
System Instructions vs User Prompts
Separating persistent developer guidance from the user's immediate request makes AI application behaviour easier to reason about and maintain.
System Instruction
Use system instructions for durable developer guidance such as role, behaviour, style, rules and application-level constraints.
You are an SEO analyst.
Use British English.
Distinguish facts from recommendations.
Return evidence before advice.
User Prompt
The user prompt contains the immediate task, content or question to process within the application's broader instructions.
Analyse these landing pages.
Identify:
1. primary search intent
2. topic overlap
3. missing subtopics
4. three priority improvements
Five Parts of a More Useful Developer Prompt
Good prompting is less about magic wording and more about clearly defining the task, context, boundaries, inputs and expected result.
Task
Explain the operation: classify, analyse, compare, extract, transform or generate.
Context
Provide the background the model needs to interpret the request correctly.
Constraints
Define boundaries such as language, evidence requirements, exclusions or output length.
Input
Supply the text, file, URL, image, data or other material the task concerns.
Output Format
Specify whether the application needs prose, categories, fields or structured machine-readable output.
Interactions API Is Now Recommended for New Gemini Projects
As of June 2026, Google describes the Interactions API as Generally Available and recommends it for new Gemini projects. It provides a unified interaction model for text, multimodal tasks, structured outputs, tools and agentic workflows.
Choose a Model for the Workload — Not Because Its Name Is Newest
Google's Gemini model catalogue changes quickly. Build model selection around the task's requirements rather than hard-coding an entire application around a fashionable preview model.
High-Capability Workloads
Use a higher-capability reasoning or coding model when complex analysis, planning, difficult code or multi-step reasoning is more important than minimal latency.
Capability firstFast General Workloads
Flash-style models are often suitable when an application needs strong general capability with better speed, throughput or price-performance.
BalancedHigh-Volume Workloads
Lighter models can suit classification, extraction and high-volume processing when maximum reasoning depth is unnecessary.
EfficiencyDo Not Assume a Preview Model ID Will Exist Forever
Google maintains model lifecycle and deprecation schedules. Production applications should make model changes deliberate, monitor deprecation notices and test replacements before an older model is shut down.
One Task Can Combine Different Types of Input
Gemini is designed for multimodal work. Depending on the chosen model and feature, developers can provide more than plain text as context.
Text
Classification, extraction, writing, summarisation, reasoning and conversation.
Images
Analyse screenshots, diagrams, photographs, interfaces and other supported visual input.
Documents
Process supported files and long-form documents as part of research or extraction workflows.
Audio
Use supported audio understanding for transcription-related, analytical or multimodal tasks.
Video
Reason about supported video input when the selected Gemini model exposes video understanding.
A Large Context Window Is Useful — but It Is Not Free Intelligence
Many current Gemini models support very large context windows, making large-scale document and code analysis possible. More context still creates trade-offs.
Use Long Context When the Task Actually Needs It
Large context windows can make it practical to analyse extensive documents, research collections, transcripts, codebases and long conversations within one model workflow.
But adding hundreds of thousands of irrelevant tokens can increase cost and latency while making the useful information harder to isolate.
Long context should therefore be designed, not simply filled.
Structured Output Is Better Than “Please Return JSON”
When software needs predictable fields, use supported structured-output features and schemas rather than relying only on a natural-language request for something that happens to look like JSON.
Natural-Language Task
The user or application provides the content to analyse and specifies the information required.
Analyse this keyword.
Return:
- keyword
- intent
- priority
Schema-Constrained Result
The application receives predictable structured fields that can be validated and passed into another system.
{
"keyword": "guest posting",
"intent": "commercial",
"priority": "high"
}
Tools Extend the Model Beyond a Plain Text Response
Different tools solve different problems. Do not enable every available tool by default simply because the model supports it.
Function Calling
Let the model select a developer-defined function and provide the parameters required to interact with an external system or application capability.
Google Search Grounding
Connect supported Gemini requests with current web information through Google Search when freshness and verifiable source grounding matter.
URL Context
Provide selected public URLs that the supported model can retrieve and use as context for extraction, comparison and synthesis.
Code Execution
Allow supported model workflows to execute generated code in the tool environment for appropriate computational tasks.
File Search
Create retrieval workflows over uploaded or indexed private information rather than placing the entire knowledge base into every prompt.
Structured Output
Constrain supported responses to a schema so downstream software receives predictable fields.
Tool Combinations
Supported models can combine certain tools, but compatibility varies by model, API and feature. Check the current documentation before designing a production workflow around a specific combination.
Your Own APIs
Function calling can bridge Gemini with your CRM, inventory, database, booking system, SEO tooling or other controlled external services.
The Model Selects the Function — Your Application Performs the Action
This distinction is fundamental. Gemini can determine that an external function is appropriate and construct its arguments, while the application retains control over the actual external operation.
Example: Check Product Stock
Imagine a customer asks whether product 2481 is available. Instead of inventing an answer, the model can select a developer-defined inventory function.
get_stock(
product_id="2481"
)
Your application executes the real inventory lookup, sends the result back into the interaction and allows Gemini to present the result conversationally.
Google Search Grounding vs URL Context
Both can bring external web information into a Gemini workflow, but they begin from different inputs.
Grounding With Google Search
Use Search grounding when the application needs current or potentially changing information and the model should search broadly for relevant web sources.
The supported workflow can search, process current information and return source attribution with the response.
User question
↓
Google Search grounding
↓
current web information
↓
grounded response + sources
URL Context
Use URL Context when you already know which public pages should be examined. The model retrieves the supplied URLs and uses their content as context.
This can support comparison, extraction, research synthesis and technical documentation analysis.
Selected URL A
Selected URL B
↓
URL Context
↓
compare / extract / synthesise
Use URL Context for Page Comparison — Not as a Full SEO Crawler
URL Context can be valuable for selected-page analysis, but it should not be described as a replacement for technical crawling or complete site architecture analysis.
Supply Selected URLs
Choose the pages that matter to the research question rather than expecting the tool to discover an entire website automatically.
Define the Comparison
Ask for specific analysis such as topic coverage, entities, commercial intent, information gaps or content structure.
Validate the Findings
AI-generated content comparisons remain analysis. Verify important claims against the source pages before acting on them.
Function Calling vs Code Execution
Both extend what a model can do, but they solve fundamentally different problems.
Function Calling
Function calling connects Gemini to capabilities that your application defines.
Gemini
↓
call get_customer()
↓
your application/API
↓
real external result
Use it for databases, CRM systems, bookings, stock, proprietary tools and other external operations.
Code Execution
Code Execution allows supported Gemini workflows to run generated code in Google's controlled execution tool for appropriate computational tasks.
Gemini
↓
generate calculation/code
↓
Code Execution tool
↓
result
Use it where computation can improve accuracy rather than asking the model to mentally approximate a calculation.
Use File Search for Private Knowledge Retrieval
File Search supports retrieval workflows in which stored material can be indexed and relevant information retrieved when a question is asked.
Do Not Put the Entire Knowledge Base Into Every Prompt
A retrieval workflow can store and index a body of information, retrieve the parts that are relevant to the current question and then provide those passages as grounding context for Gemini.
This is useful for internal documentation, product information, policies, research libraries and knowledge assistants.
Documents
↓
File Search store
↓
index / retrieve
↓
relevant context
↓
Gemini response
Gemini API Standard Keys Are Being Replaced by Auth Keys
Google is moving the Gemini API towards authorization keys, commonly called auth keys in its current developer guidance. New keys created in Google AI Studio are created as auth keys, and developers using older Standard keys need to migrate.
Google's current schedule states that the Gemini API will reject requests from Standard keys in September 2026. Existing integrations should therefore check their authentication method before that change takes effect.
Manage Keys in AI Studio
Google AI Studio provides a lighter interface for Gemini API project and key management.
Cloud Project Behind the Key
Gemini API keys are associated with Google Cloud projects. For the wider project, billing and IAM layer, see Google Cloud Console.
Keep Credentials Private
Do not place a private Gemini credential in publicly accessible code, repositories or browser source where it can be copied and abused.
API Keys Do Not Mean Unlimited Gemini Usage
Gemini API rate limits vary by model, project usage tier and capability. Always inspect the active limits for the project rather than relying on an old tutorial.
Requests Per Minute
Controls how many eligible requests can be made within the minute-based window for the project and selected model.
Tokens Per Minute
Large prompts can reach token-based limits even when the total number of API requests remains relatively low.
Requests Per Day
Where applicable, daily request limits create another capacity boundary separate from requests per minute.
Rate Limits Apply at Project Level, Not Simply Per API Key
Creating several keys inside one project should not be treated as a way to multiply the project's Gemini API capacity. Build backoff, queueing, monitoring and appropriate model selection into production applications.
A Successful Playground Prompt Is Not Yet a Production Application
Moving from experimentation to production introduces authentication, cost, rate limits, validation, security and reliability requirements.
Understand Pricing
Gemini API cost varies by model and feature. Check the live pricing documentation rather than hard-coding old token prices into business planning.
Monitor Rate Limits
Use the project's current limits and design retry logic around genuine production capacity.
Validate Output
Structured output improves predictability, but important application decisions should still validate fields and handle missing or invalid results.
Design Safety Deliberately
Prompt constraints, application rules and supported safety configuration serve different purposes. Treat safety as part of the application design.
Log Failures
Record model, API and tool failures so production behaviour can be diagnosed rather than relying on anecdotal user reports.
Test Edge Cases
Prompt injection, missing fields, huge inputs, unavailable URLs and malformed function results should be tested before launch.
Plan Model Migration
Monitor model lifecycle notices and test replacements before a deprecated model disappears from production.
Keep Human Review Where Needed
High-impact decisions should not become fully automatic simply because a model response looks confident.
Useful Google AI Studio Prototypes for SEO & Marketing Teams
These examples show where AI Studio becomes more useful than simply typing questions into a general-purpose chatbot.
SEO Content Classifier
Turn page content into predictable categories that can be stored and analysed at scale.
Search-Grounded Research Assistant
Use current web grounding when the research question depends on recent information.
Competitor Page Comparison
Provide selected competitor pages and ask Gemini to compare topic coverage or content positioning.
Internal Knowledge Assistant
Use retrieval over approved internal material rather than relying entirely on general model knowledge.
API-Powered Website Assistant
Connect a conversational interface to controlled real-world business data.
Multimodal Page QA
Combine screenshot and textual context to identify visible design, information and usability issues.
Where AI Studio Fits With Other Google Tools
AI Studio handles rapid Gemini development, while other Google products manage infrastructure, data and reporting around the finished application.
Cloud Console
Use Google Cloud Console for deeper project, IAM, API, billing and quota administration.
Search Console API
A Gemini application could consume controlled search datasets produced by your own Search Console API workflow.
Google Analytics
Use Google Analytics to measure what users actually do in an AI-powered website or application.
Data Studio
Use Google Data Studio to visualise suitable application, Search and Analytics data in reusable reports.
Common Google AI Studio & Gemini API Mistakes
Most failures come from vague task design, exposed credentials, uncontrolled tool use or treating an impressive prototype as if it were already a robust application.
Using Vague Prompts
“Analyse this” gives the model far less useful direction than defining the task, context, constraints and output structure.
Exposing API Credentials
Do not place private Gemini credentials in browser code, public source files or repositories where they can be copied.
Ignoring the 2026 Key Migration
Older Standard Gemini API keys need attention before Google's September 2026 authentication change.
Hard-Coding Preview Models Forever
Preview and older model IDs can be deprecated. Production applications need a model-maintenance process.
Parsing Uncontrolled Prose as JSON
Where predictable machine data is required, use supported structured-output mechanisms and validate the response.
Treating URL Context as a Crawler
URL Context analyses supplied accessible URLs; it should not be presented as a complete technical SEO crawling engine.
Executing Tool Calls Blindly
Your application remains responsible for validating parameters, authorisation and business rules before performing sensitive actions.
Stuffing the Context Window
A huge context window does not mean every available document should be sent with every request.
Testing Only the Perfect Example
Production prompts should be tested against missing data, hostile input, ambiguous questions and tool failures as well as ideal cases.
Common Questions About Google AI Studio
Quick answers covering AI Studio, Gemini API, prompts, tools, structured output, API keys and production development.
01 What is Google AI Studio?
Google AI Studio is a developer environment for experimenting with Gemini models, prompts, system instructions, multimodal inputs and supported tools before moving a working configuration into Gemini API code.
02 Is Google AI Studio the same as Gemini?
No. AI Studio is primarily a development and prototyping environment for building with Gemini. The broader Google Gemini ecosystem includes consumer-facing Gemini experiences and wider Google AI integration.
03 What is the Gemini Interactions API?
The Interactions API is Google's recommended API interface for new Gemini projects as of 2026. It supports standard generation, multimodal inputs, structured outputs, tools and agentic workflows through a unified interaction model.
04 Does generateContent still work?
Yes. Google now describes the original generateContent API as legacy, but it remains supported. Developers starting new projects should review the current Interactions API guidance.
05 What is structured output?
Structured output lets supported Gemini requests constrain responses to a defined schema so applications can receive predictable machine-readable fields rather than relying solely on free-form prose.
06 What is Gemini function calling?
Function calling lets Gemini select a developer-defined external function and provide the arguments required for it. Your application executes the function and controls the real-world action.
07 What is Google Search grounding?
Search grounding connects supported Gemini requests to current web information through Google Search and can provide source attribution for the information used in the response.
08 What is URL Context?
URL Context lets supported Gemini models retrieve content from supplied public URLs and use that information when extracting, comparing or synthesising an answer.
09 What is File Search?
File Search provides retrieval over stored and indexed information so Gemini can receive the passages relevant to a question instead of requiring the entire knowledge base inside every prompt.
10 Do old Gemini API keys need changing in 2026?
Developers using older Standard keys should check their setup. Google's current migration schedule states that the Gemini API will reject Standard keys from September 2026, with current AI Studio key creation using the newer auth-key approach.
11 Are Gemini API rate limits per API key?
Current Gemini API guidance applies rate limits at project level rather than simply giving each API key its own independent quota. Active limits vary by model and usage tier and can be reviewed in AI Studio.
12 Is AI Studio enough for a production application?
AI Studio is excellent for experimentation and prototyping, but production systems also need secure authentication, API capacity planning, monitoring, validation, error handling and appropriate infrastructure. See our Google Cloud Console guide for the wider project-management layer.
Continue Your Google AI Workflow
Connect Gemini prototyping with Google's wider AI, developer, analytics and reporting ecosystem.
Google Playbook
Explore the full Google knowledge hub across Search, Analytics, Ads, developer tools, AI and productivity.
Explore Google → GEMGoogle Gemini
Explore Gemini as Google's wider AI model, consumer product and integrated AI ecosystem.
Gemini Guide → CLOUDGoogle Cloud Console
Manage projects, APIs, credentials, IAM, quotas, billing and developer infrastructure.
Cloud Console → APISearch Console API
Build automated Google Search data extraction, URL Inspection and SEO reporting workflows.
Search Console API → GA4Google Analytics
Measure user behaviour, events and outcomes generated by AI-powered website experiences.
Analytics Guide → GTMGoogle Tag Manager
Implement and debug website measurement around AI-assisted interfaces and other digital experiences.
Tag Manager → DATAGoogle Data Studio
Visualise application, Analytics and Search data in reusable dashboards.
Data Studio → MAPGoogle Maps Platform
Explore Google's location APIs, Maps development, credentials, billing and location-based applications.
Maps Platform →Prototype in AI Studio — Engineer for Production Afterwards
Google AI Studio is most useful when it helps a developer answer difficult questions before writing production code: which Gemini model suits the workload, which instructions should remain persistent, what information the user supplies, whether current web grounding is required, whether a function or retrieval tool is needed, and whether the final response must follow a schema. Once the behaviour is reliable, move the configuration into a properly authenticated Gemini API application, monitor tokens and request limits, validate tool calls and structured outputs, protect credentials and plan for model lifecycle changes. The goal is not merely to make a prompt work once in a playground — it is to understand the system well enough that the application remains useful when real users and imperfect data arrive.