Model Abstraction
Genkit abstracts away provider-specific APIs into a single, consistent interface:- Switch providers easily: Change one line to try different models
- Multi-model workflows: Use different models for different tasks
- Consistent error handling: Same error types across providers
- Unified tracing: All model calls appear the same in traces
Model References
Models are referenced by a namespace/name format:googleai/gemini-2.0-flashanthropic/claude-3-5-sonnetollama/llama2vertexai/gemini-1.5-pro
Generating Content
Basic Text Generation
Structured Output
Request JSON output that matches a schema:Multimodal Input
Send images, audio, and video to multimodal models:Model Configuration
Configure model behavior with parameters:Default Configuration
Set defaults at the Genkit level:Tool Calling
Models can call functions (tools) to extend their capabilities:Streaming Responses
Stream responses as they’re generated:Available Model Providers
Official Providers
| Provider | Plugin | Models |
|---|---|---|
| Google AI | @genkit-ai/google-genai (JS)genkit.plugins.google_genai (Python) | Gemini 2.0 Flash, Gemini 1.5 Pro, Imagen, Veo |
| Anthropic | @genkit-ai/anthropicgenkit.plugins.anthropic | Claude 3.5 Sonnet, Claude 3 Opus |
| Vertex AI | @genkit-ai/vertexaigenkit.plugins.vertex_ai | Model Garden (1000+ models) |
| Ollama | @genkit-ai/ollamagenkit.plugins.ollama | Llama, Mistral, CodeLlama (local) |
| OpenAI-compatible | @genkit-ai/compat-oaigenkit.plugins.compat_oai | Any OpenAI-compatible API |
Community Providers
- Amazon Bedrock: Claude, Llama, Titan models
- Mistral AI: Mistral, Mixtral models
- Cohere: Command models + reranking
- DeepSeek: DeepSeek models
- xAI: Grok models
- HuggingFace: Inference API models
- Cloudflare Workers AI: Edge AI models
- Azure AI Foundry: 11,000+ models
Model Middleware
Add behavior to model calls with middleware:- Retry: Automatic retry with exponential backoff
- Caching: Cache responses for identical requests
- Safety: Filter harmful content
- Logging: Log all requests/responses
- Custom: Build your own