Introduction¶
When writing Gemini API code in environments like Cursor or Claude Code, model names, SDK package names, and API shapes often conflict with “outdated” versions found in training data: generateContent and interactions coexist, as do the old google-generativeai and new google-genai packages. Furthermore, documentation is scattered across REST references and language-specific changelogs. Using the wrong model or adhering to deprecated interfaces can result in compilation failures or, worse, silent requests to legacy endpoints.
The following introduces gemini-api-dev, maintained by Google in the gemini-skills repository: it consolidates the current model list, SDK version constraints, migration instructions, and runnable examples into a single Agent Skill, prioritizing the constraint of assistant behavior before writing code.
What is this¶
gemini-api-dev is an Agent Skill provided by the Google Gemini team, located at skills/gemini-api-dev. The Skill metadata specifies that it should be enabled when calling the Gemini API for text generation, multi-turn dialogue, multimodal understanding, image/video/audio generation, streaming output, background research tasks, function calling, structured output, or when migrating from the legacy generateContent. It covers SDK usage and best practices for Python and TypeScript (officialskills.sh also notes that it includes guidance for building applications in Go and Java scenarios).
The core positioning can be summarized as: using “Critical Rules” to override outdated assistant knowledge and pointing to the references/ documentation within the repository and hosted documentation pages, rather than just providing scattered code snippets.
Core Features¶
The following content is sourced from the official SKILL.md and skills directory descriptions, listing only the explicitly documented capabilities.
Model and Agent Lists¶
The Skill enforces the use of “Current Models” as per the documentation and marks gemini-2.5-*, gemini-2.0-*, gemini-1.5-*, etc., as legacy models that must not be selected; if a user specifies a deprecated model, it should be replaced with gemini-3.8-flash and the substitution explained.
The model types listed in the documentation include (excerpt):
- General & Reasoning:
gemini-4-argon,gemini-3.8-flash,gemini-3.5-flash-lite,gemini-3.1-flash-lite - Speech-to-Text:
gemini-3.5-transcribe - Image:
gemini-nano-banana-2.1,gemini-3-pro-image,gemini-3.1-flash-lite-image - TTS:
gemini-3.8-flash-tts,gemini-3.8-flash-lite-tts - Video:
gemini-omni-1.1-flash - Gemma 4 Open Weights:
gemma-4-31b-it,gemma-4-26b-a4b-it - Embedding:
gemini-embedding-2(multimodal),gemini-embedding-001(text-only)
Hosted Agents include antigravity-preview-09-2026, deep-research-preview-04-2026, deep-research-max-preview-04-2026, and support for custom Agents via client.agents.create().
SDK and API Shapes¶
Current SDK requirements:
| Language | Package Name | Minimum Version | Installation |
|---|---|---|---|
| Python | google-genai |
>= 2.30.1 |
pip install -U google-genai |
| JavaScript/TypeScript | @google/genai |
>= 2.29.1 |
npm install @google/genai |
SDK 2.0.0 and above use the new steps schema and no longer support the legacy schema. Old packages google-generativeai (Python) and @google/generative-ai (JS) are marked as deprecated in the Skill and must not be used.
The invocation entry point is primarily client.interactions.create (as seen in Quick Start examples), and the response object provides convenient fields such as output_text, output_image, and output_audio.
Development and Migration Guide¶
The Skill requires fetching the corresponding hosted documentation page based on the task before writing any code (the examples within the Skill are minimal sets; full parameters and edge cases are in the documentation).
Other hard constraints include:
- Interactions default to
store=True(Python) /store: true(TS); paid tiers retain data for 55 days, free tiers for 1 day. Setting tofalseopts out of storage but disablesprevious_interaction_idandbackground=True. tools,system_instruction, andgeneration_configare interaction-scoped and must be passed again in every turn.- Hosted Agents require
environment="remote"(or an Environment ID / config object) to provision sandboxes. - Migrating from
generateContentor upgrading Flash / TTS / Nano Banana image models requires reading the repository’sreferences/migration.mdand confirming the scope with the user first, as per Skill requirements.
Capabilities summarized by the official skills site also include: multimodal input, function calling, structured JSON, code execution, context caching, embeddings, etc.; specific APIs are subject to the documentation pointed to by the Skill.
Installation and Enablement¶
In assistant environments supporting Agent Skills, you can use the officially recommended CLI to install the entire gemini-skills repository and enable only this Skill:
npx skills add https://github.com/google-gemini/gemini-skills --skill gemini-api-dev
You can also provide the Skill directory link to your coding assistant for installation:
https://github.com/google-gemini/gemini-skills/tree/main/skills/gemini-api-dev
Regarding environment variables, the Quick Start uses the default genai.Client() / new GoogleGenAI({}), which relies on the API Key configuration methods agreed upon by each SDK (specific fields depend on the current SDK documentation; the Skill body does not elaborate on IDE differences, so we do not speculate on proprietary configuration items for Cursor / Codex CLI here).
Typical Usage¶
Single-turn Text Generation¶
On the Python side, create a client and call interactions.create, using gemini-3.8-flash as the example model:
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Tell me a short joke about programming."
)
print(interaction.output_text)
TypeScript equivalent:
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "Tell me a short joke about programming.",
});
console.log(interaction.output_text);
Multi-turn Stateful Dialogue¶
The second turn associates with the previous interaction.id via previous_interaction_id, relying on server-side context retention under store=True:
interaction1 = client.interactions.create(
model="gemini-3.8-flash",
input="Hi, my name is Phil."
)
interaction2 = client.interactions.create(
model="gemini-3.8-flash",
input="What is my name?",
previous_interaction_id=interaction1.id
)
print(interaction2.output_text)
Deep Research Background Task¶
Use the Agent name deep-research-preview-04-2026 (or the max version), set background=True, and poll client.interactions.get until the status is completed or failed:
import time
interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Research the history of Google TPUs.",
background=True
)
while True:
interaction = client.interactions.get(interaction.id)
if interaction.status == "completed":
print(interaction.output_text)
break
elif interaction.status == "failed":
print(f"Failed: {interaction.error}")
break
time.sleep(10)
Use Cases and Notes¶
Who it is for: Developers building applications or Agents using the Gemini 3.x / 4.x model series and the new google-genai SDK; teams migrating from the old generateContent or legacy SDK who want to prevent coding assistants from auto-filling legacy model names.
When to enable (according to officialskills.sh): Tasks involving structured JSON, function calling, audio/video document multimodal parsing, multi-turn chat, and semantic retrieval via corpus embeddings.
Points to note:
- The Skill explicitly states that rules take precedence over assistant training data; however, you should still have the assistant fetch the corresponding documentation page as required by the Skill before generating code, to avoid relying solely on the minimal examples within the Skill.
- Default interaction storage involves retention policies and privacy considerations; if
previous_interaction_idor background tasks are not needed, understand the side effects ofstore=False. - Model and Agent names iterate with preview versions; rely on the Current Models / Current Agents section in the repository’s
SKILL.mdrather than old names found in public tutorials.
The Gemini API and SDK iterate rapidly. The value of the official Skill lies in solidifying “what to use right now” into mandatory rules for the assistant, linking to migration checklists and documentation entry points, and reducing the manual cost of comparing discovery specs and multiple changelogs.
Official URL: https://github.com/google-gemini/gemini-skills/tree/main/skills/gemini-api-dev