Gemini API Developer Guide

AUDITED · JUL 15 2026 · ai.google.dev

← tech-stack
Live audit · 10 changes since May 23

Google AI Studio
& Gemini API

The complete developer reference. Every model, endpoint, and price verified against live Google documentation on July 15, 2026.

May 23 → Jul 15

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.

NEWJul 2026

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.

NEWJul 2026

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.

NEWJun 2026

Streaming TTS support

streamGenerateContent (and stream: true in the Interactions API) now supported for gemini-3.1-flash-tts-preview.

SHUTDOWNJun 30, 2026

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.

SHUTDOWNJun 25, 2026

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.

BREAKINGJun 8, 2026

Interactions API schema finalized

Legacy outputs schema removed. The new steps schema and response_format configuration are now the only supported format.

SHUTDOWNJun 1, 2026

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.

GAMay 28, 2026

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).

SHUTDOWNMay 25, 2026

Flash-Lite preview retired

gemini-3.1-flash-lite-preview shut down. The GA model gemini-3.1-flash-lite replaces it.

GAMay 19, 2026

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.

Setup

Getting Started

01

Get a key

Free at aistudio.google.com/apikey. One key covers AI Studio and the API.

02

Export it

Set GEMINI_API_KEY as an environment variable. SDKs pick it up automatically.

03

Install + call

Install the GenAI SDK for your language and make your first generateContent call.

Install the SDK

Python
pip install -q -U google-genai

First request · gemini-3.5-flash

Python
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)
Catalog · verified Jul 15

Model Catalog

GA

Gemini 3.5 Flash

gemini-3.5-flash

Most intelligent model for sustained frontier performance on agentic and coding tasks. The current flagship.

IN $1.50OUT $9.00
Preview

Gemini 3.1 Pro Preview

gemini-3.1-pro-preview

Advanced intelligence, complex problem solving, powerful agentic and vibe coding. Custom tools endpoint available.

IN $2.00 to $4.00OUT $12.00 to $18.00
Preview

Gemini 3 Flash Preview

gemini-3-flash-preview

Frontier-class performance rivaling larger models at a fraction of the cost.

IN $0.50OUT $3.00
GA

Gemini 3.1 Flash-Lite

gemini-3.1-flash-lite

Most cost-efficient model, optimized for high-volume agentic tasks, translation, and data processing.

IN $0.25OUT $1.50
Preview

Gemini Omni Flash

gemini-omni-flash-preview

New in July. Natively multimodal video generation and conversational video editing from text, image, and video inputs.

IN Video outOUT $0.10/sec
GA

Gemini 2.5 Pro

gemini-2.5-pro

Deep reasoning and coding, 1M token context window with adaptive thinking.

IN $1.25 to $2.50OUT $10.00 to $15.00
GA

Gemini 2.5 Flash

gemini-2.5-flash

Best price-performance for low-latency, high-volume reasoning workloads.

IN $0.30OUT $2.50
GA

Gemini 2.5 Flash-Lite

gemini-2.5-flash-lite

Fastest and most budget-friendly multimodal model in the 2.5 family.

IN $0.10OUT $0.40
GA

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.

IN $0.50OUT $60/1M img tok
New

Nano Banana 2 Lite

nano-banana-2-lite

New in July. Fastest and most cost-efficient Gemini image model, launched at Google I/O.

IN TBAOUT TBA
GA

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.

IN $2.00OUT $0.134 to $0.24/img
Preview

Veo 3.1

veo-3.1-generate-preview

Cinematic video with synchronized audio. Standard, Fast, and Lite variants. Veo 3 GA retired June 30.

IN Per secondOUT $0.05 to $0.60/sec
GA

Imagen 4

imagen-4.0-generate-001

Text-to-image up to 2K. Fast, Standard, and Ultra variants.

IN Per imageOUT $0.02 to $0.06
Preview

Lyria 3

lyria-3-pro-preview

Full-length song generation (Pro) and 30-second clips (Clip). 48kHz stereo from text and image inputs.

IN Per songOUT $0.04 to $0.08
Preview

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.

IN $0.75 textOUT $4.50 text
Preview

3.1 Flash TTS

gemini-3.1-flash-tts-preview

Steerable speech generation with expressive audio tags. Streaming support added June 2026.

IN $1.00OUT $20.00 audio
Preview

Antigravity Agent

antigravity-preview-05-2026

General-purpose managed agent. Plans, reasons, runs code, manages files, and browses the web in a Linux sandbox.

IN Model ratesOUT Model rates
Preview

Deep Research

deep-research-preview-04-2026

Autonomous multi-step research across hundreds of sources with cited reports. Max variant for full comprehensiveness.

IN Model ratesOUT Model rates
Preview

Computer Use

gemini-2.5-computer-use-preview-10-2025

Sees a screen and performs UI actions: clicking, typing, navigating. Browser automation agents.

IN $1.25 to $2.50OUT $10 to $15
GA

Gemini Embedding 2

gemini-embedding-2

Multimodal embedding across text, images, video, audio, and PDFs in a unified space. GA since April.

IN $0.20 textOUT n/a
Preview

Robotics-ER 1.6

gemini-robotics-er-1.6-preview

Embodied reasoning for physical spaces: instrument reading, spatial and physical reasoning.

IN $1.00OUT $5.00

Prices per 1M tokens, standard paid tier, unless noted. Pro tier prices shown for prompts up to 200k tokens.

Connect to the world

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.

AUTO

Default. Model chooses between text or a function call.

ANY

Always calls a function, guaranteed schema adherence.

NONE

Function calls prohibited, tools stay defined.

VALIDATED

Preview. Calls or text, both schema-validated.

Automatic function calling

Python
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

Python
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.

Built-in

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.

Real-time

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.

Native audio-to-audio dialogue with sub-second latency
Compositional function calling built in
Session resumption across network drops, up to 24 hours
Ephemeral tokens for secure client-side connections
Configurable voice activity detection and interruption handling
Live Translate for real-time speech translation
Cost + latency

Optimization

Verified Jul 15

Pricing

ModelStandard in / outBatch + FlexPriority
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.

From Google's docs

Best Practices

01

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.

02

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.

03

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.

04

Iterate the parts array

With built-in tools plus custom functions, functionCall is not guaranteed to be the last part. Never rely on position.

05

Validate consequential actions

Confirm with the user before executing orders, payments, sends, or deletes triggered by a function call.

06

Check finishReason every time

Handle safety blocks and malformed calls gracefully instead of assuming a clean response.

07

Use enums for fixed values

Strong typing plus enum constraints measurably improves argument accuracy.

08

Watch the deprecation page

Three model families were retired between June 1 and June 30 alone. Pin stable strings and subscribe to release notes.

Official links

Resources