All skills
google avatar

/gemini-api

@becc4b8
by googlegoogle/skills21k stars
1,698

Use when the user asks about using Gemini in an enterprise environment or explicitly mentions Vertex AI, Google Cloud, or Agent Platform. Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like multimodal inputs, tools, media generation, caching, batch prediction, and Live API.

Use this Skill: https://skilld.dev/gh/google/skills/gemini-api

This session only. Nothing lands on disk.

referencestext_and_multimodal.md

≈619 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Text and Multimodal Generation

Basic Text Generation

from google import genai

client = genai.Client()
response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents="How does AI work?",
)
print(response.text)

Chat (Multi-turn conversations)

from google import genai
from google.genai import types

client = genai.Client()
chat_session = client.chats.create(
    model="gemini-3.8-flash",
    history=[
        types.UserContent(
            parts=[
                types.Part.from_text(
                    text="Hello",
                )
            ]
        ),
        types.ModelContent(
            parts=[
                types.Part.from_text(
                    text="Great to meet you. What would you like to know?"
                )
            ]
        ),
    ],
)
response = chat_session.send_message("Tell me a story.")
print(response.text)

Synchronous Streaming

Generate content in a streaming format so that the model outputs streams back to you, rather than being returned as one chunk.

from google import genai
from google.genai import types

client = genai.Client()
for chunk in client.models.generate_content_stream(
    model="gemini-3.8-flash", contents="Tell me a story in 300 words."
):
    print(chunk.text, end="")

Multimodal Inputs (Images, Audio, Video)

You can provide files natively using Google Cloud Storage URIs or local bytes.

from google import genai
from google.genai import types

client = genai.Client()

gcs_image = types.Part.from_uri(
    file_uri="gs://cloud-samples-data/generative-ai/image/scones.jpg",
    mime_type="image/jpeg",
)

with open("local_image.jpg", "rb") as f:
    local_image = types.Part.from_bytes(data=f.read(), mime_type="image/jpeg")

response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents=[
        "Generate a list of all the objects contained in both images.",
        gcs_image,
        local_image,
    ],
)
print(response.text)

YouTube Videos

from google import genai
from google.genai import types

client = genai.Client()
response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents=[
        types.Part.from_uri(
            file_uri="https://www.youtube.com/watch?v=3KtWfp0UopM",
            mime_type="video/mp4",
        ),
        "Write a short and engaging blog post based on this video.",
    ],
)
print(response.text)

Source: SKILL.md on GitHub

1 warning9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    This skill provides a detailed integration guide for the Gemini API. It includes security considerations such as prompts designed to override the agent's internal knowledge of model versions, instructional safety filter examples that use provocative content, and the demonstration of dynamic code execution and external tool integration via MCP. These elements are presented as educational samples but should be reviewed when implementing in production.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: MEDIUM · 1 issue

Signed by skilld at becc4b8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
metadata
{
  "version": "1.0.0",
  "category": "AiAndMachineLearning"
}
compatibility
Requires active Google Cloud credentials and Agent Platform API enabled.

README badge

README badge for google/skills/gemini-api