Firebase Genkit
Genkit is an open-source TypeScript toolkit designed to help you build AI-powered features in web and mobile apps.
It offers a unified interface for integrating AI models from Google, OpenAI, Anthropic, Ollama, and more, so you can explore and choose the best models for your needs. Genkit simplifies AI development with streamlined APIs for multimodal content generation, structured data generation, tool calling, human-in-the-loop, and other advanced capabilities.
Whether you're building chatbots, intelligent agents, workflow automations, or recommendation systems, Genkit handles the complexity of AI integration so you can focus on creating incredible user experiences.
You can integrate with various model providers in just a few lines of code:
import { genkit } from 'genkit';
import { googleAI, gemini20Flash } from '@genkit-ai/googleai';
const ai = genkit({ plugins: [googleAI()] });
const { text } = await ai.generate({
model: gemini20Flash,
prompt: 'Why is Firebase awesome?'
});
import { genkit } from 'genkit';
import { vertexAI, Imagen3 } from '@genkit-ai/vertexai';
const ai = genkit({ plugins: [vertexAI()] });
const response = await ai.generate({
model: imagen3,
output: { format: 'media' },
prompt: 'a banana riding a bicycle',
});
return response.media();
import { genkit } from 'genkit';
import { openAI, gpt4o } from 'genkitx-openai';
const ai = genkit({ plugins: [openAI()] });
const { text } = await ai.generate({
model: gpt4o,
prompt: 'Why is Firebase 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 Firebase awesome?'
});
import { genkit } from 'genkit';
import { llama31, vertexAIModelGarden } from '@genkit-ai/vertexai/modelgarden';
const ai = genkit({
plugins: [
vertexAIModelGarden({
location: 'us-central1',
models: [llama31],
}),
],
});
const { text } = await ai.generate({
model: llama31,
prompt: 'Why is Firebase awesome?',
});
import { genkit } from 'genkit';
import { mistralLarge, vertexAIModelGarden } from '@genkit-ai/vertexai/modelgarden';
const ai = genkit({
plugins: [
vertexAIModelGarden({
location: 'us-central1',
models: [mistralLarge],
}),
],
});
const { text } = await ai.generate({
model: mistralLarge,
prompt: 'Why is Firebase awesome?',
});
import { genkit } from 'genkit';
import { ollama } from 'genkitx-ollama';
const ai = genkit({
plugins: [
ollama({ models: [{ name: 'gemma' }] })
]
});
const { text } = await ai.generate({
model: 'ollama/gemma',
prompt: 'Why is Firebase awesome?',
});
Explore & build with Genkit
Play with AI sample apps, with visualizations of the Genkit code that powers them, at no cost to you.
Create your own AI-powered feature in minutes with our "Get started" guide.
Key capabilities
Broad AI model support | Use a unified interface to integrate with hundreds of models from providers like Google, OpenAI, Anthropic, Ollama, and more. Explore, compare, and use the best models for your needs. |
Simplified AI development | Use streamlined APIs to build AI features with structured output, agentic tool calling, context-aware generation, multi-modal input/output, and more. Genkit handles the complexity of AI development, so you can build and iterate faster. |
Web and mobile ready | Integrate seamlessly with frameworks and platforms including Next.js, React, Angular, iOS, Android, using purpose-built client SDKs and helpers. |
Deploy anywhere | Deploy AI logic anywhere Node.js is supported, such as Cloud Functions for Firebase, Google Cloud Run, or third-party platforms, with or without Google services. |
Developer tools | Accelerate AI development with a purpose-built, local CLI and Developer UI. Test prompts and flows against individual inputs or datasets, compare outputs from different models, debug with detailed execution traces, and use immediate visual feedback to iterate rapidly on prompts. |
Production monitoring | Ship AI features with confidence using comprehensive production monitoring. Track model performance, and request volumes, latency, and error rates in a purpose-built dashboard. Identify issues quickly with detailed observability metrics, and ensure your AI features meet quality and performance targets in real-world usage. |
How does it work?
Genkit simplifies AI integration with an open-source SDK and unified APIs that work across various model providers. It abstracts away complexity so you can focus on delivering great user experiences.
Some key features offered by Genkit include:
- Text and image generation
- Type-safe, structured data generation
- Tool calling
- Prompt templating
- Persisted chat interfaces
- AI workflows
- AI-powered data retrieval (RAG)
Genkit is designed for server-side deployment in Node.js environments, but also provides seamless client-side integration through dedicated helpers and Cloud Functions client SDKs.
Implementation path
Choose a model provider | Choose a model provider like Google Gemini or Anthropic, and get an API key. Some providers, like Vertex AI, may rely on a different means of authentication. | |
Install the SDK and initialize | Install the Genkit SDK, model-provider package of your choice, and the Genkit CLI. Import the Genkit and provider packages and initialize Genkit with the provider API key. | |
Write and test AI features | Use the Genkit SDK to build AI features for your use case, from basic text generation to complex multi-step workflows and agents. Use the CLI and Developer UI to help you rapidly test and iterate. | |
Deploy and monitor | Deploy your AI features to Firebase, Google Cloud Run, or any Node.js environment. Integrate them into your app, and monitor them in production in the Firebase console. |
Connect with us
- Join us on Discord – Get help, share ideas, and chat with other developers.
- Contribute on GitHub – Report bugs, suggest features, or explore the source code.
Next steps
Get started to create your first AI-powered feature in minutes