Google AI Studio
& Gemini API
The complete developer reference. Every model, endpoint, and price verified against live Google documentation on July 15, 2026.
Audit Log
Breaking since the last guide: Gemini 2.0 Flash and Flash-Lite are fully shut down. Veo 3 GA endpoints retired June 30. The Nano Banana preview image endpoints are gone. The Interactions API legacy schema was removed June 8. Update model strings before deploying.
Gemini Omni Flash public preview
gemini-omni-flash-preview rolled out via Gemini API and AI Studio. Natively multimodal video generation with conversational editing from text, image, and video inputs. Priced at $0.10 per second of video output, matching Veo 3.1 Fast.
Nano Banana 2 Lite launched
Google's fastest and most cost-efficient Gemini image model yet, announced at Google I/O and rolling to the API alongside consumer surfaces.
Streaming TTS support
streamGenerateContent (and stream: true in the Interactions API) now supported for gemini-3.1-flash-tts-preview.
Veo 3 GA models retired
veo-3.0 generation models shut down June 30. Migrate to veo-3.1-generate-preview or veo-3.1-fast-generate-preview.
Image preview endpoints retired
gemini-3.1-flash-image-preview and gemini-3-pro-image-preview shut down. Use the GA endpoints gemini-3.1-flash-image and gemini-3-pro-image.
Interactions API schema finalized
Legacy outputs schema removed. The new steps schema and response_format configuration are now the only supported format.
Gemini 2.0 family shut down
gemini-2.0-flash, gemini-2.0-flash-001, gemini-2.0-flash-lite, and gemini-2.0-flash-lite-001 are gone. Use gemini-3.5-flash or gemini-3.1-flash-lite.
Nano Banana 2 + Pro go GA
gemini-3.1-flash-image and gemini-3-pro-image are generally available. New video-to-image generation: pass a video file or public YouTube URL to generate thumbnails, posters, and infographics (3.1 Flash Image only).
Flash-Lite preview retired
gemini-3.1-flash-lite-preview shut down. The GA model gemini-3.1-flash-lite replaces it.
Gemini 3.5 Flash GA + Managed Agents
gemini-3.5-flash is generally available as the most intelligent model for agentic and coding tasks. Managed Agents and the Antigravity Agent (antigravity-preview-05-2026) launched in public preview.
Getting Started
Get a key
Free at aistudio.google.com/apikey. One key covers AI Studio and the API.
Export it
Set GEMINI_API_KEY as an environment variable. SDKs pick it up automatically.
Install + call
Install the GenAI SDK for your language and make your first generateContent call.
Install the SDK
pip install -q -U google-genaiFirst request · gemini-3.5-flash
from google import genai
# Reads GEMINI_API_KEY from the environment
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="Explain how AI works in a few words"
)
print(response.text)Model Catalog
Gemini 3.5 Flash
gemini-3.5-flash
Most intelligent model for sustained frontier performance on agentic and coding tasks. The current flagship.
Gemini 3.1 Pro Preview
gemini-3.1-pro-preview
Advanced intelligence, complex problem solving, powerful agentic and vibe coding. Custom tools endpoint available.
Gemini 3 Flash Preview
gemini-3-flash-preview
Frontier-class performance rivaling larger models at a fraction of the cost.
Gemini 3.1 Flash-Lite
gemini-3.1-flash-lite
Most cost-efficient model, optimized for high-volume agentic tasks, translation, and data processing.
Gemini Omni Flash
gemini-omni-flash-preview
New in July. Natively multimodal video generation and conversational video editing from text, image, and video inputs.
Gemini 2.5 Pro
gemini-2.5-pro
Deep reasoning and coding, 1M token context window with adaptive thinking.
Gemini 2.5 Flash
gemini-2.5-flash
Best price-performance for low-latency, high-volume reasoning workloads.
Gemini 2.5 Flash-Lite
gemini-2.5-flash-lite
Fastest and most budget-friendly multimodal model in the 2.5 family.
Nano Banana 2
gemini-3.1-flash-image
GA since May 28. High-efficiency image generation and editing plus video-to-image from uploads or YouTube URLs.
Nano Banana 2 Lite
nano-banana-2-lite
New in July. Fastest and most cost-efficient Gemini image model, launched at Google I/O.
Nano Banana Pro
gemini-3-pro-image
GA since May 28. Professional design engine with a reasoning core for 4K visuals and precise text rendering.
Veo 3.1
veo-3.1-generate-preview
Cinematic video with synchronized audio. Standard, Fast, and Lite variants. Veo 3 GA retired June 30.
Imagen 4
imagen-4.0-generate-001
Text-to-image up to 2K. Fast, Standard, and Ultra variants.
Lyria 3
lyria-3-pro-preview
Full-length song generation (Pro) and 30-second clips (Clip). 48kHz stereo from text and image inputs.
3.1 Flash Live
gemini-3.1-flash-live-preview
Low-latency audio-to-audio for real-time dialogue and voice-first apps. Live Translate now documented.
3.1 Flash TTS
gemini-3.1-flash-tts-preview
Steerable speech generation with expressive audio tags. Streaming support added June 2026.
Antigravity Agent
antigravity-preview-05-2026
General-purpose managed agent. Plans, reasons, runs code, manages files, and browses the web in a Linux sandbox.
Deep Research
deep-research-preview-04-2026
Autonomous multi-step research across hundreds of sources with cited reports. Max variant for full comprehensiveness.
Computer Use
gemini-2.5-computer-use-preview-10-2025
Sees a screen and performs UI actions: clicking, typing, navigating. Browser automation agents.
Gemini Embedding 2
gemini-embedding-2
Multimodal embedding across text, images, video, audio, and PDFs in a unified space. GA since April.
Robotics-ER 1.6
gemini-robotics-er-1.6-preview
Embodied reasoning for physical spaces: instrument reading, spatial and physical reasoning.
Prices per 1M tokens, standard paid tier, unless noted. Pro tier prices shown for prompts up to 200k tokens.
Function Calling
The model decides when to call your functions and supplies the arguments. Your app executes them and returns results. Gemini 3 models attach a unique id to every call, and you must echo it back in your functionResponse. The SDKs handle this automatically.
Default. Model chooses between text or a function call.
Always calls a function, guaranteed schema adherence.
Function calls prohibited, tools stay defined.
Preview. Calls or text, both schema-validated.
Automatic function calling
from google import genai
from google.genai import types
def get_current_temperature(location: str) -> dict:
"""Gets the current temperature for a given location.
Args:
location: The city and state, e.g. San Francisco, CA
Returns:
A dictionary containing the temperature and unit.
"""
return {"temperature": 25, "unit": "Celsius"}
client = genai.Client()
config = types.GenerateContentConfig(
tools=[get_current_temperature] # automatic function calling
)
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="What's the temperature in Boston?",
config=config,
)
print(response.text)MCP server integration
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
from google import genai
client = genai.Client()
server = StdioServerParameters(
command="npx",
args=["-y", "@philschmid/weather-mcp"],
)
async def run():
async with stdio_client(server) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
response = await client.aio.models.generate_content(
model="gemini-2.5-flash",
contents="What is the weather in London today?",
config=genai.types.GenerateContentConfig(
tools=[session], # auto tool calling
),
)
print(response.text)
asyncio.run(run())Parallel
Multiple independent calls in one turn. Results map back via id, return them in any order.
Compositional
Chained calls where step two depends on step one. Native in the Python SDK and Live API.
Multi-tool
Combine Google Search or Maps with custom functions in a single Gemini 3 request.
Tools
Google Search
Real-time web grounding. Gemini 3 models: 5,000 free prompts per month shared, then $14 per 1,000 queries.
Google Maps
Location and mapping grounding, supported on Gemini 3 models since March 2026.
Code Execution
Sandboxed Python the model can write and iterate on. Billed at standard token rates. Image output supported on Gemini 3.
URL Context
Fetch and inject page content as context. Charged as input tokens.
Computer Use
Screen vision plus UI actions for browser automation agents.
File Search
Multimodal since May 2026: natively embed and search images via gemini-embedding-2 with visual citations and page numbers.
Live API
Bidirectional audio and video streaming over WebSockets for real-time conversational agents. The flagship model is gemini-3.1-flash-live-preview, an audio-to-audio model with acoustic nuance detection. A dedicated Live Translate capability is now documented alongside the core Live API.
Optimization
Context Caching
Store system prompts and large docs server-side. Cached input on 3.5 Flash drops to $0.15 per 1M tokens.
Batch API
Async bulk processing at 50 percent of standard price on every current model.
Webhooks
New since May 4. Event-driven callbacks replace polling for Batch and long-running operations.
Flex Inference
Same 50 percent discount as Batch for latency-tolerant synchronous traffic.
Priority Inference
Roughly 1.8x standard pricing for guaranteed throughput and latency SLAs.
Files API
Upload once, reference by URI for 48 hours. Limit raised from 20MB to 100MB, plus Cloud Storage and pre-signed URL sources.
Pricing
| Model | Standard in / out | Batch + Flex | Priority |
|---|---|---|---|
Gemini 3.5 Flash gemini-3.5-flash | $1.50 / $9.00 | $0.75 / $4.50 | $2.70 / $16.20 |
Gemini 3.1 Pro Preview gemini-3.1-pro-preview | $2.00 / $12.00 | $1.00 / $6.00 | $3.60 / $21.60 |
Gemini 3 Flash Preview gemini-3-flash-preview | $0.50 / $3.00 | $0.25 / $1.50 | $0.90 / $5.40 |
Gemini 3.1 Flash-Lite gemini-3.1-flash-lite | $0.25 / $1.50 | $0.125 / $0.75 | $0.45 / $2.70 |
Gemini 2.5 Pro gemini-2.5-pro | $1.25 / $10.00 | $0.625 / $5.00 | $2.25 / $18.00 |
Gemini 2.5 Flash gemini-2.5-flash | $0.30 / $2.50 | $0.15 / $1.25 | $0.54 / $4.50 |
Gemini 2.5 Flash-Lite gemini-2.5-flash-lite | $0.10 / $0.40 | $0.05 / $0.20 | $0.18 / $0.72 |
Free tier
Generous limits in AI Studio and the API. Content may be used to improve Google products.
Paid tier
Higher rate limits, caching, Batch at 50 percent off. Content not used for training. Prepay and Postpay plans since March.
Grounding
Gemini 3: 5,000 free search prompts per month shared, then $14 per 1,000 queries. Gemini 2.5: 1,500 RPD then $35 per 1,000.
USD per 1M tokens, input / output. Pro rates shown for prompts up to 200k tokens. Full tables at ai.google.dev/gemini-api/docs/pricing.
Best Practices
Keep temperature at 1.0 on Gemini 3
Lowering it can cause looping or degraded reasoning on Gemini 3 models. Use low temperature (0) only on 2.5 series function calls.
Cap the active tool set at 10 to 20
Too many tools raises the risk of wrong selection. Use dynamic tool selection when your library is large.
Always echo the function call id
Gemini 3 returns a unique id per call. Include it in your functionResponse or the model cannot map the result.
Iterate the parts array
With built-in tools plus custom functions, functionCall is not guaranteed to be the last part. Never rely on position.
Validate consequential actions
Confirm with the user before executing orders, payments, sends, or deletes triggered by a function call.
Check finishReason every time
Handle safety blocks and malformed calls gracefully instead of assuming a clean response.
Use enums for fixed values
Strong typing plus enum constraints measurably improves argument accuracy.
Watch the deprecation page
Three model families were retired between June 1 and June 30 alone. Pin stable strings and subscribe to release notes.