Google Cloud

Gemini API Complete Guide: Pricing, Model Selection, Multimodal, Function Calling

2026-05-24
NicheeLab Editorial Team

The Gemini API is Google's latest multimodal LLM family, with the Gemini 2.0 generation rolling out from 2024 onward. Three tiers (Flash / Pro / Ultra) deliver 75% cost reduction via Context Cache, up to 2 million tokens of context, and built-in Tool Use, placing it alongside OpenAI and Anthropic as a top-tier LLM API.

Model Family (2026)

ModelContextInput ($/M tok)Output ($/M tok)Use Case
Gemini 2.0 Flash1M$0.075$0.30Chat / summarization / lightweight tasks
Gemini 2.0 Pro2M$1.25$5.00RAG / code generation / reasoning
Gemini Ultra2MCustomCustomEnterprise advanced reasoning
Gemma 2 (OSS)8kFreeFreeEdge / on-premises

Google AI Studio vs Vertex AI

ItemGoogle AI StudioVertex AI
Use casePersonal / PoCProduction / Enterprise
Free tierGenerous (RPD limited)$300 credit
AuthAPI KeyIAM / Service Account
CMEKYes
VPC SCYes
SLA99.9%
Data UseMay be used for trainingNot used (default)

Key Features

  • Multimodal: text + image + audio + video + PDF
  • Long Context: 1M / 2M tokens
  • Function Calling: Tool Use, parallel execution, Strict mode
  • Code Execution: sandboxed Python execution (Pro)
  • Context Caching: 75% input token discount
  • Grounding with Google Search: cite up-to-date information
  • JSON Mode: enforce structured output
  • Streaming: incremental responses via SSE
  • Batch API: async with 50% discount

Python Sample (Vertex AI SDK)

from vertexai.generative_models import GenerativeModel, Part
import vertexai

vertexai.init(project="my-project", location="asia-northeast1")
model = GenerativeModel("gemini-2.0-flash-001")

# Text
response = model.generate_content("What is the capital of Japan?")
print(response.text)

# Multimodal (image + text)
image = Part.from_uri("gs://my-bucket/photo.jpg", mime_type="image/jpeg")
response = model.generate_content([image, "Describe this image"])

# Function Calling
from vertexai.generative_models import Tool, FunctionDeclaration

weather_func = FunctionDeclaration(
    name="get_weather",
    description="Get current weather",
    parameters={
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"],
    },
)
tools = [Tool(function_declarations=[weather_func])]
response = model.generate_content(
    "What is the weather in Tokyo?", tools=tools
)

Context Caching Pattern

from vertexai.preview import caching
from datetime import datetime, timedelta

# Cache the system prompt plus a long document
cached_content = caching.CachedContent.create(
    model_name="gemini-2.0-pro-001",
    system_instruction="You are an internal FAQ bot",
    contents=[long_document],
    ttl=timedelta(hours=1),
)

# Using the cache (75% discount on input)
model = GenerativeModel.from_cached_content(cached_content)
response = model.generate_content("How do I request time off?")

Comparison with Other LLM APIs

ItemGemini 2.0 FlashGPT-4o miniClaude Haiku 3.5
Input ($/M tok)$0.075$0.15$0.80
Output ($/M tok)$0.30$0.60$4.00
Context1M128k200k
MultimodalExcellent (incl. video)Yes (image)Yes (image)
ItemGemini 2.0 ProGPT-4oClaude Sonnet 3.5
Input ($/M tok)$1.25$2.50$3.00
Output ($/M tok)$5.00$10.00$15.00
Context2M128k200k

Typical Use Cases

  • RAG (internal document search + answering)
  • Video content analysis and summarization
  • Multimodal OCR + structured extraction
  • Code generation + refactoring
  • Agents (external API integration via Tool Use)
  • Multilingual translation (100+ languages)

Should I use Google AI Studio or Vertex AI for the Gemini API?

Use Google AI Studio for personal projects and PoCs (generous free tier); use Vertex AI for production and enterprise (CMEK / VPC SC / SLA). Both serve the same Gemini models, but auth, billing, and SLAs differ.

What's the difference between Gemini 2.0 Flash and Pro?

Flash = low latency, low cost, 1M tokens (chat, summarization). Pro = higher accuracy, 2M tokens (RAG, code generation). Flash covers 99% of use cases.

How much does Gemini cost?

Flash: $0.075/M input tokens, $0.30/M output tokens. Pro: $1.25/M input, $5.00/M output. That's 5-10x cheaper than GPT-4o and roughly on par with Claude Sonnet.

What multimodal inputs are supported?

Text + image + audio + video + PDF inputs are supported. Pro can process up to 2 hours of video, Flash up to 1 hour, in a single request.

What about Function Calling?

An OpenAI-compatible Tool Use API. Supports automatic function invocation, parallel execution, and Strict mode for strict JSON Schema adherence.

What is Context Caching?

Cache large reusable contexts (system prompts + documents) to cut input token pricing by 75%. Hugely effective for RAG and chatbots.

What is Grounding with Google Search?

Available on Pro. Grounds responses on live Google Search results. Priced at $35 per 1,000 requests.

How do I configure the Safety Filter?

Four categories (Harassment / Hate Speech / Sexually Explicit / Dangerous Content) each with 4 thresholds (BLOCK_NONE / FEW / SOME / MOST). The default is SOME.

Related Articles & Gen AI

Vertex AI Fundamentals for GCP Certs (2026)

Vertex AI basics every cert candidate needs — Workbench, Pipelines, Model Garden, Endpoints.

Vertex AI Agent Builder Detailed Guide (2026)

Agent Builder — Conversational Agents, Agent Engine, data stores. The agent platform on GCP.

Vertex AI vs SageMaker vs Azure ML (2026)

Three managed ML platforms compared — feature parity, training/serving, MLOps maturity.

Gemini vs GPT vs Claude: LLM Comparison for Builders (2026)

Honest LLM comparison — Gemini, OpenAI GPT, Anthropic Claude. Capability, cost, ergonomics in 2026.

* Google and Gemini are trademarks of Google LLC. For the latest information, see the Vertex AI Gen AI official docs.

Check what you learned with practice questions

Practice with certification-focused question sets

View GCP Exam Prep
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Google Cloud

Google Cloud Certification Roadmap (2026)

Choose your GCP certification path — Foundational, Associate...

Google Cloud

CDL Cloud Digital Leader: Complete Exam Guide (2026)

Pass the Cloud Digital Leader exam — cloud business value, G...

Google Cloud

GAIL Generative AI Leader: Complete Exam Guide (2026)

Pass the Generative AI Leader exam — Gemini, Vertex AI, Work...

Google Cloud

Vertex AI Fundamentals for GCP Certs (2026)

Vertex AI basics every cert candidate needs — Workbench, Pip...

Google Cloud

Associate Cloud Engineer (ACE): Complete Guide (2026)

Pass the Associate Cloud Engineer exam — Console, gcloud, pr...

Browse all Google Cloud articles (103)
© 2026 NicheeLab All rights reserved.