This guide walks you through adding Genkit to a Go module, writing your first AI-powered function, and exploring it with the local Developer UI.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/genkit-ai/genkit/llms.txt
Use this file to discover all available pages before exploring further.
Get a Google AI API key
Genkit’s Google AI plugin uses the Gemini API. Get a free API key from Google AI Studio.
Set the key as an environment variable before running your app:The
googlegenai.GoogleAI plugin also accepts GOOGLE_API_KEY. You can pass the key directly in the plugin struct (&googlegenai.GoogleAI{APIKey: "..."}) but using an environment variable keeps credentials out of source control.Add Genkit to your Go module
Initialize a new module (or open an existing one), then fetch the Genkit packages:Install the Genkit CLI to get the Developer UI:
Explore with the Developer UI
The Genkit CLI wraps your app with tracing and launches a local Developer UI where you can run flows interactively and inspect execution traces.This starts your app, then opens the Developer UI at
http://localhost:4000. From there you can:- Run the
tellJokeflow with any input without restarting your app. - Inspect traces to see the full request and response sent to Gemini.
- Compare models by switching between
gemini-2.5-flashandgemini-2.5-proin real time.
Add structured output (optional)
genkit.GenerateData uses Go generics to return type-safe, unmarshaled structs:Next steps
Concepts: Flows
Learn how flows add observability, retries, and HTTP exposure to any AI function.
Concepts: Models
Understand model references, config options, multimodal inputs, and streaming.
Guides: Structured output
Return validated, type-safe structs from any model call using Go generics.
Guides: Streaming
Stream tokens to the client as they arrive using
genkit.GenerateStream.Guides: Agents
Build multi-step agentic workflows with
genkit.DefineTool and looping.Plugins: Google AI
Full reference for the
googlegenai plugin including Vertex AI, Imagen, and embeddings.Plugins overview
Browse all available plugins: Vertex AI, Ollama, Anthropic, and more.
Developer tools
Deep dive into the Genkit CLI and Developer UI.
