Index of every page on this site: llms.txt
All skills
genkit-ai avatar

/developing-genkit-go

@d12c988
by Genkitgenkit-ai/skills40 stars
13
Run it yourself

Provides guidance on developing AI-powered applications using Genkit in Go. Use when the user asks to build AI features, agents, flows, or tools in Go using Genkit, or when working with Genkit Go code involving generation, prompts, streaming, tool calling, or model providers. Don't use for Genkit in JavaScript/TypeScript, Python, or Dart.

Use this Skill: https://skilld.dev/gh/genkit-ai/skills/developing-genkit-go

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

referencesproviders.md

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

Model Providers


Google AI (Gemini)

import "github.com/firebase/genkit/go/plugins/googlegenai"

g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))

Env var: GEMINI_API_KEY or GOOGLE_API_KEY

Model names follow the format googleai/<model-id>. Look up the latest model IDs at https://ai.google.dev/gemini-api/docs/models.

// By name string
ai.WithModelName("googleai/gemini-flash-latest")

// Model ref with provider-specific config
ai.WithModel(googlegenai.ModelRef("googleai/gemini-flash-latest", &genai.GenerateContentConfig{
	ThinkingConfig: &genai.ThinkingConfig{
		ThinkingBudget: genai.Ptr[int32](0), // disable thinking
	},
}))

// Lookup a model instance
m := googlegenai.GoogleAIModel(g, "gemini-flash-latest")

Vertex AI

import "github.com/firebase/genkit/go/plugins/googlegenai"

g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.VertexAI{}))

Env vars: GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION (or GOOGLE_CLOUD_REGION)

Uses Application Default Credentials (gcloud auth application-default login).

Model names follow the format vertexai/<model-id>. Same model IDs as Google AI.

ai.WithModelName("vertexai/gemini-flash-latest")

Anthropic (Claude)

import (
	"github.com/anthropics/anthropic-sdk-go"          // Anthropic SDK types
	ant "github.com/firebase/genkit/go/plugins/anthropic" // Genkit plugin
)

g := genkit.Init(ctx, genkit.WithPlugins(&ant.Anthropic{}))

Env var: ANTHROPIC_API_KEY

Model names follow the format anthropic/<model-id>. Look up the latest model IDs at https://docs.anthropic.com/en/docs/about-claude/models.

// By name
ai.WithModelName("anthropic/claude-sonnet-4-6")

// With provider-specific config (uses Anthropic SDK types via ai.WithConfig)
ai.WithConfig(&anthropic.MessageNewParams{
	Temperature: anthropic.Float(1.0),
	MaxTokens:   *anthropic.IntPtr(2000),
	Thinking: anthropic.ThinkingConfigParamUnion{
		OfEnabled: &anthropic.ThinkingConfigEnabledParam{
			BudgetTokens: *anthropic.IntPtr(1024),
		},
	},
})

OpenAI-Compatible (compat_oai)

Works with any OpenAI-compatible API: OpenAI, DeepSeek, xAI, etc.

import "github.com/firebase/genkit/go/plugins/compat_oai"

openaiPlugin := &compat_oai.OpenAICompatible{
	Provider: "openai",   // unique identifier
	APIKey:   os.Getenv("OPENAI_API_KEY"),
	// BaseURL: "https://custom-endpoint/v1", // for non-OpenAI providers
}
g := genkit.Init(ctx, genkit.WithPlugins(openaiPlugin))

Define models explicitly (not auto-discovered):

model := openaiPlugin.DefineModel("openai", "gpt-4o", compat_oai.ModelOptions{})

Use with:

ai.WithModel(model)

Ollama (Local Models)

import "github.com/firebase/genkit/go/plugins/ollama"

ollamaPlugin := &ollama.Ollama{
	ServerAddress: "http://localhost:11434",
	Timeout:       60, // seconds
}
g := genkit.Init(ctx, genkit.WithPlugins(ollamaPlugin))

Define models explicitly:

model := ollamaPlugin.DefineModel(g,
	ollama.ModelDefinition{
		Name: "llama3.1",
		Type: "chat", // or "generate"
	},
	nil, // optional *ModelOptions
)

Use with:

ai.WithModel(model)

Multiple Providers

Register multiple plugins in a single Genkit instance:

g := genkit.Init(ctx,
	genkit.WithPlugins(
		&googlegenai.GoogleAI{},
		&ant.Anthropic{},
	),
	genkit.WithDefaultModel("googleai/gemini-flash-latest"),
)

// Use different models per call
text1, _ := genkit.GenerateText(ctx, g,
	ai.WithModelName("googleai/gemini-flash-latest"),
	ai.WithPrompt("Hello from Gemini"),
)

text2, _ := genkit.GenerateText(ctx, g,
	ai.WithModelName("anthropic/claude-sonnet-4-6"),
	ai.WithPrompt("Hello from Claude"),
)

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 warning2d3 checks · Risk SAFE
  • Gen Agent Trust Hub3d

    The skill provides comprehensive documentation and code samples for developing AI applications with Genkit in Go. It includes instructions for installing the Genkit CLI from an official source and documents security features like tool approval and filesystem sandboxing. No malicious patterns were detected.

  • Socket2d

    No alerts

  • Snyk3d

    Risk: MEDIUM · 2 issues

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

Last checked against GitHub 4 days ago.

Activeupdated 5 days ago
metadata
{
  "version": "1.0.0",
  "category": "AiAndMachineLearning"
}

README badge

README badge for genkit-ai/skills/developing-genkit-go