Built and used in production by Google, Genkit is an open-source library with tools to help you build AI-powered experiences
Get started with just a few lines of code.
import
{ genkit }
from
'genkit'
;
import
{ googleAI }
from
'@genkit-ai/google-genai'
;
const
ai
=
genkit
({ plugins: [
googleAI
()] });
const
{
text
}
=
await
ai.
generate
({
model: googleAI.
model
(
'gemini-2.5-flash'
),
prompt:
'Why is Genkit awesome?'
});
import
{ genkit }
from
'genkit'
;
import
{ googleAI }
from
'@genkit-ai/google-genai'
;
const
ai
=
genkit
({ plugins: [
googleAI
()] });
const
{
media
}
=
await
ai.
generate
({
model: googleAI.
model
(
'imagen-3.0-generate-002'
),
prompt:
'a banana riding a bicycle'
,
});
import
{ genkit }
from
'genkit'
;
import
{ openAI }
from
'@genkit-ai/compat-oai/openai'
;
const
ai
=
genkit
({ plugins: [
openAI
()] });
const
{
text
}
=
await
ai.
generate
({
model: openAI.
model
(
'gpt-4o'
),
prompt:
'Why is Genkit awesome?'
});
import
{ genkit }
from
'genkit'
;
import
{ anthropic, claude35Sonnet }
from
'genkitx-anthropic'
;
const
ai
=
genkit
({ plugins: [
anthropic
()] });
const
{
text
}
=
await
ai.
generate
({
model: claude35Sonnet,
prompt:
'Why is Genkit awesome?'
});
import
{ genkit }
from
'genkit'
;
import
{ xAI }
from
'@genkit-ai/compat-oai/xai'
;
const
ai
=
genkit
({ plugins: [
xAI
()] });
const
{
text
}
=
await
ai.
generate
({
model: xAI.
model
(
'grok-3-mini'
),
prompt:
'Why is Genkit awesome?'
,
});
import
{ genkit }
from
'genkit'
;
import
{ deepSeek }
from
'@genkit-ai/compat-oai/deepseek'
;
const
ai
=
genkit
({ plugins: [
deepSeek
()] });
const
{
text
}
=
await
ai.
generate
({
model: deepSeek.
model
(
'deepseek-chat'
),
prompt:
'Why is Genkit awesome?'
,
});
import
{ genkit }
from
'genkit'
;
import
{ ollama }
from
'genkitx-ollama'
;
const
ai
=
genkit
({ plugins: [
ollama
()] });
const
{
text
}
=
await
ai.
generate
({
model: ollama.
model
(
'gemma3:latest'
),
prompt:
'Why is Genkit awesome?'
,
});
import
(
"
context
"
"
log
"
"
github.com/firebase/genkit/go/ai
"
"
github.com/firebase/genkit/go/genkit
"
"
github.com/firebase/genkit/go/plugins/googlegenai
"
)
func
main
() {
ctx
:=
context.
Background
()
g
:=
genkit.
Init
(ctx, genkit.
WithPlugins
(
&
googlegenai
.
GoogleAI
{}))
resp, err
:=
genkit.
Generate
(ctx, g,
ai.
WithPrompt
(
"Why is Genkit awesome?"
),
ai.
WithModelName
(
"googleai/gemini-2.5-flash"
),
)
if
err
!=
nil
{
log.
Fatal
(err)
}
log.
Println
(resp.
Text
())
}
import
(
"
context
"
"
fmt
"
"
log
"
"
github.com/firebase/genkit/go/ai
"
"
github.com/firebase/genkit/go/genkit
"
"
github.com/firebase/genkit/go/plugins/googlegenai
"
)
func
main
() {
ctx
:=
context.
Background
()
g
:=
genkit.
Init
(ctx, genkit.
WithPlugins
(
&
googlegenai
.
GoogleAI
{}))
resp, err
:=
genkit.
Generate
(ctx, g,
ai.
WithPrompt
(
"a banana riding a bicycle"
),
ai.
WithModelName
(
"googleai/imagen-3.0-generate-002"
),
)
if
err
!=
nil
{
log.
Fatal
(err)
}
log.
Printf
(
"Generated image:
%s
"
, resp.
Media
().URL)
}
import
(
"
context
"
"
log
"
"
github.com/firebase/genkit/go/ai
"
"
github.com/firebase/genkit/go/genkit
"
"
github.com/firebase/genkit/go/plugins/compat_oai/openai
"
)
func
main
() {
ctx
:=
context.
Background
()
g
:=
genkit.
Init
(ctx, genkit.
WithPlugins
(
&
openai
.
OpenAI
{}))
resp, err
:=
genkit.
Generate
(ctx, g,
ai.
WithPrompt
(
"Why is Genkit awesome?"
),
ai.
WithModelName
(
"openai/gpt-4o"
),
)
if
err
!=
nil
{
log.
Fatal
(err)
}
log.
Println
(resp.
Text
())
}
import
(
"
context
"
"
log
"
"
github.com/firebase/genkit/go/ai
"
"
github.com/firebase/genkit/go/genkit
"
"
github.com/firebase/genkit/go/plugins/compat_oai/anthropic
"
)
func
main
() {
ctx
:=
context.
Background
()
g
:=
genkit.
Init
(ctx, genkit.
WithPlugins
(
&
anthropic
.
Anthropic
{}))
resp, err
:=
genkit.
Generate
(ctx, g,
ai.
WithPrompt
(
"Why is Genkit awesome?"
),
ai.
WithModelName
(
"anthropic/claude-3-7-sonnet-20250219"
),
)
if
err
!=
nil
{
log.
Fatal
(err)
}
log.
Println
(resp.
Text
())
}
import
(
"
context
"
"
log
"
"
github.com/firebase/genkit/go/ai
"
"
github.com/firebase/genkit/go/genkit
"
"
github.com/firebase/genkit/go/plugins/ollama
"
)
func
main
() {
ctx
:=
context.
Background
()
g
:=
genkit.
Init
(ctx, genkit.
WithPlugins
(
&
ollama
.
Ollama
{
ServerAddress:
"http://localhost:11434"
,
},
}))
resp, err
:=
genkit.
Generate
(ctx, g,
ai.
WithPrompt
(
"Why is Genkit awesome?"
),
ai.
WithModelName
(
"ollama/gemma3:latest"
),
)
if
err
!=
nil
{
log.
Fatal
(err)
}
log.
Println
(resp.
Text
())
}
from
genkit.ai
import
Genkit
from
genkit.plugins.google_genai
import
GoogleAI
ai
=
Genkit(
plugins
=
[GoogleAI()],
)
response
=
await
ai.generate(
model
=
'googleai/gemini-2.5-flash'
,
prompt
=
'Why is Genkit awesome?'
)
print
(response.text)
from
genkit.ai
import
Genkit
from
genkit.plugins.google_genai
import
GoogleAI
ai
=
Genkit(
plugins
=
[GoogleAI()],
)
response
=
await
ai.generate(
model
=
'googleai/imagen-3.0-generate-002'
,
prompt
=
'a banana riding a bicycle'
)
# Access generated media
if
response.media:
print
(
f
"Generated image:
{
response.media.url
}
"
)
from
genkit.ai
import
Genkit
from
genkit.plugins.compat_oai
import
OpenAI
ai
=
Genkit(
plugins
=
[OpenAI()],
)
response
=
await
ai.generate(
model
=
'openai/gpt-4o'
,
prompt
=
'Why is Genkit awesome?'
)
print
(response.text)
from
genkit.ai
import
Genkit
from
genkit.plugins.ollama
import
Ollama
from
genkit.plugins.ollama.models
import
ModelDefinition
ai
=
Genkit(
plugins
=
[
Ollama(
models
=
[
ModelDefinition(
name
=
'gemma3:latest'
),
],
)
],
)
response
=
await
ai.generate(
model
=
"ollama/gemma3:latest"
,
prompt
=
'Why is Genkit awesome?'
)
print
(response.text)
The fastest way to build, test, and deploy real AIfeatures into your apps.
Structure chat, RAG, tool use, and agents with built-in primitives.
Learn more →Local dev, debugging UI, and deployment to Firebase, Cloud Run, or your stack.
Learn more →Run, debug and observe your AI workflows from the local developer UI.

Choose your SDK language and provider (e.g. GoogleAI, OpenAI).
Define prompts, flows, and tools in code.
Use the Genkit CLI and Developer UI to inspect behaviour.
Run on Firebase, Cloud Run, or your own infrastructure.
See how Genkit works with Firebase, Angular, Next.js and more in production-ready apps, with pre-built demos and code you can reuse.