Index of every page on this site: llms.txt
All skills
google avatar

/gemini-api

@5fb62c2
by googlegoogle/skills24k stars
2,026
Run it yourself

Integrates Gemini models on Gemini platform (formerly Gemini Enterprise Agent Platform and Vertex AI) using the unified Google Gen AI SDK across Python, TypeScript/JavaScript, Go, Java, and C#. Use for Google Cloud AI workloads: text/multimodal generation, structured JSON, function calling, Search grounding, code execution, URL context, Nano Banana images, Gemini Omni and Veo video, TTS, Lyria music, embeddings, caching, batch, thinking, safety, Live API, or model tuning. Don't use for server-managed stateful agent sessions (gemini-interactions-api), Managed Agent CRUD (gemini-agents-api), raw BidiGenerateContent WebSocket scaffolding/audio debugging (gemini-live-api), open-model SFT or tuning job management (agent-platform-tuning, agent-platform-tuning-management), or OpenMaaS, OpenAI SDK, numeric endpoints, and 429 DSQ debugging (agent-platform-inference).

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

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessdks.md

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

Language SDK Quick Starts (TypeScript, Go, Java, C#)

Contents

Set standard Gemini platform env vars (GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION="global", GOOGLE_GENAI_USE_ENTERPRISE=true) or pass explicit client parameters as shown. For Express Mode API key auth, set GOOGLE_API_KEY + GOOGLE_GENAI_USE_ENTERPRISE=true and unset GOOGLE_CLOUD_PROJECT/GOOGLE_CLOUD_LOCATION (or pass apiKey in TS/Java/C#, APIKey in Go, alongside enterprise/BackendEnterprise without project/location). Do not use deprecated legacy packages (@google-cloud/vertexai, cloud.google.com/go/vertexai, google-cloud-vertexai).

TypeScript / JavaScript (@google/genai)

Install: npm install @google/genai

import { GoogleGenAI } from "@google/genai";

// Uses GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION if no args passed:
// const ai = new GoogleGenAI();
const ai = new GoogleGenAI({
  enterprise: true, // boolean flag (do not pass a nested object)
  project: "your-project-id",
  location: "global",
});

const response = await ai.models.generateContent({
  model: "gemini-4-hydrogen",
  contents: "Explain quantum computing",
});
console.log(response.text);

Go (google.golang.org/genai)

Install: go get google.golang.org/genai

package main

import (
	"context"
	"fmt"
	"log"

	"google.golang.org/genai"
)

func main() {
	ctx := context.Background()
	// Pass nil to read GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION from env.
	client, err := genai.NewClient(ctx, &genai.ClientConfig{
		Backend:  genai.BackendEnterprise,
		Project:  "your-project-id",
		Location: "global",
	})
	if err != nil {
		log.Fatal(err)
	}

	resp, err := client.Models.GenerateContent(ctx, "gemini-4-hydrogen", genai.Text("Explain quantum computing"), nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp.Text())
}

Java (com.google.genai:google-genai)

Requires 2.6.0 or newer (see Maven Central for the latest 2.x release):

  • Gradle (build.gradle): implementation("com.google.genai:google-genai:2.6.0")
  • Maven (pom.xml):
    <dependency>
      <groupId>com.google.genai</groupId>
      <artifactId>google-genai</artifactId>
      <version>2.6.0</version>
    </dependency>
import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;

public class GenerateTextFromTextInput {
  public static void main(String[] args) {
    // new Client() reads GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION
    Client client =
        Client.builder()
            .enterprise(true)
            .project("your-project-id")
            .location("global")
            .build();

    GenerateContentResponse response =
        client.models.generateContent("gemini-4-hydrogen", "Explain quantum computing", null);
    System.out.println(response.text());
  }
}

C# / .NET (Google.GenAI)

Install: dotnet add package Google.GenAI

using Google.GenAI;

// new Client() reads GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION
using var client = new Client(
    enterprise: true,
    project: "your-project-id",
    location: "global"
);

var response = await client.Models.GenerateContentAsync(
    model: "gemini-4-hydrogen",
    contents: "Explain quantum computing"
);
Console.WriteLine(response.Text);

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alerttoday3 checks · Risk SAFE
  • Gen Agent Trust Hubtoday

    This skill provides a comprehensive integration for the Google Gemini platform using official SDKs. It includes detailed references for text and multimodal generation, structured output, and advanced features such as model tuning and MCP support. The skill follows standard security practices for authentication and safety filtering.

  • Socket1d

    No alerts

  • Snyktoday

    Risk: CRITICAL · 2 issues

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

Last checked against GitHub yesterday.

Activeupdated yesterday
metadata
{
  "version": "1.0.4",
  "category": "AiAndMachineLearning"
}
Other metadata
compatibility
Requires active Google Cloud credentials, billing enabled, and the Gemini platform API (aiplatform.googleapis.com) enabled.

README badge

README badge for google/skills/gemini-api