genkit
An open source framework for building AI-powered apps with familiar code-centric patterns. Genkit makes it easy to develop, integrate, and test AI features with observability and evaluations. Genkit works with various models and platforms.
Top Related Projects
The official Swift library for the Google Gemini API
The official Node.js / Typescript library for the Google Gemini API
This SDK is now deprecated, use the new unified Google GenAI SDK.
The official Python library for the OpenAI API
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
Quick Overview
Firebase GenKit is a code generation toolkit designed to streamline the development process for Firebase-related projects. It provides a set of tools and utilities to automatically generate code for various Firebase services, reducing boilerplate and improving consistency across Firebase implementations.
Pros
- Accelerates development by automating code generation for Firebase services
- Ensures consistency in Firebase implementations across projects
- Reduces the likelihood of errors in Firebase-related code
- Supports multiple programming languages and platforms
Cons
- May require a learning curve to understand and effectively use the toolkit
- Generated code might not always fit perfectly with custom project structures
- Could potentially lead to over-reliance on generated code, reducing developers' understanding of underlying Firebase concepts
- May not cover all edge cases or specific customizations needed for complex projects
Code Examples
- Generating Firebase Authentication code:
from genkit import FirebaseAuthGenerator
auth_generator = FirebaseAuthGenerator()
auth_code = auth_generator.generate_auth_methods(['email', 'google'])
print(auth_code)
- Creating Firestore database rules:
from genkit import FirestoreRulesGenerator
rules_generator = FirestoreRulesGenerator()
rules = rules_generator.generate_rules({
'users': {'read': 'auth != null', 'write': 'auth != null'},
'posts': {'read': 'true', 'write': 'auth != null'}
})
print(rules)
- Generating Cloud Functions boilerplate:
from genkit import CloudFunctionsGenerator
cf_generator = CloudFunctionsGenerator()
function_code = cf_generator.generate_function('onUserCreated', 'auth.user().onCreate')
print(function_code)
Getting Started
To get started with Firebase GenKit, follow these steps:
-
Install the GenKit package:
pip install firebase-genkit
-
Import the desired generator:
from genkit import FirebaseAuthGenerator
-
Create an instance of the generator and use it to generate code:
auth_generator = FirebaseAuthGenerator() auth_code = auth_generator.generate_auth_methods(['email', 'google'])
-
Use the generated code in your Firebase project as needed.
Competitor Comparisons
The official Swift library for the Google Gemini API
Pros of generative-ai-swift
- Specifically designed for Swift, offering native iOS and macOS support
- Integrates seamlessly with Apple's ecosystem and development tools
- Provides a more streamlined API for Swift developers
Cons of generative-ai-swift
- Limited to Swift and Apple platforms, reducing cross-platform compatibility
- May have a smaller community and fewer resources compared to Genkit
- Potentially less flexible for non-Apple environments
Code Comparison
generative-ai-swift:
let model = GenerativeModel(name: "gemini-pro", apiKey: "YOUR_API_KEY")
let response = try await model.generateContent("Tell me a joke")
print(response.text)
Genkit:
const genkit = require('genkit');
const model = new genkit.Model('gemini-pro');
const response = await model.generate('Tell me a joke');
console.log(response.text);
Summary
While generative-ai-swift offers a more tailored experience for Swift developers and Apple platforms, Genkit provides broader language and platform support. The choice between them depends on the specific project requirements, target platforms, and developer preferences.
The official Node.js / Typescript library for the Google Gemini API
Pros of generative-ai-js
- Specifically designed for Google's Gemini AI models, offering tailored functionality
- Provides a more comprehensive set of features for generative AI tasks
- Actively maintained with regular updates and community support
Cons of generative-ai-js
- Limited to Google's Gemini AI models, less flexible for other AI providers
- May have a steeper learning curve due to its specialized nature
- Potentially more complex setup process compared to genkit
Code Comparison
genkit:
import { GenKit } from 'genkit';
const genkit = new GenKit();
const response = await genkit.generate('Your prompt here');
console.log(response);
generative-ai-js:
import { GoogleGenerativeAI } from '@google/generative-ai';
const genAI = new GoogleGenerativeAI(API_KEY);
const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
const result = await model.generateContent('Your prompt here');
console.log(result.response.text());
Both libraries aim to simplify working with AI models, but generative-ai-js is more focused on Google's Gemini models, while genkit appears to be more general-purpose. The code examples show that generative-ai-js requires more setup but offers more specific control over the model used.
This SDK is now deprecated, use the new unified Google GenAI SDK.
Pros of deprecated-generative-ai-python
- More comprehensive documentation and examples
- Broader scope, covering multiple AI models and use cases
- Active community support and regular updates
Cons of deprecated-generative-ai-python
- Larger codebase, potentially more complex to integrate
- Deprecated status may lead to future compatibility issues
- Heavier resource requirements due to broader functionality
Code Comparison
genkit:
from genkit import Generator
generator = Generator()
response = generator.generate("Hello, world!")
print(response)
deprecated-generative-ai-python:
from google.generativeai import GenerativeModel
model = GenerativeModel("gemini-pro")
response = model.generate_content("Hello, world!")
print(response.text)
Summary
While genkit offers a simpler, more focused approach to Firebase-specific code generation, deprecated-generative-ai-python provides a wider range of AI capabilities. The choice between them depends on the specific project requirements and the desired level of AI integration. genkit may be preferable for Firebase-centric projects, while deprecated-generative-ai-python could be better suited for more diverse AI applications, despite its deprecated status.
The official Python library for the OpenAI API
Pros of openai-python
- Extensive documentation and examples for various OpenAI API endpoints
- Active development with frequent updates and bug fixes
- Large community support and extensive third-party integrations
Cons of openai-python
- Focused solely on OpenAI services, limiting versatility for other AI platforms
- Requires API key management and potential usage costs
- Steeper learning curve for beginners due to complex AI concepts
Code Comparison
openai-python:
import openai
openai.api_key = "your-api-key"
response = openai.Completion.create(
engine="davinci",
prompt="Translate the following English text to French: '{}'",
max_tokens=60
)
genkit:
from firebase_admin import initialize_app
from genkit import GenerativeModel
app = initialize_app()
model = GenerativeModel("gemini-pro")
response = model.generate_content("Translate the following English text to French: '{}'")
Both libraries provide methods to interact with AI models for text generation. openai-python offers more flexibility in model selection and parameter tuning, while genkit simplifies the process with a more straightforward API, particularly for Firebase integration.
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
Pros of Transformers
- Extensive library of pre-trained models for various NLP tasks
- Active community and frequent updates
- Comprehensive documentation and tutorials
Cons of Transformers
- Larger library size and potential overhead for simpler projects
- Steeper learning curve for beginners
Code Comparison
Transformers:
from transformers import pipeline
classifier = pipeline("sentiment-analysis")
result = classifier("I love this product!")[0]
print(f"Label: {result['label']}, Score: {result['score']:.4f}")
Genkit:
import genkit
model = genkit.load_model("sentiment")
result = model.predict("I love this product!")
print(f"Sentiment: {result.sentiment}, Score: {result.score:.4f}")
Key Differences
- Transformers offers a wider range of models and tasks
- Genkit focuses on simplicity and ease of use for specific tasks
- Transformers has more extensive customization options
- Genkit provides a more streamlined API for quick implementation
Use Cases
- Transformers: Advanced NLP projects, research, and complex language tasks
- Genkit: Rapid prototyping, simple NLP integration, and Firebase-specific applications
Community and Support
- Transformers: Large, active community with extensive third-party resources
- Genkit: Smaller community, but direct support from Firebase team
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Genkit is an open-source framework for building full-stack AI-powered applications, built and used in production by Google's Firebase. It provides SDKs for multiple programming languages with varying levels of stability:
- JavaScript/TypeScript (Stable): Production-ready with full feature support
- Go (Beta): Feature-complete but may have breaking changes
- Python (Alpha): Early development with core functionality
It offers a unified interface for integrating AI models from providers like Google, OpenAI, Anthropic, Ollama, and more. Rapidly build and deploy production-ready chatbots, automations, and recommendation systems using streamlined APIs for multimodal content, structured outputs, tool calling, and agentic workflows.
Get started with just a few lines of code:
import { genkit } from 'genkit';
import { googleAI } from '@genkit-ai/googleai';
const ai = genkit({ plugins: [googleAI()] });
const { text } = await ai.generate({
model: googleAI.model('gemini-2.0-flash'),
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.
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. |
Cross-language support | Build with the language that best fits your project. Genkit provides SDKs for JavaScript/TypeScript (Stable), Go (Beta), and Python (Alpha) with consistent APIs and capabilities across all supported languages. |
Deploy anywhere | Deploy AI logic to any environment that supports your chosen programming language, 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 and programming languages. 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 multiple language environments, and also provides seamless client-side integration through dedicated helpers and client SDKs.
Implementation path
1 | Choose your language and model provider | Select the Genkit SDK for your preferred language (JavaScript/TypeScript (Stable), Go (Beta), or Python (Alpha)). 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. |
2 | 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. |
3 | 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. |
4 | Deploy and monitor | Deploy your AI features to Firebase, Google Cloud Run, or any environment that supports your chosen programming language. Integrate them into your app, and monitor them in production in the Firebase console. |
Get started
- JavaScript/TypeScript quickstart (Stable)
- Go quickstart (Beta)
- Python quickstart (Alpha)
Development tools
Genkit provides a CLI and a local UI to streamline your AI development workflow.
CLI
The Genkit CLI includes commands for running and evaluating your Genkit functions (flows) and collecting telemetry and logs.
- Install:
npm install -g genkit-cli
- Run a command, wrapped with telemetry, a interactive developer UI, etc:
genkit start -- <command to run your code>
Developer UI
The Genkit developer UI is a local interface for testing, debugging, and iterating on your AI application.
Key features:
- Run: Execute and experiment with Genkit flows, prompts, queries, and more in dedicated playgrounds.
- Inspect: Analyze detailed traces of past executions, including step-by-step breakdowns of complex flows.
- Evaluate: Review the results of evaluations run against your flows, including performance metrics and links to relevant traces.

Try Genkit in Firebase Studio
Want to skip the local setup? Click below to try out Genkit using Firebase Studio, Google's AI-assisted workspace for full-stack app development in the cloud.
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.
Contributing
Contributions to Genkit are welcome and highly appreciated! See our Contribution Guide to get started.
Authors
Genkit is built by Firebase with contributions from the Open Source Community.
Top Related Projects
The official Swift library for the Google Gemini API
The official Node.js / Typescript library for the Google Gemini API
This SDK is now deprecated, use the new unified Google GenAI SDK.
The official Python library for the OpenAI API
🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot