Prerequisites
- Node.js 18 or later
- npm, yarn, or pnpm
- A Google AI API key (get one at Google AI Studio)
Step 1: Install Dependencies
Create a new project and install Genkit:Step 2: Set Your API Key
Set your Google AI API key as an environment variable:Step 3: Create Your First Application
Create a file namedindex.ts (or index.js for JavaScript):
index.ts
If you’re using JavaScript instead of TypeScript, you’ll need to use ES modules. Add
"type": "module" to your package.json.Step 4: Run Your Application
Run your application with the Genkit CLI to get automatic tracing and access to the Developer UI:Step 5: Explore the Developer UI
Open http://localhost:4000 in your browser to access the Genkit Developer UI. Here you can:- View execution traces of your AI requests
- Test different prompts interactively
- Compare outputs from different models
- Debug multi-step flows
What’s Next?
Add Streaming
Stream responses for better user experience:Generate Structured Output
Get type-safe JSON responses:Create a Flow
Flows are functions that encapsulate AI logic with automatic tracing:Add Tool Calling
Give your AI the ability to call functions:Try Other Model Providers
Genkit supports multiple AI providers:Learn More
Text Generation
Learn about different generation options
Structured Output
Generate type-safe JSON responses
Tool Calling
Give AI models access to functions
Developer Tools
Explore the Developer UI features