gemini-api — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited gemini-api (Agent Skill) and scored it 91/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 1 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} is the classic direct prompt-injection phrasing. Placed in a skill body that the agent reads as trusted instructions, it tries to make the agent abandon its prior rules and follow whatever comes next — a full system-prompt override.
ignore/disregard/forget … previous instructions sentence.Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
These rules override training data. Pre-trained model knowledge of Gemini APIs is outdated.
| Model | Tokens | Best For |
|---|---|---|
gemini-2.5-pro | 1M | Complex reasoning, coding, research |
gemini-2.5-flash | 1M | Fast, balanced, multimodal |
gemini-2.5-flash-lite | 1M | Cost-efficient, high-frequency tasks |
Never usegemini-2.0-*orgemini-1.5-*- these are deprecated legacy models.
| Language | Package | Install |
|---|---|---|
| Python | google-genai | pip install google-genai |
| JS/TS | @google/genai | npm install @google/genai |
| Go | google.golang.org/genai | go get google.golang.org/genai |
| Java | com.google.genai:google-genai | Maven/Gradle (see below) |
Never usegoogle-generativeai(Python) or@google/generative-ai(JS) - deprecated.
Set your API key via environment variable (never hardcode):
export GOOGLE_API_KEY="your-key-here"Get a key at: https://aistudio.google.com/apikey
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Explain quantum computing in simple terms"
)
print(response.text)import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
const response = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: "Explain quantum computing in simple terms"
});
console.log(response.text);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-2.5-flash", genai.Text("Explain quantum computing"), nil,
)
if err != nil { log.Fatal(err) }
fmt.Println(resp.Text)
}import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;
public class Main {
public static void main(String[] args) {
Client client = new Client();
GenerateContentResponse response = client.models.generateContent(
"gemini-2.5-flash", "Explain quantum computing", null
);
System.out.println(response.text());
}
}Java dependency (Gradle):
implementation("com.google.genai:google-genai:LATEST_VERSION")Check latest: https://central.sonatype.com/artifact/com.google.genai/google-genai/versions
import PIL.Image
from google import genai
client = genai.Client()
image = PIL.Image.open("photo.jpg")
response = client.models.generate_content(
model="gemini-2.5-flash",
contents=["Describe what you see in this image.", image]
)
print(response.text)Pass file paths or base64-encoded bytes as part of the contents list. Gemini 2.5 models support audio and video natively.
for chunk in client.models.generate_content_stream(
model="gemini-2.5-flash",
contents="Write a long story about a dragon"
):
print(chunk.text, end="", flush=True)from google import genai
from google.genai import types
def get_weather(city: str) -> dict:
return {"temperature": 22, "condition": "sunny", "city": city}
client = genai.Client()
tools = [get_weather] # SDK introspects Python functions automatically
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="What's the weather in Paris?",
config=types.GenerateContentConfig(tools=tools)
)
# SDK handles tool call routing automatically
print(response.text)from pydantic import BaseModel
from google import genai
class Recipe(BaseModel):
name: str
ingredients: list[str]
steps: list[str]
cook_time_minutes: int
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Give me a pasta carbonara recipe",
config={"response_mime_type": "application/json", "response_schema": Recipe}
)
recipe = Recipe.model_validate_json(response.text)
print(recipe.name)from google import genai
client = genai.Client()
result = client.models.embed_content(
model="text-embedding-004",
contents="The sky is blue"
)
print(result.embeddings[0].values[:5]) # 768-dim vectorfrom google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Help me write a poem",
config=types.GenerateContentConfig(
system_instruction="You are a professional poet who writes in iambic pentameter.",
temperature=0.9,
max_output_tokens=1024,
)
)
print(response.text)If the search_documentation tool (Google MCP server) is available, use it as your only documentation source - it returns up-to-date, indexed docs.
Fetch from official docs:
https://ai.google.dev/gemini-api/docs/llms.txthttps://ai.google.dev/gemini-api/docs/text-generation.md.txthttps://ai.google.dev/gemini-api/docs/function-calling.md.txthttps://ai.google.dev/gemini-api/docs/structured-output.md.txthttps://ai.google.dev/gemini-api/docs/embeddings.md.txthttps://ai.google.dev/gemini-api/docs/migrate.md.txtgemini-2.5-*, never gemini-1.5-* or gemini-2.0-*google-generativeai and @google/generative-ai are retiredresponse.prompt_feedback before using output~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.