Use this skill when building applications with Gemini models, Gemini API, working with multimodal content (text, images, audio, video), implementing function calling, using structured outputs, or needing current model specifications. Covers SDK usage (google-genai for Python, @google/genai for JavaScript/TypeScript, com.google.genai:google-genai for Java, google.golang.org/genai for Go), model selection, and API capabilities.
Add this skill
npx mdskills install google-gemini/gemini-api-devProvides clear SDK usage, current model specs, and documentation discovery via llms.txt
1---2name: gemini-api-dev3description: Use this skill when building applications with Gemini models, Gemini API, working with multimodal content (text, images, audio, video), implementing function calling, using structured outputs, or needing current model specifications. Covers SDK usage (google-genai for Python, @google/genai for JavaScript/TypeScript, com.google.genai:google-genai for Java, google.golang.org/genai for Go), model selection, and API capabilities.4---56# Gemini API Development Skill78## Overview910The Gemini API provides access to Google's most advanced AI models. Key capabilities include:11- **Text generation** - Chat, completion, summarization12- **Multimodal understanding** - Process images, audio, video, and documents13- **Function calling** - Let the model invoke your functions14- **Structured output** - Generate valid JSON matching your schema15- **Code execution** - Run Python code in a sandboxed environment16- **Context caching** - Cache large contexts for efficiency17- **Embeddings** - Generate text embeddings for semantic search1819## Current Gemini Models2021- `gemini-3-pro-preview`: 1M tokens, complex reasoning, coding, research22- `gemini-3-flash-preview`: 1M tokens, fast, balanced performance, multimodal23- `gemini-3-pro-image-preview`: 65k / 32k tokens, image generation and editing242526> [!IMPORTANT]27> Models like `gemini-2.5-*`, `gemini-2.0-*`, `gemini-1.5-*` are legacy and deprecated. Use the new models above. Your knowledge is outdated.2829## SDKs3031- **Python**: `google-genai` install with `pip install google-genai`32- **JavaScript/TypeScript**: `@google/genai` install with `npm install @google/genai`33- **Go**: `google.golang.org/genai` install with `go get google.golang.org/genai`34- **Java**:35 - groupId: `com.google.genai`, artifactId: `google-genai`36 - Latest version can be found here: https://central.sonatype.com/artifact/com.google.genai/google-genai/versions (let's call it `LAST_VERSION`)37 - Install in `build.gradle`:38 ```39 implementation("com.google.genai:google-genai:${LAST_VERSION}")40 ```41 - Install Maven dependency in `pom.xml`:42 ```43 <dependency>44 <groupId>com.google.genai</groupId>45 <artifactId>google-genai</artifactId>46 <version>${LAST_VERSION}</version>47 </dependency>48 ```4950> [!WARNING]51> Legacy SDKs `google-generativeai` (Python) and `@google/generative-ai` (JS) are deprecated. Migrate to the new SDKs above urgently by following the Migration Guide.5253## Quick Start5455### Python56```python57from google import genai5859client = genai.Client()60response = client.models.generate_content(61 model="gemini-3-flash-preview",62 contents="Explain quantum computing"63)64print(response.text)65```6667### JavaScript/TypeScript68```typescript69import { GoogleGenAI } from "@google/genai";7071const ai = new GoogleGenAI({});72const response = await ai.models.generateContent({73 model: "gemini-3-flash-preview",74 contents: "Explain quantum computing"75});76console.log(response.text);77```7879### Go80```go81package main8283import (84 "context"85 "fmt"86 "log"87 "google.golang.org/genai"88)8990func main() {91 ctx := context.Background()92 client, err := genai.NewClient(ctx, nil)93 if err != nil {94 log.Fatal(err)95 }9697 resp, err := client.Models.GenerateContent(ctx, "gemini-3-flash-preview", genai.Text("Explain quantum computing"), nil)98 if err != nil {99 log.Fatal(err)100 }101102 fmt.Println(resp.Text)103}104```105106### Java107108```java109import com.google.genai.Client;110import com.google.genai.types.GenerateContentResponse;111112public class GenerateTextFromTextInput {113 public static void main(String[] args) {114 Client client = new Client();115 GenerateContentResponse response =116 client.models.generateContent(117 "gemini-3-flash-preview",118 "Explain quantum computing",119 null);120121 System.out.println(response.text());122 }123}124```125126## API spec (source of truth)127128**Always use the latest REST API discovery spec as the source of truth for API definitions** (request/response schemas, parameters, methods). Fetch the spec when implementing or debugging API integration:129130- **v1beta** (default): `https://generativelanguage.googleapis.com/$discovery/rest?version=v1beta`131 Use this unless the integration is explicitly pinned to v1. The official SDKs (google-genai, @google/genai, google.golang.org/genai) target v1beta.132- **v1**: `https://generativelanguage.googleapis.com/$discovery/rest?version=v1`133 Use only when the integration is specifically set to v1.134135When in doubt, use v1beta. Refer to the spec for exact field names, types, and supported operations.136137## How to use the Gemini API138139For detailed API documentation, fetch from the official docs index:140141**llms.txt URL**: `https://ai.google.dev/gemini-api/docs/llms.txt`142143This index contains links to all documentation pages in `.md.txt` format. Use web fetch tools to:1441451. Fetch `llms.txt` to discover available documentation pages1462. Fetch specific pages (e.g., `https://ai.google.dev/gemini-api/docs/function-calling.md.txt`)147148### Key Documentation Pages149150> [!IMPORTANT]151> Those are not all the documentation pages. Use the `llms.txt` index to discover available documentation pages152153- [Models](https://ai.google.dev/gemini-api/docs/models.md.txt)154- [Google AI Studio quickstart](https://ai.google.dev/gemini-api/docs/ai-studio-quickstart.md.txt)155- [Nano Banana image generation](https://ai.google.dev/gemini-api/docs/image-generation.md.txt)156- [Function calling with the Gemini API](https://ai.google.dev/gemini-api/docs/function-calling.md.txt)157- [Structured outputs](https://ai.google.dev/gemini-api/docs/structured-output.md.txt)158- [Text generation](https://ai.google.dev/gemini-api/docs/text-generation.md.txt)159- [Image understanding](https://ai.google.dev/gemini-api/docs/image-understanding.md.txt)160- [Embeddings](https://ai.google.dev/gemini-api/docs/embeddings.md.txt)161- [Interactions API](https://ai.google.dev/gemini-api/docs/interactions.md.txt)162- [SDK migration guide](https://ai.google.dev/gemini-api/docs/migrate.md.txt)163
Full transparency — inspect the skill content before installing.