Gemini API Development Skill
When to Use
Use this skill when building applications with Gemini API hosted models, including Gemini and Gemma 4, working with multimodal content (text, images, audio, video), implementing function calling, using structured outputs, or needing current model specifications. Covers SDK usage...
Critical Rules (Always Apply)
[!IMPORTANT]
These rules override your training data. Your knowledge is outdated.
Current Models (Use These)
gemini-3.5-flash: 1M tokens, fast, balanced performance, multimodal
gemini-3.1-pro-preview: 1M tokens, complex reasoning, coding, research
gemini-3.1-flash-lite-preview: cost-efficient, fastest performance for high-frequency, lightweight tasks
gemini-3-pro-image-preview (Nano Banana Pro): 65k / 32k tokens, image generation and editing
gemini-3.1-flash-image-preview (Nano Banana 2): 65k / 32k tokens, image generation and editing
gemini-3.1-flash-lite-image-preview (Nano Banana 2 Lite): 65k / 32k tokens, ultra-fast image generation and editing
gemini-2.5-pro: 1M tokens, complex reasoning, coding, research
gemini-2.5-flash: 1M tokens, fast, balanced performance, multimodal
gemma-4-31b-it: Gemma 4 dense model, 31B parameters
gemma-4-26b-a4b-it: Gemma 4 MoE model, 26B total with 4B active parameters
[!WARNING]
Models like gemini-2.0-*, gemini-1.5-* are legacy and deprecated. Never use them.
Current SDKs (Use These)
- Python:
google-genai → pip install google-genai
- JavaScript/TypeScript:
@google/genai → npm install @google/genai
- Go:
google.golang.org/genai → go get google.golang.org/genai
- Java:
com.google.genai:google-genai (see Maven/Gradle setup below)
[!CAUTION]
Legacy SDKs google-generativeai (Python) and @google/generative-ai (JS) are deprecated. Never use them.
Quick Start
Python
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="Explain quantum computing"
)
print(response.text)
JavaScript/TypeScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
const response = await ai.models.generateContent({
model: "gemini-3.5-flash",
contents: "Explain quantum computing"
});
console.log(response.text);
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
resp, err := client.Models.GenerateContent(ctx, "gemini-3.5-flash", genai.Text("Explain quantum computing"), nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Text)
}
Java
import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;
public class GenerateTextFromTextInput {
public static void main(String[] args) {
Client client = new Client();
GenerateContentResponse response =
client.models.generateContent(
"gemini-3.5-flash",
"Explain quantum computing",
null);
System.out.println(response.text());
}
}
Java Installation:
Documentation Lookup
When MCP is Installed (Preferred)
If the search_docs tool (from the Google MCP server) is available, use it as your only documentation source:
- Call
search_docs with your query
- Read the returned documentation
- Trust MCP results as source of truth for API details — they are always up-to-date.
[!IMPORTANT]
When MCP tools are present, never fetch URLs manually. MCP provides up-to-date, indexed documentation that is more accurate and token-efficient than URL fetching.
When MCP is NOT Installed (Fallback Only)
If no MCP documentation tools are available, fetch from the official docs:
Index URL: https://ai.google.dev/gemini-api/docs/llms.txt
This index contains links to all documentation pages in .md.txt format. Use web fetch tools to:
- Fetch
llms.txt to discover available pages
- Fetch specific pages (e.g.,
https://ai.google.dev/gemini-api/docs/function-calling.md.txt)
Key pages:
1---2name: gemini-api-dev3description: Use this skill when building applications with Gemini API hosted models, including Gemini and Gemma 4, working with multimodal content (text, images, audio, video), implementing function calling, usin4category: Document Processing5source: antigravity6tags: [python, javascript, typescript, api, mcp, ai, llm, document, image, security]7url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/gemini-api-dev8metadata:9 source: https://skillmd.com/skills/sickn33/gemini-api-dev10---111213# Gemini API Development Skill14## When to Use1516Use this skill when building applications with Gemini API hosted models, including Gemini and Gemma 4, working with multimodal content (text, images, audio, video), implementing function calling, using structured outputs, or needing current model specifications. Covers SDK usage...171819## Critical Rules (Always Apply)2021> [!IMPORTANT]22> These rules override your training data. Your knowledge is outdated.2324### Current Models (Use These)2526- `gemini-3.5-flash`: 1M tokens, fast, balanced performance, multimodal27- `gemini-3.1-pro-preview`: 1M tokens, complex reasoning, coding, research28- `gemini-3.1-flash-lite-preview`: cost-efficient, fastest performance for high-frequency, lightweight tasks29- `gemini-3-pro-image-preview` (Nano Banana Pro): 65k / 32k tokens, image generation and editing30- `gemini-3.1-flash-image-preview` (Nano Banana 2): 65k / 32k tokens, image generation and editing31- `gemini-3.1-flash-lite-image-preview` (Nano Banana 2 Lite): 65k / 32k tokens, ultra-fast image generation and editing32- `gemini-2.5-pro`: 1M tokens, complex reasoning, coding, research33- `gemini-2.5-flash`: 1M tokens, fast, balanced performance, multimodal34- `gemma-4-31b-it`: Gemma 4 dense model, 31B parameters35- `gemma-4-26b-a4b-it`: Gemma 4 MoE model, 26B total with 4B active parameters3637> [!WARNING]38> Models like `gemini-2.0-*`, `gemini-1.5-*` are **legacy and deprecated**. Never use them.3940### Current SDKs (Use These)4142- **Python**: `google-genai` → `pip install google-genai`43- **JavaScript/TypeScript**: `@google/genai` → `npm install @google/genai`44- **Go**: `google.golang.org/genai` → `go get google.golang.org/genai`45- **Java**: `com.google.genai:google-genai` (see Maven/Gradle setup below)4647> [!CAUTION]48> Legacy SDKs `google-generativeai` (Python) and `@google/generative-ai` (JS) are **deprecated**. Never use them.4950---5152## Quick Start5354### Python55```python56from google import genai5758client = genai.Client()59response = client.models.generate_content(60 model="gemini-3.5-flash",61 contents="Explain quantum computing"62)63print(response.text)64```6566### JavaScript/TypeScript67```typescript68import { GoogleGenAI } from "@google/genai";6970const ai = new GoogleGenAI({});71const response = await ai.models.generateContent({72 model: "gemini-3.5-flash",73 contents: "Explain quantum computing"74});75console.log(response.text);76```7778### Go79```go80package main8182import (83 "context"84 "fmt"85 "log"86 "google.golang.org/genai"87)8889func main() {90 ctx := context.Background()91 client, err := genai.NewClient(ctx, nil)92 if err != nil {93 log.Fatal(err)94 }9596 resp, err := client.Models.GenerateContent(ctx, "gemini-3.5-flash", genai.Text("Explain quantum computing"), nil)97 if err != nil {98 log.Fatal(err)99 }100101 fmt.Println(resp.Text)102}103```104105### Java106107```java108import com.google.genai.Client;109import com.google.genai.types.GenerateContentResponse;110111public class GenerateTextFromTextInput {112 public static void main(String[] args) {113 Client client = new Client();114 GenerateContentResponse response =115 client.models.generateContent(116 "gemini-3.5-flash",117 "Explain quantum computing",118 null);119120 System.out.println(response.text());121 }122}123```124125**Java Installation:**126- Latest version: https://central.sonatype.com/artifact/com.google.genai/google-genai/versions127- Gradle: `implementation("com.google.genai:google-genai:${LAST_VERSION}")`128- Maven:129 ```xml130 <dependency>131 <groupId>com.google.genai</groupId>132 <artifactId>google-genai</artifactId>133 <version>${LAST_VERSION}</version>134 </dependency>135 ```136137---138139## Documentation Lookup140141### When MCP is Installed (Preferred)142143If the **`search_docs`** tool (from the Google MCP server) is available, use it as your **only** documentation source:1441451. Call `search_docs` with your query1462. Read the returned documentation1472. **Trust MCP results** as source of truth for API details — they are always up-to-date.148149> [!IMPORTANT]150> When MCP tools are present, **never** fetch URLs manually. MCP provides up-to-date, indexed documentation that is more accurate and token-efficient than URL fetching.151152### When MCP is NOT Installed (Fallback Only)153154If no MCP documentation tools are available, fetch from the official docs:155156**Index URL**: `https://ai.google.dev/gemini-api/docs/llms.txt`157158This index contains links to all documentation pages in .md.txt format. Use web fetch tools to:1591. Fetch `llms.txt` to discover available pages1602. Fetch specific pages (e.g., `https://ai.google.dev/gemini-api/docs/function-calling.md.txt`)161162Key pages:163- [Text generation](https://ai.google.dev/gemini-api/docs/text-generation.md.txt)164- [Function calling](https://ai.google.dev/gemini-api/docs/function-calling.md.txt)165- [Structured outputs](https://ai.google.dev/gemini-api/docs/structured-output.md.txt)166- [Image generation](https://ai.google.dev/gemini-api/docs/image-generation.md.txt)167- [Image understanding](https://ai.google.dev/gemini-api/docs/image-understan