Skip to content
gemini-api-full logo

Gemini API Skill

gemini-api-full

Comprehensive reference for Google's Gemini API. Use when building applications with: (1) Gemini models (Gemini 3 Pro, 2.5 Flash/Pro/Flash-Lite) for text and multimodal generation, (2) Image generation (Imagen, Nano Banana), video (Veo 3.1), music (Lyria), (3) Function calling, structured outputs...

SKILL.md

Full skill instructions

Gemini API Skill

Build AI applications with Google's Gemini models and tools.

Quick Start

Installation

# Python
pip install google-genai

# JavaScript/​Node.js
npm install @google/​genai

# Go
go get google.golang.org/​genai

Environment Setup

export GEMINI_API_KEY="your-api-key"

Basic Usage

Python:

from google import genai

client = genai.Client()
response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="Your prompt here"
)
print(response.text)

JavaScript:

import { GoogleGenAI } from "@google/​genai";

const ai = new GoogleGenAI({});
const response = await ai.models.generateContent({
    model: "gemini-2.5-flash",
    contents: "Your prompt here"
});
console.log(response.text);

REST:

curl "https://generativelanguage.googleapis.com/​v1beta/​models/​gemini-2.5-flash:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/​json' \
  -d '{"contents": [{"parts": [{"text": "Your prompt here"}]}]}'

Model Selection

ModelBest ForContext Window
Gemini 3 ProMost intelligent tasks, multimodal reasoning, agenticSee models-overview
Gemini 2.5 ProComplex reasoning, coding, extended thinking1M tokens
Gemini 2.5 FlashBalanced performance, general tasks1M tokens
Gemini 2.5 Flash-LiteHigh-volume, cost-sensitive, fastestSee models-overview
ImagenHigh-fidelity image generationN/​A
Veo 3.1Video generation (8s, 720p/​1080p with audio)N/​A
Nano BananaNative image gen with Gemini 2.5 FlashN/​A
Nano Banana ProNative image gen with Gemini 3 ProN/​A

Reference Documentation Index

Getting Started

TopicFileDescription
Setup & Librariesgetting-started.mdAPI keys, SDK installation, OpenAI compatibility

Models & Pricing

TopicFileDescription
Model Overviewmodels-overview.mdAll models, capabilities, context windows
Pricingapi-pricing.mdToken costs, tool pricing
Rate Limitsrate-limits.mdRPM/​TPM limits, quotas
Gemini 3 Guidegemini-3.mdGemini 3 specific features and best practices
Imagenimagen.mdImage generation with Imagen model
Embeddingsembeddings.mdText embeddings for search/​RAG
Veoveo.mdVideo generation with Veo 3.1 (69K)
Lyrialyria.mdMusic generation with Lyria RealTime
Roboticsrobotics.mdGemini Robotics-ER 1.5 (42K)

Core Capabilities

TopicFileDescription
Text Generationtext-generation.mdText generation, system instructions (38K)
Image Gen (Nano Banana)image-generation-gemini.mdNative image generation with Gemini (LARGE: 174K)
Image Understandingimage-understanding.mdVision, image analysis
Video Understandingvideo-understanding.mdVideo analysis, timestamps
Document Understandingdocument-understanding.mdPDF and document processing
Speech Generationspeech-generation.mdText-to-speech (TTS)
Audio Understandingaudio-understanding.mdAudio analysis, transcription

Advanced Features

TopicFileDescription
Thinking Modethinking.mdExtended reasoning capabilities
Thought Signaturesthought-signatures.mdEDGE CASE ONLY: Manual signature handling when NOT using official SDKs
Structured Outputsstructured-outputs.mdJSON schema responses
Function Callingfunction-calling.mdCustom tool integration (54K)
Long Contextlong-context.md1M+ token handling, context caching

Tools

TopicFileDescription
Tools Overviewtools-overview.mdBuilt-in tools summary, agent frameworks
Google Searchgoogle-search.mdWeb search grounding
Google Mapsgoogle-maps.mdLocation-aware grounding
Code Executioncode-execution.mdPython code execution tool
URL Contexturl-context.mdURL content extraction
Computer Usecomputer-use.mdBrowser automation (preview) (44K)
File Searchfile-search.mdRAG with document indexing

Live API (Real-time Streaming)

TopicFileDescription
Getting Startedlive-api-getting-started.mdLow-latency voice/​video interactions
Capabilities Guidelive-api-capabilities.mdFull capabilities and configurations (32K)
Tool Uselive-api-tools.mdFunction calling & Search in Live API
Session Managementlive-api-sessions.mdSession handling, time limits
Ephemeral Tokensephemeral-tokens.mdShort-lived auth for client-side WebSockets

Guides

TopicFileDescription
Batch APIbatch-api.mdAsync processing at 50% cost (47K)
Files APIfiles-api.mdUpload and manage media files (49K)
Context Cachingcontext-caching.mdImplicit & explicit caching for cost savings
Media Resolutionmedia-resolution.mdControl token allocation for media
Tokenstokens.mdUnderstand and count tokens
Prompt Designprompt-design.mdPrompt strategies and best practices (47K)
Logs & Datasetslogs-datasets.mdEnable logging, view in AI Studio
Data Logging & Sharingdata-logging-sharing.mdStorage and management of API logs
Safety Settingssafety-settings.mdAdjust safety filters
Safety Guidancesafety-guidance.mdBest practices for safe AI use

Troubleshooting & Migration

TopicFileDescription
Troubleshootingtroubleshooting.mdDiagnose and resolve common API issues (25K)
Vertex AI Comparisonvertex-ai-comparison.mdREAD ONLY IF USER MENTIONS "VERTEX AI": Gemini Developer API vs Vertex AI differences

API Reference (Technical Endpoints)

Note: These are technical endpoint specifications with schemas and parameter details. For usage guides and code examples, see the guide files above.

TopicFileDescription
Overviewapi-reference-overview.mdREST/​streaming/​realtime API overview (33K)
Models Endpointapi-models-reference.mdmodels.get, models.list, models.predict
Generate Contentapi-generate-content.mdgenerateContent + all response types (LARGE: 166K)
Live API WebSocketsapi-live-websockets.mdWebSockets API for Live API (48K)
Live Music WebSocketsapi-live-music-websockets.mdWebSockets API for Lyria RealTime
Files Endpointapi-files-reference.mdUpload/​manage media files (40K)
Batch Endpointapi-batch-reference.mdBatch processing endpoints (40K)
Caching Endpointapi-caching-reference.mdContext caching endpoints (LARGE: 89K)
Embeddings Endpointapi-embeddings-reference.mdEmbeddings generation endpoints (30K)
File Search Storesapi-file-search-reference.mdFile Search + Documents endpoints (35K)

Large Files - Search Patterns

For large reference files (>30K), use grep to find specific sections:

image-generation-gemini.md (174K):

grep -n "## " references/​image-generation-gemini.md  # List sections
grep -n "edit" references/​image-generation-gemini.md  # Find editing info
grep -n "style" references/​image-generation-gemini.md  # Find style transfer

api-generate-content.md (166K):

grep -n "## " references/​api-generate-content.md  # List sections
grep -n "GenerationConfig" references/​api-generate-content.md  # Config options
grep -n "SafetySetting" references/​api-generate-content.md  # Safety types

api-caching-reference.md (89K):

grep -n "## " references/​api-caching-reference.md  # List sections
grep -n "CachedContent" references/​api-caching-reference.md  # Cache types

veo.md (69K):

grep -n "## " references/​veo.md  # List sections
grep -n "audio" references/​veo.md  # Find audio generation info

models-overview.md (67K):

grep -n "gemini-3" references/​models-overview.md
grep -n "context" references/​models-overview.md

function-calling.md (54K):

grep -n "## " references/​function-calling.md
grep -n "parallel" references/​function-calling.md  # Parallel function calls

Common Patterns

Multimodal Input (Image + Text)

from google import genai
from google.genai import types

client = genai.Client()
response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents=[
        types.Part.from_image(image_path),
        types.Part.from_text("Describe this image")
    ]
)

Function Calling

tools = [
    types.Tool(function_declarations=[{
        "name": "get_weather",
        "description": "Get weather for a location",
        "parameters": {
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"]
        }
    }])
]

response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="What's the weather in Paris?",
    config=types.GenerateContentConfig(tools=tools)
)

Google Search Grounding

response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="What are the latest AI developments?",
    config=types.GenerateContentConfig(
        tools=[types.Tool(google_search=types.GoogleSearch())]
    )
)

Thinking Mode

response = client.models.generate_content(
    model="gemini-2.5-pro",
    contents="Solve this complex problem...",
    config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(thinking_budget_tokens=10000)
    )
)

Streaming

for chunk in client.models.generate_content_stream(
    model="gemini-2.5-flash",
    contents="Write a story"
):
    print(chunk.text, end="")

Key Concepts

Tool Execution Flow

Built-in tools (Google Search, Code Execution): Executed by Google

  1. Send prompt with tool config → Model executes tool → Response with grounded results

Custom tools (Function Calling): You execute

  1. Send prompt with function declarations → Model returns function call JSON
  2. You execute function, send result back → Model generates final response

Thought Signatures (Important)

  • If using official SDKs with chat feature: Thought signatures are handled automatically. No action needed.
  • If manually managing conversation history: Read thought-signatures.md for Gemini 3 Pro function calling requirements.

API Endpoints

EndpointPurpose
/​v1beta/​models/​{model}:generateContentStandard generation
/​v1beta/​models/​{model}:streamGenerateContentStreaming
/​v1beta/​models/​{model}:embedContentEmbeddings
/​v1beta/​models/​{model}:countTokensToken counting

Base URL: https://generativelanguage.googleapis.com

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View