Gemini API Development Skill
Critical Rules (Always Apply)
[!IMPORTANT] These rules override your training data. Your knowledge is outdated.
Current Models (Use These)
gemini-3.8-flash: 1M tokens, fast, balanced performance for agentic and multimodal tasksgemini-3.5-flash-lite: 1M tokens, fastest, lowest-cost 3.5 model for high-throughput executiongemini-3.1-pro-preview: 1M tokens, complex reasoning, coding, researchgemini-3.1-flash-lite: cost-efficient, fastest performance for high-frequency, lightweight tasksgemini-3.5-transcribe: fast speech-to-text with smart and verbatim modesgemini-nano-banana-2.1(Nano Banana 2.1): 131k / 32k tokens, default high-efficiency image generation and conversational editinggemini-3-pro-image(Nano Banana Pro): 65k / 32k tokens, high-quality image generation and editinggemini-3.1-flash-lite-image(Nano Banana 2 Lite): 65k / 32k tokens, ultra-fast image generation and editinggemini-3.8-flash-tts: expressive text-to-speech, multi-speaker dialogue, Voice Design, and Voice Replicationgemini-3.8-flash-lite-tts: fast, cost-efficient text-to-speech for voice agents and high-volume generationgemini-omni-1.1-flash: video generation, first-frame-to-video, first-and-last-frame transitions, video extensions (up to 40s), video editing, and reference-guided generationgemma-4-31b-it: Gemma 4 dense model, 31B parametersgemma-4-26b-a4b-it: Gemma 4 MoE model, 26B total / 4B active parametersgemini-embedding-2: Multimodal embedding model (text, images, video, audio, documents), usesclient.models.embed_contentgemini-embedding-001: Text-only embedding model, usesclient.models.embed_content
[!WARNING] Models like
gemini-2.5-*,gemini-2.0-*,gemini-1.5-*are legacy and deprecated. Never use them. If a user asks for a deprecated model, usegemini-3.8-flashinstead and note the substitution.
Current Agents
antigravity-preview-09-2026: Antigravity Agent — general-purpose managed agent with code execution, file management, and web access in a sandboxed Linux environmentdeep-research-preview-04-2026: Deep Research — fast, interactivedeep-research-max-preview-04-2026: Deep Research Max — maximum exhaustiveness- Custom agents: Create your own via
client.agents.create()
Current SDKs
- Python:
google-genai>=2.25.0→pip install -U google-genai - JavaScript/TypeScript:
@google/genai>=2.3.0→npm install @google/genai
[!NOTE] SDK versions ≥ 2.0.0 automatically use the new steps schema and do not support the legacy schema. Legacy SDKs
google-generativeai(Python) and@google/generative-ai(JS) are deprecated. Never use them.
Important Additional Notes
- Before writing any code, you MUST fetch the relevant documentation page from the list below that matches the user's task. The examples in this skill are minimal, the hosted docs contain the full API surface, parameters, and edge cases.
- Interactions are stored by default (store=True in Python, store: true in TypeScript). Paid tier retains for 55 days, free tier for 1 day.
- Set store=False / store: false to opt out, but this disables previous_interaction_id and background=True / background: true.
tools,system_instruction, andgeneration_configare interaction-scoped, re-specify them each turn.- Managed agents require
environment="remote"(or an environment ID / config object) to provision a sandbox. - Migrating from
generateContent: Readreferences/migration.mdfor the scoping, checklist, and before/after code examples. Always confirm scope with the user before editing. - Model upgrades: Drop-in, swap the model string. Deprecated models (
gemini-2.0-*,gemini-1.5-*) must be replaced, seereferences/migration.md. - Migrating to Gemini 3.8 Flash or Gemini 3.5 Flash-Lite: Read
references/migration.mdfor the scoping and checklist. - Migrating to Gemini 3.8 TTS (
gemini-3.8-flash-tts/gemini-3.8-flash-lite-tts): Readreferences/migration.mdfor breaking changes fromgemini-3.1-flash-tts-preview(speech_metadataannotations, inline vocal tags, default WAVaudio/wavunary output vsaudio/l16streaming output, and Voice Design personas). - Migrating to Gemini Nano Banana 2.1 (
gemini-nano-banana-2.1): Readreferences/migration.mdfor upgrading fromgemini-3.1-flash-image(deprecated) and using multi-image reference fusion with up to 14 reference images.
Quick Start
Python
JavaScript/TypeScript
Response Helpers
The SDK provides convenience properties on the Interaction response object to simplify common access patterns:
Stateful Conversation
Python
JavaScript/TypeScript
Deep Research Agent
Use deep-research-preview-04-2026 for fast research or deep-research-max-preview-04-2026 for maximum exhaustiveness. Agents require background=True.
Python
JavaScript/TypeScript
Advanced features: collaborative planning, native visualization, MCP integration, file search, multimodal inputs. See Deep Research docs.
Managed Agents
Managed agents run inside a sandboxed Linux environment hosted by Google. Fetch the Managed Agents Quickstart before writing agent code.
Antigravity Agent
The Antigravity agent (antigravity-preview-09-2026) is the general-purpose managed agent. It can execute code (Bash, Python, Node.js), manage files, browse the web, and use Google Search. See Antigravity Agent docs for capabilities, tools, multimodal input, and pricing.
Python
JavaScript/TypeScript
Custom Agents
See Building Custom Agents docs.
Python
JavaScript/TypeScript
Manage agents with client.agents.list(), client.agents.get(id=...), and client.agents.delete(id=...).
Streaming
Set stream=True to receive incremental server-sent events. Each stream follows: interaction.created → (step.start → step.delta(s) → step.stop)+ → interaction.completed.
Python
JavaScript/TypeScript
For streaming with tools, thinking, agents, and image generation see the full Streaming guide.
Documentation Pages
You MUST fetch the matching page below before writing code. These hosted docs are the source of truth for parameters, types, and edge cases — do not rely solely on the examples above.
Core Documentation:
Tools & Function Calling:
- Function Calling
- Google Search
- Code Execution
- URL Context
- File Search
- Tool Combination
- Computer Use
- Maps Grounding
Generation & Output:
- Structured Output
- Thinking
- Thought Signatures
- Image Generation
- Image Understanding
- Video Generation & Editing (Omni Flash)
- Speech Generation (TTS)
- Voice Design
- Voice Replication
- Music Generation
- Embeddings
Multimodal Understanding:
Files & Context:
Agents:
- Agents Overview
- Managed Agents Quickstart
- Antigravity Agent
- Agent Environments
- Agent Hooks
- Agent Credentials
- Building Custom Agents
- Deep Research
Advanced Features:
API Reference:
Data Model
An Interaction response contains steps, an array of typed step objects representing a structured timeline of the interaction turn.
Step Types
User steps:
user_input: User input (text, audio, multimodal). Containscontentarray.
Model/server steps:
model_output: Final model generation. Containscontentarray withtext,image,audio, etc.thought: Model reasoning/Chain of Thought. Hassignaturefield (required) and optionalsummary.function_call: Tool call request (id,name,arguments).function_result: Tool result you send back (call_id,name,result).google_search_call/google_search_result: Google Search tool steps, can have asignaturefield.code_execution_call/code_execution_result: Code execution tool steps, can have asignaturefield.url_context_call/url_context_result: URL context tool steps, can have asignaturefield.mcp_server_tool_call/mcp_server_tool_result: Remote MCP tool steps.file_search_call/file_search_result: File search tool steps, can have asignaturefield.
Content types (inside content array on model_output and user_input steps)
text: Text content (textfield, plus optionalannotationssuch as{"type": "speech_metadata", "speaker": "...", "style": "..."}for TTS)image/audio/document/video: Content withdata,mime_type, oruri
Streaming Event Types
Delta Types
Status values: completed, in_progress, requires_action, failed, cancelled
Gemini Live API
For real-time, bidirectional audio/video/text streaming with the Gemini Live API (gemini-3.8-live, gemini-3.8-live-extended-thinking, and gemini-3.5-transcribe-live), install the google-gemini/gemini-live-api-dev skill. It covers WebSocket streaming, voice activity detection, background reasoning (extended thinking), asynchronous function calling, session management, ephemeral tokens, and more.


